Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/game/StarParallax.cpp
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2025-05-31 16:35:10 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2025-05-31 16:35:10 +1000
commit6245f795e9c4546cf4ef86b27bc764cc9a896195 (patch)
tree4284227942b59c13f547c07666e2816dc72dfca6 /source/game/StarParallax.cpp
parent8e381cb362f8d40dffc3dca610bb70c9b3e7b94d (diff)
simple support for animated parallax textures
Diffstat (limited to 'source/game/StarParallax.cpp')
-rw-r--r--source/game/StarParallax.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/source/game/StarParallax.cpp b/source/game/StarParallax.cpp
index d537b2c..c6bc044 100644
--- a/source/game/StarParallax.cpp
+++ b/source/game/StarParallax.cpp
@@ -18,12 +18,18 @@ ParallaxLayer::ParallaxLayer() {
lightMapped = false;
fadePercent = 0;
directives = "";
+ frameNumber = 1;
+ frameOffset = 0;
+ animationCycle = 1.0f;
alpha = 1.0f;
}
ParallaxLayer::ParallaxLayer(Json const& store) : ParallaxLayer() {
textures = jsonToStringList(store.get("textures"));
directives = store.getString("directives");
+ frameNumber = store.getInt("frameNumber", 1);
+ frameOffset = store.getInt("frameOffset", 0);
+ animationCycle = store.getFloat("animationCycle", 1.0f);
parallaxValue = jsonToVec2F(store.get("parallaxValue"));
repeat = jsonToVec2B(store.get("repeat"));
tileLimitTop = store.optFloat("tileLimitTop");
@@ -42,6 +48,9 @@ Json ParallaxLayer::store() const {
return JsonObject{
{"textures", jsonFromStringList(textures)},
{"directives", directives.string()},
+ {"frameNumber", frameNumber},
+ {"frameOffset", frameOffset},
+ {"animationCycle", animationCycle},
{"parallaxValue", jsonFromVec2F(parallaxValue)},
{"repeat", jsonFromVec2B(repeat)},
{"tileLimitTop", jsonFromMaybe(tileLimitTop)},