29 lines
904 B
C++
29 lines
904 B
C++
#pragma once
|
|
|
|
#include <object/entity.hpp>
|
|
#include <renderer/font.hpp>
|
|
#include <renderer/texture.hpp>
|
|
#include <utility>
|
|
#include <game/input.hpp>
|
|
|
|
namespace Game::Object {
|
|
class UIButton : public Entity {
|
|
public:
|
|
UIButton(const std::string& name, std::shared_ptr<Renderer::Texture> texture, const Transform& transform, void* clickFunction = nullptr, float x = 0.f, float y = 0.f);
|
|
~UIButton() override = default;
|
|
|
|
void start() override;
|
|
void update(float deltaTime) override;
|
|
|
|
void setText(const std::string& text);
|
|
std::string getText() const;
|
|
|
|
void setPosition(float x, float y) { mX = x; mY = y; }
|
|
std::pair<float, float> getPosition() const { return {mX, mY}; }
|
|
|
|
private:
|
|
void* mClickFunction = nullptr;
|
|
float mX, mY;
|
|
std::string mText;
|
|
};
|
|
} |