This commit is contained in:
Bram Verhulst
2024-06-09 22:03:29 +02:00
parent d7389411f5
commit 5f1dcd5788
76 changed files with 1532 additions and 385 deletions

View File

@@ -6,27 +6,31 @@
#include "Texture.h"
#include "../TextureManager.h"
class GuiButton : public GuiElement
{
class GuiButton : public GuiElement {
public:
GuiButton() = default;
GuiButton(const std::string& filePath, Vector2f pos, Vector2f size, TextureManager* manager);
~GuiButton() override;
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 };
Texture* m_Texture { nullptr };
Vector2f m_Position;
Vector2f m_Size;
bool m_IsHovered{ false };
bool m_IsPressed{ false };
bool m_IsPrimed{ false };
bool m_IsHovered { false };
bool m_IsPressed { false };
bool m_IsPrimed { false };
std::function<void(void)> m_OnClick{ []() { std::cout << "Button not implemented" << std::endl; } };
bool m_shouldHide { true };
std::function<void(void)> m_OnClick { []()
{
std::cout << "Button not implemented" << std::endl;
} };
};