37 lines
848 B
C++
37 lines
848 B
C++
#pragma once
|
|
#include <functional>
|
|
#include <iostream>
|
|
|
|
#include "GuiElement.h"
|
|
#include "Texture.h"
|
|
#include "../TextureManager.h"
|
|
|
|
class GuiButton : public GuiElement {
|
|
public:
|
|
GuiButton() = default;
|
|
GuiButton(const std::string& filePath, const Vector2f& pos, const Vector2f& size, bool shouldHideDefault, TextureManager* manager);
|
|
~GuiButton() override = default;
|
|
virtual void Draw() const override;
|
|
virtual void Update(float elapsedSec) override;
|
|
|
|
void SetOnClick(std::function<void(void)> onClick) {
|
|
m_OnClick = onClick;
|
|
}
|
|
|
|
private:
|
|
Texture* m_Texture { nullptr };
|
|
Vector2f m_Position;
|
|
Vector2f m_Size;
|
|
|
|
bool m_IsHovered { false };
|
|
bool m_IsPressed { false };
|
|
bool m_IsPrimed { false };
|
|
|
|
bool m_shouldHide { true };
|
|
|
|
std::function<void(void)> m_OnClick { []()
|
|
{
|
|
std::cout << "Button not implemented" << std::endl;
|
|
} };
|
|
};
|