From 15220fd01798d88a3c1acd21b6b1220c1273c1ee Mon Sep 17 00:00:00 2001 From: heavydemon21 Date: Sun, 22 Dec 2024 13:52:14 +0100 Subject: button feedback --- src/crepe/api/Button.cpp | 7 +++++-- src/crepe/api/Button.h | 14 +++++++++++--- 2 files changed, 16 insertions(+), 5 deletions(-) (limited to 'src/crepe') diff --git a/src/crepe/api/Button.cpp b/src/crepe/api/Button.cpp index 40153c9..c4f7f2d 100644 --- a/src/crepe/api/Button.cpp +++ b/src/crepe/api/Button.cpp @@ -2,7 +2,10 @@ namespace crepe { -Button::Button(game_object_id_t id, const vec2 & dimensions, const vec2 & offset) - : UIObject(id, dimensions, offset) {} +Button::Button( + game_object_id_t id, const vec2 & dimensions, const vec2 & offset, const Data & data +) + : UIObject(id, dimensions, offset), + data(data) {} } // namespace crepe diff --git a/src/crepe/api/Button.h b/src/crepe/api/Button.h index 25709a4..f6d363a 100644 --- a/src/crepe/api/Button.h +++ b/src/crepe/api/Button.h @@ -17,6 +17,12 @@ 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. @@ -24,8 +30,11 @@ public: * \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 vec2 & offset, const Data & data + ); /** * \brief Get the maximum number of instances for this component * @@ -41,8 +50,7 @@ private: //! Indicates whether the mouse is currently hovering over the button bool hover = false; - //! variable indicating if transform is relative to camera(false) or world(true) - bool world_space = false; + Data data; }; } // namespace crepe -- cgit v1.2.3