aboutsummaryrefslogtreecommitdiff
path: root/include/gui/Button.hpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-08-01 22:19:59 +0200
committerdec05eba <dec05eba@protonmail.com>2024-08-01 22:22:45 +0200
commit10a5669330ba978c37d984a312ba1de7a2542503 (patch)
tree0ff8cc9660841ce3979ad87da954fb7e14de7d16 /include/gui/Button.hpp
parent67216467d4dc43134a07f7f843a80a1adf688acd (diff)
Draw and event position relative to parent (for pages)
Diffstat (limited to 'include/gui/Button.hpp')
-rw-r--r--include/gui/Button.hpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/include/gui/Button.hpp b/include/gui/Button.hpp
index 972e5c9..88399ae 100644
--- a/include/gui/Button.hpp
+++ b/include/gui/Button.hpp
@@ -1,25 +1,28 @@
#pragma once
#include "Widget.hpp"
-#include <string>
#include <functional>
+#include <mglpp/graphics/Color.hpp>
+#include <mglpp/graphics/Text.hpp>
+
namespace gsr {
class Button : public Widget {
public:
- Button(mgl::vec2f size);
+ Button(mgl::Font *font, const char *text, mgl::vec2f size, mgl::Color bg_color);
Button(const Button&) = delete;
Button& operator=(const Button&) = delete;
- bool on_event(mgl::Event &event, mgl::Window &window) override;
- void draw(mgl::Window &window) override;
+ bool on_event(mgl::Event &event, mgl::Window &window, mgl::vec2f offset) override;
+ void draw(mgl::Window &window, mgl::vec2f offset) override;
mgl::vec2f get_size() const { return size; }
std::function<void()> on_click;
private:
mgl::vec2f size;
+ mgl::Color bg_color;
bool mouse_inside = false;
- bool pressed_inside = false;
+ mgl::Text text;
};
} \ No newline at end of file