From 7c85ab11e840c281a2499dcc6dd3219c33e7d37f Mon Sep 17 00:00:00 2001 From: hop311 Date: Thu, 15 Aug 2024 00:13:54 +0100 Subject: Add GUITextLabel (colour code + currency icon support) --- .../src/openvic-extension/singletons/AssetManager.hpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'extension/src/openvic-extension/singletons/AssetManager.hpp') diff --git a/extension/src/openvic-extension/singletons/AssetManager.hpp b/extension/src/openvic-extension/singletons/AssetManager.hpp index 0856d05..deca309 100644 --- a/extension/src/openvic-extension/singletons/AssetManager.hpp +++ b/extension/src/openvic-extension/singletons/AssetManager.hpp @@ -1,12 +1,14 @@ #pragma once #include -#include +#include #include #include #include +#include "openvic-extension/classes/GFXSpriteTexture.hpp" + namespace OpenVic { class AssetManager : public godot::Object { GDCLASS(AssetManager, godot::Object) @@ -32,7 +34,7 @@ namespace OpenVic { }; /* deque_ordered_map to avoid the need to reallocate. */ using image_asset_map_t = deque_ordered_map; - using font_map_t = deque_ordered_map>; + using font_map_t = deque_ordered_map>; image_asset_map_t image_assets; font_map_t fonts; @@ -68,7 +70,18 @@ namespace OpenVic { /* Search for and load a font with the specified name from the game defines' font directory, first checking the * AssetManager's font cache in case it has already been loaded, and returning nullptr if font loading fails. */ - godot::Ref get_font(godot::StringName const& name); + godot::Ref get_font(godot::StringName const& name); + + private: + godot::Ref PROPERTY(currency_texture_big); // 32x32 + godot::Ref PROPERTY(currency_texture_medium); // 24x24 + godot::Ref PROPERTY(currency_texture_small); // 16x16 + + public: + godot::Error preload_textures(); + + /* Get the largest currency texture with height less than the specified font height. */ + godot::Ref const& get_currency_texture(real_t height) const; }; } -- cgit v1.2.3-56-ga3b1