diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2023-04-10 09:03:46 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-04-10 10:35:00 +0200 |
commit | 8c2dca2cfaf57f22fe2fe84d939d0071c06ddd6c (patch) | |
tree | 5b94a0580c6bedc38ff7da1d70c793ace211cc04 | |
parent | 42214976648e768d0a525dd6e5f84a1f300c25ae (diff) |
ffff
-rw-r--r-- | main/draw.cpp | 3 | ||||
-rw-r--r-- | serialize/anim.cpp | 14 | ||||
-rw-r--r-- | src/anim.hpp | 2 |
3 files changed, 12 insertions, 7 deletions
diff --git a/main/draw.cpp b/main/draw.cpp index 56f4b61e..6894973e 100644 --- a/main/draw.cpp +++ b/main/draw.cpp @@ -198,8 +198,9 @@ void main_impl::do_update() const float alpha = 1/(1 + RC); _frame_time = _frame_time*(1-alpha) + alpha*dt; } + static size_t ctr = 0; if (dt >= 1.f/55 && dt_expected.value < 1e-1f) - fm_debug("frame took %.1f milliseconds", dt*1e3f); + fm_debug("%zu frame took %.1f milliseconds", ctr++, dt*1e3f); } else { diff --git a/serialize/anim.cpp b/serialize/anim.cpp index e8494dc2..99cc8dc5 100644 --- a/serialize/anim.cpp +++ b/serialize/anim.cpp @@ -85,8 +85,10 @@ static void to_json(nlohmann::json& j, const anim_def& val) j["pixel_size"] = val.pixel_size; if (val.nframes != def.nframes) j["nframes"] = val.nframes; - if (val.actionframe != def.actionframe) - j["actionframe"] = val.actionframe; + if (val.action_frame != def.action_frame) + j["action-frame"] = val.action_frame; + if (val.action_frame2 != def.action_frame2) + j["action-frame-2"] = val.action_frame2; if (val.fps != def.fps) j["fps"] = val.fps; j["groups"] = val.groups; @@ -98,14 +100,16 @@ static void from_json(const nlohmann::json& j, anim_def& val) val = {}; val.object_name = j["object_name"]; fm_soft_assert(!val.object_name.isEmpty()); - if (j.contains("anim_name")) + if (j.contains("anim_name")) // todo underscore to hyphen val.anim_name = j["anim_name"]; if (j.contains("pixel_size")) val.pixel_size = j["pixel_size"]; if (j.contains("nframes")) val.nframes = j["nframes"]; - if (j.contains("actionframe")) - val.actionframe = j["actionframe"]; + if (j.contains("action-frame")) + val.action_frame = j["action-frame"]; + if (j.contains("action-frame-2")) + val.action_frame2 = j["action-frame-2"]; if (j.contains("fps")) val.fps = j["fps"]; val.groups = j["groups"]; diff --git a/src/anim.hpp b/src/anim.hpp index c1bb7326..d1f413ae 100644 --- a/src/anim.hpp +++ b/src/anim.hpp @@ -57,7 +57,7 @@ struct anim_def final std::vector<anim_group> groups; Vector2ui pixel_size; anim_scale scale = anim_scale::ratio{1}; - size_t nframes = 0, fps = 0, actionframe = 0; + size_t nframes = 0, fps = 0, action_frame = 0, action_frame2 = 0; }; } // namespace floormat |