diff options
Diffstat (limited to 'extension/src/openvic-extension/singletons/GameSingleton.hpp')
-rw-r--r-- | extension/src/openvic-extension/singletons/GameSingleton.hpp | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/extension/src/openvic-extension/singletons/GameSingleton.hpp b/extension/src/openvic-extension/singletons/GameSingleton.hpp index e84e366..f2b88ac 100644 --- a/extension/src/openvic-extension/singletons/GameSingleton.hpp +++ b/extension/src/openvic-extension/singletons/GameSingleton.hpp @@ -22,7 +22,13 @@ namespace OpenVic { godot::Ref<godot::ImageTexture> province_colour_texture; Mapmode::index_t mapmode_index = 0; godot::Ref<godot::Texture2DArray> terrain_texture; - ordered_map<Country const*, ordered_map<godot::StringName, godot::Ref<godot::Image>>> flag_image_map; + + static const godot::Vector2i PROPERTY(flag_dims); /* The size in pixels of an individual flag. */ + int32_t flag_sheet_count = 0; /* The number of flags in the flag sheet. */ + godot::Vector2i flag_sheet_dims; /* The size of the flag sheet in flags, rather than pixels. */ + godot::Ref<godot::Image> flag_sheet_image; + godot::Ref<godot::ImageTexture> flag_sheet_texture; + ordered_map<godot::StringName, int32_t> flag_type_index_map; static godot::StringName const& _signal_gamestate_updated(); static godot::StringName const& _signal_province_selected(); @@ -30,7 +36,7 @@ namespace OpenVic { godot::Error _load_map_images(); godot::Error _load_terrain_variants(); - godot::Error _load_flag_images(); + godot::Error _load_flag_sheet(); /* Generate the province_colour_texture from the current mapmode. */ godot::Error _update_colour_image(); @@ -61,14 +67,20 @@ namespace OpenVic { int32_t get_map_width() const; int32_t get_map_height() const; + godot::Vector2i get_map_dims() const; float get_map_aspect_ratio() const; /* The cosmetic terrain textures stored in a Texture2DArray. */ godot::Ref<godot::Texture2DArray> get_terrain_texture() const; - /* The flag image corresponding to the requested country / flag_type - * combination, or nullptr if no such flag can be found. */ - godot::Ref<godot::Image> get_flag_image(Country const* country, godot::StringName const& flag_type) const; + godot::Ref<godot::Image> get_flag_sheet_image() const; + godot::Ref<godot::ImageTexture> get_flag_sheet_texture() const; + + /* The index of the flag in the flag sheet corresponding to the requested country / flag_type + * combination, or -1 if no such flag can be found. */ + int32_t get_flag_sheet_index(int32_t country_index, godot::StringName const& flag_type) const; + godot::Rect2i get_flag_sheet_rect(int32_t flag_index) const; + godot::Rect2i get_flag_sheet_rect(int32_t country_index, godot::StringName const& flag_type) const; /* Number of (vertical, horizontal) subdivisions the province shape image * was split into when making the province_shape_texture to ensure no @@ -83,6 +95,8 @@ namespace OpenVic { /* The base and stripe colours for each province. */ godot::Ref<godot::ImageTexture> get_province_colour_texture() const; + godot::TypedArray<godot::Dictionary> get_province_names() const; + int32_t get_mapmode_count() const; godot::String get_mapmode_identifier(int32_t index) const; godot::Error set_mapmode(godot::String const& identifier); |