aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/api/Text.h
diff options
context:
space:
mode:
authorWBoerenkamps <wrj.boerenkamps@student.avans.nl>2024-12-11 16:45:05 +0100
committerWBoerenkamps <wrj.boerenkamps@student.avans.nl>2024-12-11 16:45:05 +0100
commit4bb6e89d93596c9c53798b1b9a01c588cabfe881 (patch)
treee59d8efd164056f9a4679f356bbd934877aea0ba /src/crepe/api/Text.h
parenta108f7360e03cc7826ad4ed0cee464b1196fa456 (diff)
save
Diffstat (limited to 'src/crepe/api/Text.h')
-rw-r--r--src/crepe/api/Text.h29
1 files changed, 26 insertions, 3 deletions
diff --git a/src/crepe/api/Text.h b/src/crepe/api/Text.h
index 5c527af..9dd275b 100644
--- a/src/crepe/api/Text.h
+++ b/src/crepe/api/Text.h
@@ -1,12 +1,35 @@
#pragma once
-#include "Asset.h"
+#include <string>
+
#include "../Component.h"
-class Text : public Component{
+
+#include "Asset.h"
+#include "Color.h"
+#include "UIObject.h"
+
+namespace crepe{
+class Text : public UIObject{
public:
- Text(game_object_id_t id, const Asset & font, int font_size);
+ Text(game_object_id_t id,const vec2 & dimensions, const vec2 & offset, const Asset & font, int font_size);
+ //! Label text.
+ std::string text;
+ //! Label text color
+ Color text_color = Color::BLACK;
+ /**
+ * \brief fontsize for text rendering
+ *
+ * \note this is not the actual font size that is loaded in.
+ *
+ * Since SDL_TTF requires the font size when loading in the font it is not possible to switch the font size.
+ * The default font size that is loaded is set in the Config.
+ * Instead this value is used to upscale the font texture which can cause blurring or distorted text when upscaling or downscaling too much.
+ */
int font_size = 16;
+
const Asset source;
private:
};
+
+} // namespace crepe