diff options
Diffstat (limited to 'src/crepe/api/Text.h')
-rw-r--r-- | src/crepe/api/Text.h | 15 |
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 |