diff options
author | WBoerenkamps <wrj.boerenkamps@student.avans.nl> | 2024-11-19 15:16:16 +0100 |
---|---|---|
committer | WBoerenkamps <wrj.boerenkamps@student.avans.nl> | 2024-11-19 15:16:16 +0100 |
commit | 6c2fc3716c9c6c68e982b243af5f7ed04fb35e86 (patch) | |
tree | c5a20a8a5352edc19cca1d6ddcbf7869db6e1055 /src/crepe/api | |
parent | 60cbc3d649775053ac1d333716c9f5fda651a643 (diff) |
button handling
Diffstat (limited to 'src/crepe/api')
-rw-r--r-- | src/crepe/api/Button.cpp | 0 | ||||
-rw-r--r-- | src/crepe/api/Button.h | 17 | ||||
-rw-r--r-- | src/crepe/api/UiObject.h | 14 |
3 files changed, 31 insertions, 0 deletions
diff --git a/src/crepe/api/Button.cpp b/src/crepe/api/Button.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/crepe/api/Button.cpp diff --git a/src/crepe/api/Button.h b/src/crepe/api/Button.h new file mode 100644 index 0000000..5035729 --- /dev/null +++ b/src/crepe/api/Button.h @@ -0,0 +1,17 @@ +#include <functional> + +#include "Component.h" +#include "api/EventHandler.h" +#include "api/UiObject.h" +namespace crepe { +class Button : public UiObject{ +public: + ~Button(){}; + bool interactable = true; + bool is_toggle = false; + bool is_pressed = false; + std::function<void()> on_click; +public: +virtual int get_instances_max() const { return 1; } +}; +} diff --git a/src/crepe/api/UiObject.h b/src/crepe/api/UiObject.h new file mode 100644 index 0000000..f57f7ef --- /dev/null +++ b/src/crepe/api/UiObject.h @@ -0,0 +1,14 @@ +#include <functional> + +#include "Component.h" +#include "api/EventHandler.h" +namespace crepe { +class UiObject : public Component{ +public: + ~UiObject(){}; + int width = 0; + int height = 0; +public: +virtual int get_instances_max() const { return 1; } +}; +} |