diff options
Diffstat (limited to 'src/crepe/api')
-rw-r--r-- | src/crepe/api/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/crepe/api/Config.h | 4 | ||||
-rw-r--r-- | src/crepe/api/Text.cpp | 6 | ||||
-rw-r--r-- | src/crepe/api/Text.h | 8 |
4 files changed, 14 insertions, 6 deletions
diff --git a/src/crepe/api/CMakeLists.txt b/src/crepe/api/CMakeLists.txt index fb11c8d..90e4d1f 100644 --- a/src/crepe/api/CMakeLists.txt +++ b/src/crepe/api/CMakeLists.txt @@ -20,6 +20,7 @@ target_sources(crepe PUBLIC Button.cpp UIObject.cpp AI.cpp + Text.cpp ) target_sources(crepe PUBLIC FILE_SET HEADERS FILES @@ -49,4 +50,5 @@ target_sources(crepe PUBLIC FILE_SET HEADERS FILES Button.h UIObject.h AI.h + Text.h ) diff --git a/src/crepe/api/Config.h b/src/crepe/api/Config.h index def4c49..159be99 100644 --- a/src/crepe/api/Config.h +++ b/src/crepe/api/Config.h @@ -81,11 +81,11 @@ struct Config final { /** * \brief Default font size * - * using the SDL_ttf library the font size needs to be set when loading the font. + * Using the SDL_ttf library the font size needs to be set when loading the font. * This config option is the font size at which all fonts will be loaded initially. * */ - int font_size = 16; + unsigned int size = 16; } font; //! Audio system settings diff --git a/src/crepe/api/Text.cpp b/src/crepe/api/Text.cpp index e69de29..dd44dd9 100644 --- a/src/crepe/api/Text.cpp +++ b/src/crepe/api/Text.cpp @@ -0,0 +1,6 @@ +#include "Text.h" + +using namespace crepe; + +Text::Text(game_object_id_t id,const vec2 & dimensions, const vec2 & offset, const Asset & font) : UIObject(id,dimensions,offset),source(font){} + diff --git a/src/crepe/api/Text.h b/src/crepe/api/Text.h index 9dd275b..d5f47fa 100644 --- a/src/crepe/api/Text.h +++ b/src/crepe/api/Text.h @@ -11,11 +11,11 @@ namespace crepe{ class Text : public UIObject{ public: - Text(game_object_id_t id,const vec2 & dimensions, const vec2 & offset, const Asset & font, int font_size); + Text(game_object_id_t id,const vec2 & dimensions, const vec2 & offset, const Asset & font); //! Label text. std::string text; - //! Label text color + //! Label text color. Color text_color = Color::BLACK; /** * \brief fontsize for text rendering @@ -26,8 +26,8 @@ public: * 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; - + unsigned int font_size = 16; + //! Font asset const Asset source; private: }; |