aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/api/Text.h
diff options
context:
space:
mode:
authorheavydemon21 <nielsstunnebrink1@gmail.com>2024-12-17 13:31:34 +0100
committerheavydemon21 <nielsstunnebrink1@gmail.com>2024-12-17 13:31:34 +0100
commit24578c9afb61ae65b300dd7fb645220e133089be (patch)
treec6451ea01a56f0bde33a803ea37169f59d0fc41d /src/crepe/api/Text.h
parentbcaee968761c1d2e85c20925b237480c87da9747 (diff)
parent707db8c94b6bb3921105f40658aab13511d8df07 (diff)
Merge branch 'wouter/text-component' into niels/UI
Diffstat (limited to 'src/crepe/api/Text.h')
-rw-r--r--src/crepe/api/Text.h15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/crepe/api/Text.h b/src/crepe/api/Text.h
index ec0bf74..ab72bc0 100644
--- a/src/crepe/api/Text.h
+++ b/src/crepe/api/Text.h
@@ -1,6 +1,7 @@
#pragma once
#include <string>
+#include <optional>
#include "../Component.h"
@@ -47,15 +48,21 @@ public:
* \param text The text to be displayed.
* \param font_family The font style name to be displayed.
* \param data Data struct containing extra text parameters.
+ * \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 & text, const std::string & font_family, const Data & data);
+ Text(game_object_id_t id, const vec2 & dimensions, const vec2 & offset,
+ const std::string & font_family, const Data & data,
+ const std::string & text = "", std::optional<Asset> font = std::nullopt);
+
//! Label text.
std::string text = "";
- //! Font asset variable
- const Asset font;
+ //! font family name
+ std::string font_family = "";
+ //! Font asset variable if this is not set, it will use the font_family to create an asset.
+ std::optional<Asset> font;
//! Data instance
Data data;
+
};
} // namespace crepe