add WeatherPreset

This commit is contained in:
MihailRis
2025-02-26 02:24:16 +03:00
parent 787011d164
commit 35cf07b0f0
3 changed files with 99 additions and 46 deletions
+26
View File
@@ -0,0 +1,26 @@
#include "WeatherPreset.hpp"
#include "data/dv_util.hpp"
dv::value WeatherPreset::serialize() const {
auto root = dv::object();
auto froot = dv::object();
froot["texture"] = fall.texture;
froot["vspeed"] = fall.vspeed;
froot["hspeed"] = fall.hspeed;
froot["scale"] = fall.scale;
root["fall"] = froot;
return root;
}
void WeatherPreset::deserialize(const dv::value& src) {
if (src.has("fall")) {
const auto& froot = src["fall"];
froot.at("texture").get(fall.texture);
froot.at("vspeed").get(fall.vspeed);
froot.at("hspeed").get(fall.hspeed);
froot.at("scale").get(fall.scale);
}
}