aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/interface/GFX.cpp
diff options
context:
space:
mode:
author hop311 <hop3114@gmail.com>2024-02-19 21:36:58 +0100
committer hop311 <hop3114@gmail.com>2024-02-19 21:36:58 +0100
commit22b30266a431de0b0b60cf9c0aed5a364da6ab43 (patch)
treede006dc90bc57d7719265ef55c70f05b7c9af0ba /src/openvic-simulation/interface/GFX.cpp
parentf5eb9a282891dfee0cfedd5533615448fed2528c (diff)
Add TextureSprite base classfp-rounding+texture-sprites
Diffstat (limited to 'src/openvic-simulation/interface/GFX.cpp')
-rw-r--r--src/openvic-simulation/interface/GFX.cpp42
1 files changed, 22 insertions, 20 deletions
diff --git a/src/openvic-simulation/interface/GFX.cpp b/src/openvic-simulation/interface/GFX.cpp
index ff2737c..06d4cd3 100644
--- a/src/openvic-simulation/interface/GFX.cpp
+++ b/src/openvic-simulation/interface/GFX.cpp
@@ -13,11 +13,11 @@ Font::Font(
node_callback_t Sprite::expect_sprites(length_callback_t length_callback, callback_t<std::unique_ptr<Sprite>&&> callback) {
return expect_dictionary_keys_and_length(
length_callback,
- "spriteType", ZERO_OR_MORE, _expect_instance<Sprite, TextureSprite>(callback),
+ "spriteType", ZERO_OR_MORE, _expect_instance<Sprite, IconTextureSprite>(callback),
"progressbartype", ZERO_OR_MORE, _expect_instance<Sprite, ProgressBar>(callback),
"PieChartType", ZERO_OR_MORE, _expect_instance<Sprite, PieChart>(callback),
"LineChartType", ZERO_OR_MORE, _expect_instance<Sprite, LineChart>(callback),
- "textSpriteType", ZERO_OR_MORE, _expect_instance<Sprite, TextureSprite>(callback),
+ "textSpriteType", ZERO_OR_MORE, _expect_instance<Sprite, IconTextureSprite>(callback),
"maskedShieldType", ZERO_OR_MORE, _expect_instance<Sprite, MaskedFlag>(callback),
"tileSpriteType", ZERO_OR_MORE, _expect_instance<Sprite, TileTextureSprite>(callback),
"corneredTileSpriteType", ZERO_OR_MORE, _expect_instance<Sprite, CorneredTileTextureSprite>(callback),
@@ -28,49 +28,51 @@ node_callback_t Sprite::expect_sprites(length_callback_t length_callback, callba
);
}
-TextureSprite::TextureSprite() : texture_file {}, no_of_frames { NO_FRAMES } {}
+TextureSprite::TextureSprite() : texture_file {} {}
bool TextureSprite::_fill_key_map(case_insensitive_key_map_t& key_map) {
bool ret = Sprite::_fill_key_map(key_map);
ret &= add_key_map_entries(key_map,
"texturefile", ZERO_OR_ONE, expect_string(assign_variable_callback_string(texture_file)),
- "noOfFrames", ZERO_OR_ONE, expect_uint(assign_variable_callback(no_of_frames)),
"norefcount", ZERO_OR_ONE, success_callback,
- "effectFile", ZERO_OR_ONE, success_callback,
"allwaystransparent", ZERO_OR_ONE, success_callback,
+ "loadType", ZERO_OR_ONE, success_callback
+ );
+ return ret;
+}
+
+IconTextureSprite::IconTextureSprite() : no_of_frames { NO_FRAMES } {}
+
+bool IconTextureSprite::_fill_key_map(case_insensitive_key_map_t& key_map) {
+ bool ret = TextureSprite::_fill_key_map(key_map);
+ ret &= add_key_map_entries(key_map,
+ "noOfFrames", ZERO_OR_ONE, expect_uint(assign_variable_callback(no_of_frames)),
+
+ "effectFile", ZERO_OR_ONE, success_callback,
"transparencecheck", ZERO_OR_ONE, success_callback,
- "loadType", ZERO_OR_ONE, success_callback,
"clicksound", ZERO_OR_ONE, success_callback
);
return ret;
}
-TileTextureSprite::TileTextureSprite() : texture_file {}, size {} {}
+TileTextureSprite::TileTextureSprite() : size {} {}
bool TileTextureSprite::_fill_key_map(case_insensitive_key_map_t& key_map) {
- bool ret = Sprite::_fill_key_map(key_map);
+ bool ret = TextureSprite::_fill_key_map(key_map);
ret &= add_key_map_entries(key_map,
- "texturefile", ONE_EXACTLY, expect_string(assign_variable_callback_string(texture_file)),
- "size", ONE_EXACTLY, expect_ivec2(assign_variable_callback(size)),
-
- "norefcount", ZERO_OR_ONE, success_callback,
- "loadType", ZERO_OR_ONE, success_callback
+ "size", ONE_EXACTLY, expect_ivec2(assign_variable_callback(size))
);
return ret;
}
-CorneredTileTextureSprite::CorneredTileTextureSprite() : texture_file {}, size {}, border_size {} {}
+CorneredTileTextureSprite::CorneredTileTextureSprite() : size {}, border_size {} {}
bool CorneredTileTextureSprite::_fill_key_map(case_insensitive_key_map_t& key_map) {
- bool ret = Sprite::_fill_key_map(key_map);
+ bool ret = TextureSprite::_fill_key_map(key_map);
ret &= add_key_map_entries(key_map,
- "texturefile", ZERO_OR_ONE, expect_string(assign_variable_callback_string(texture_file)),
"size", ONE_EXACTLY, expect_ivec2(assign_variable_callback(size)),
- "borderSize", ONE_EXACTLY, expect_ivec2(assign_variable_callback(border_size)),
-
- "allwaystransparent", ZERO_OR_ONE, success_callback,
- "loadType", ZERO_OR_ONE, success_callback
+ "borderSize", ONE_EXACTLY, expect_ivec2(assign_variable_callback(border_size))
);
return ret;
}