aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/api/Text.h
diff options
context:
space:
mode:
authorWBoerenkamps <wrj.boerenkamps@student.avans.nl>2024-12-17 13:22:34 +0100
committerWBoerenkamps <wrj.boerenkamps@student.avans.nl>2024-12-17 13:22:34 +0100
commitb99f5fc0f52fdd4ec96be844e643060503a8860b (patch)
treedbf0efa56ad98debbb2aa288866ec4a1fbf80d55 /src/crepe/api/Text.h
parent3b5b5258b0f46a3492a7fd777908dfb01e15417b (diff)
text now working with optional
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