diff options
author | WBoerenkamps <wrj.boerenkamps@student.avans.nl> | 2024-12-04 21:50:00 +0100 |
---|---|---|
committer | WBoerenkamps <wrj.boerenkamps@student.avans.nl> | 2024-12-04 21:50:00 +0100 |
commit | d10f220ff6c5d62bb51793a0ef4ee37090161d89 (patch) | |
tree | b709844a2fd689314d096cf0de72107a426c27f9 /src/crepe/api | |
parent | c1f30c168fc95818ea75660d90c395b0a548412e (diff) |
feedback changes
Diffstat (limited to 'src/crepe/api')
-rw-r--r-- | src/crepe/api/Button.cpp | 4 | ||||
-rw-r--r-- | src/crepe/api/Button.h | 4 | ||||
-rw-r--r-- | src/crepe/api/CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/crepe/api/UIObject.cpp | 8 | ||||
-rw-r--r-- | src/crepe/api/UIObject.h (renamed from src/crepe/api/UiObject.h) | 3 | ||||
-rw-r--r-- | src/crepe/api/UiObject.cpp | 8 |
6 files changed, 16 insertions, 15 deletions
diff --git a/src/crepe/api/Button.cpp b/src/crepe/api/Button.cpp index b104329..313ec4c 100644 --- a/src/crepe/api/Button.cpp +++ b/src/crepe/api/Button.cpp @@ -2,8 +2,8 @@ namespace crepe { -Button::Button(game_object_id_t id, vec2 dimensions, vec2 offset, - std::function<void()> on_click, bool is_toggle) +Button::Button(game_object_id_t id, const vec2& dimensions, const vec2& offset, + const std::function<void()>& on_click, bool is_toggle) : UIObject(id, dimensions, offset), is_toggle(is_toggle), on_click(on_click) {} diff --git a/src/crepe/api/Button.h b/src/crepe/api/Button.h index 5c803ba..baee71f 100644 --- a/src/crepe/api/Button.h +++ b/src/crepe/api/Button.h @@ -2,7 +2,7 @@ #include <functional> -#include "UiObject.h" +#include "UIObject.h" namespace crepe { @@ -21,7 +21,7 @@ public: * \param is_toggle Optional flag to indicate if the button is a toggle button. Defaults to false. * \param on_click callback function that will be invoked when the button is clicked. */ - Button(game_object_id_t id, vec2 dimensions, vec2 offset, std::function<void()> on_click, + Button(game_object_id_t id, const vec2 & dimensions, const vec2 & offset, const std::function<void()>& on_click, bool is_toggle = false); /** diff --git a/src/crepe/api/CMakeLists.txt b/src/crepe/api/CMakeLists.txt index aeb451d..25a9439 100644 --- a/src/crepe/api/CMakeLists.txt +++ b/src/crepe/api/CMakeLists.txt @@ -24,7 +24,7 @@ target_sources(crepe PUBLIC EventHandler.cpp Script.cpp Button.cpp - UiObject.cpp + UIObject.cpp ) target_sources(crepe PUBLIC FILE_SET HEADERS FILES @@ -61,5 +61,5 @@ target_sources(crepe PUBLIC FILE_SET HEADERS FILES LoopTimer.h Asset.h Button.h - UiObject.h + UIObject.h ) diff --git a/src/crepe/api/UIObject.cpp b/src/crepe/api/UIObject.cpp new file mode 100644 index 0000000..784328a --- /dev/null +++ b/src/crepe/api/UIObject.cpp @@ -0,0 +1,8 @@ +#include "UIObject.h" + +using namespace crepe; + +UIObject::UIObject(game_object_id_t id, const vec2 & dimensions, const vec2 &offset) + : Component(id), + dimensions(dimensions), + offset(offset) {} diff --git a/src/crepe/api/UiObject.h b/src/crepe/api/UIObject.h index 0634f97..614794d 100644 --- a/src/crepe/api/UiObject.h +++ b/src/crepe/api/UIObject.h @@ -16,9 +16,10 @@ public: * \param dimensions width and height of the UIObject * \param offset Offset relative to the GameObject Transform */ - UIObject(game_object_id_t id, vec2 dimensions, vec2 offset); + UIObject(game_object_id_t id, const vec2 & dimensions, const vec2 & offset); //! Width and height of the UIObject vec2 dimensions; + //! Position offset relative to this GameObjects Transform vec2 offset; }; diff --git a/src/crepe/api/UiObject.cpp b/src/crepe/api/UiObject.cpp deleted file mode 100644 index 2b287b3..0000000 --- a/src/crepe/api/UiObject.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "UiObject.h" - -using namespace crepe; - -UIObject::UIObject(game_object_id_t id, vec2 dimensions, vec2 offset) - : Component(id), - dimensions(dimensions), - offset(offset) {} |