aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/api/Button.h
diff options
context:
space:
mode:
authorJAROWMR <jarorutjes07@gmail.com>2025-01-03 19:43:43 +0100
committerJAROWMR <jarorutjes07@gmail.com>2025-01-03 19:43:43 +0100
commit41b1941f9ce1b0b31d2d5a3f0b34b0d3d6a0027a (patch)
treee29ab87019301984273ce2a08910fa6c2cbbe149 /src/crepe/api/Button.h
parent4f687de3530fac052f30dac7b8c59dae103bcf81 (diff)
parentcf6ca6be5a9deac4de921f50d0aedf6a6156e0f4 (diff)
Merge branch 'master' of github.com:lonkaars/crepe into jaro/main-menu
Diffstat (limited to 'src/crepe/api/Button.h')
-rw-r--r--src/crepe/api/Button.h18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/crepe/api/Button.h b/src/crepe/api/Button.h
index d42527e..e986c04 100644
--- a/src/crepe/api/Button.h
+++ b/src/crepe/api/Button.h
@@ -1,8 +1,7 @@
#pragma once
-#include <functional>
+#include "../types.h"
-#include "Event.h"
#include "UIObject.h"
namespace crepe {
@@ -21,14 +20,24 @@ namespace crepe {
*/
class Button : public UIObject {
public:
+ struct Data {
+ //! variable indicating if transform is relative to camera(false) or world(true)
+ bool world_space = false;
+ };
+
+public:
/**
* \brief Constructs a Button with the specified game object ID and dimensions.
*
* \param id The unique ID of the game object associated with this button.
* \param dimensions The width and height of the UIObject
* \param offset The offset relative this GameObjects Transform
+ * \param data additional data the button has
*/
- Button(game_object_id_t id, const vec2 & dimensions, const vec2 & offset);
+ Button(
+ game_object_id_t id, const vec2 & dimensions, const Data & data,
+ const vec2 & offset = {0, 0}
+ );
/**
* \brief Get the maximum number of instances for this component
*
@@ -38,6 +47,9 @@ public:
*/
virtual int get_instances_max() const { return 1; }
+public:
+ Data data;
+
private:
//! friend relation hover variable
friend class InputSystem;