From 296c80edd6727d6808ed0c98c001a8b456f1c037 Mon Sep 17 00:00:00 2001 From: heavydemon21 Date: Sat, 21 Dec 2024 10:27:16 +0100 Subject: implemented feedback --- src/crepe/api/UIObject.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/crepe/api/UIObject.h') diff --git a/src/crepe/api/UIObject.h b/src/crepe/api/UIObject.h index f1318ab..f7f4fba 100644 --- a/src/crepe/api/UIObject.h +++ b/src/crepe/api/UIObject.h @@ -20,8 +20,6 @@ public: vec2 dimensions; //! Position offset relative to this GameObjects Transform vec2 offset; - //! variable indicating if transform is relative to camera(false) or world(true) - bool world_space = false; }; } // namespace crepe -- cgit v1.2.3 From a5f8b34f4701863901e89abe5b0b604fd9e553b2 Mon Sep 17 00:00:00 2001 From: heavydemon21 Date: Sun, 22 Dec 2024 20:18:44 +0100 Subject: ui fixes for offset --- src/crepe/api/Button.cpp | 2 +- src/crepe/api/Button.h | 4 +++- src/crepe/api/Text.cpp | 5 +++-- src/crepe/api/Text.h | 5 +++-- src/crepe/api/UIObject.h | 2 +- 5 files changed, 11 insertions(+), 7 deletions(-) (limited to 'src/crepe/api/UIObject.h') diff --git a/src/crepe/api/Button.cpp b/src/crepe/api/Button.cpp index c4f7f2d..8eadd89 100644 --- a/src/crepe/api/Button.cpp +++ b/src/crepe/api/Button.cpp @@ -3,7 +3,7 @@ namespace crepe { Button::Button( - game_object_id_t id, const vec2 & dimensions, const vec2 & offset, const Data & data + game_object_id_t id, const vec2 & dimensions, const Data & data, const vec2 & offset ) : UIObject(id, dimensions, offset), data(data) {} diff --git a/src/crepe/api/Button.h b/src/crepe/api/Button.h index f6d363a..d7dc747 100644 --- a/src/crepe/api/Button.h +++ b/src/crepe/api/Button.h @@ -1,6 +1,7 @@ #pragma once #include "UIObject.h" +#include "types.h" namespace crepe { @@ -33,7 +34,8 @@ public: * \param data additional data the button has */ Button( - game_object_id_t id, const vec2 & dimensions, const vec2 & offset, const Data & data + 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 diff --git a/src/crepe/api/Text.cpp b/src/crepe/api/Text.cpp index b24f0ac..29e36f1 100644 --- a/src/crepe/api/Text.cpp +++ b/src/crepe/api/Text.cpp @@ -1,10 +1,11 @@ #include "Text.h" +#include "types.h" using namespace crepe; Text::Text( - game_object_id_t id, const vec2 & dimensions, const vec2 & offset, - const std::string & font_family, const Data & data, const std::string & text + game_object_id_t id, const vec2 & dimensions, const std::string & font_family, + const Data & data, const vec2 & offset, const std::string & text ) : UIObject(id, dimensions, offset), text(text), diff --git a/src/crepe/api/Text.h b/src/crepe/api/Text.h index 0163bbb..37d86b4 100644 --- a/src/crepe/api/Text.h +++ b/src/crepe/api/Text.h @@ -6,6 +6,7 @@ #include "Asset.h" #include "Color.h" #include "UIObject.h" +#include "types.h" namespace crepe { /** @@ -35,8 +36,8 @@ public: * \param font Optional font asset that can be passed or left empty. */ Text( - game_object_id_t id, const vec2 & dimensions, const vec2 & offset, - const std::string & font_family, const Data & data, const std::string & text = "" + game_object_id_t id, const vec2 & dimensions, const std::string & font_family, + const Data & data, const vec2 & offset = {0, 0}, const std::string & text = "" ); //! Label text. diff --git a/src/crepe/api/UIObject.h b/src/crepe/api/UIObject.h index f7f4fba..5c1fdf7 100644 --- a/src/crepe/api/UIObject.h +++ b/src/crepe/api/UIObject.h @@ -15,7 +15,7 @@ public: * \param dimensions width and height of the UIObject * \param offset Offset relative to the GameObject Transform */ - UIObject(game_object_id_t id, const vec2 & dimensions, const vec2 & offset); + UIObject(game_object_id_t id, const vec2 & dimensions, const vec2 & offset = {0,0}); //! Width and height of the UIObject vec2 dimensions; //! Position offset relative to this GameObjects Transform -- cgit v1.2.3 From 4526efe1b6dd63aaa177f8f35194989d3910d571 Mon Sep 17 00:00:00 2001 From: heavydemon21 Date: Tue, 24 Dec 2024 09:50:10 +0100 Subject: make format --- src/crepe/api/UIObject.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/crepe/api/UIObject.h') diff --git a/src/crepe/api/UIObject.h b/src/crepe/api/UIObject.h index 5c1fdf7..0d9b1f7 100644 --- a/src/crepe/api/UIObject.h +++ b/src/crepe/api/UIObject.h @@ -15,7 +15,7 @@ public: * \param dimensions width and height of the UIObject * \param offset Offset relative to the GameObject Transform */ - UIObject(game_object_id_t id, const vec2 & dimensions, const vec2 & offset = {0,0}); + UIObject(game_object_id_t id, const vec2 & dimensions, const vec2 & offset = {0, 0}); //! Width and height of the UIObject vec2 dimensions; //! Position offset relative to this GameObjects Transform -- cgit v1.2.3