From 1a9c395ae64be062c55e8fb47a79cf98ac688543 Mon Sep 17 00:00:00 2001 From: "Zed A. Shaw" Date: Mon, 23 Feb 2026 11:27:54 -0500 Subject: [PATCH] Hand animation is now converted. --- assets/animate2.json | 31 +++++++++++++++++++++++++++++++ gui/main_ui.cpp | 10 ++++++---- gui/main_ui.hpp | 7 +++++-- 3 files changed, 42 insertions(+), 6 deletions(-) diff --git a/assets/animate2.json b/assets/animate2.json index a48d27f..c2e7fae 100644 --- a/assets/animate2.json +++ b/assets/animate2.json @@ -129,5 +129,36 @@ "sounds": { "idle": [] } + }, + "female_hand": { + "sheet": { + "frames": 3, + "frame_width": 900, + "frame_height": 600 + }, + "sequences": { + "idle": {"frames": [0, 1, 2], "durations": [10, 10, 20] } + }, + "transforms": { + "basic": { + "min_x": 1.0, + "min_y": 1.0, + "max_x": 1.0, + "max_y": 1.0, + "flipped": false, + "scaled": false, + "toggled": true, + "looped": false, + "relative": false, + "easing": "none", + "motion": "move_none" + } + }, + "forms": { + "idle": ["idle", "basic"] + }, + "sounds": { + "idle": [] + } } } diff --git a/gui/main_ui.cpp b/gui/main_ui.cpp index 5537204..0bbe2b2 100644 --- a/gui/main_ui.cpp +++ b/gui/main_ui.cpp @@ -2,7 +2,7 @@ #include "components.hpp" #include "easings.hpp" #include -#include "animation.hpp" +#include "animate2.hpp" #include "constants.hpp" #include "game_level.hpp" #include "ai.hpp" @@ -20,7 +20,7 @@ namespace gui { auto config = settings::get("config"); $hand = textures::get_sprite(config["player"]["hands"]); - $hand_anim = animation::load(config["player"]["hands"]); + $hand_anim = animate2::load("assets/animate2.json", config["player"]["hands"]); } void MainUI::dirty() { @@ -142,11 +142,13 @@ namespace gui { } void MainUI::play_hands() { - $hand_anim.play(); + if(!$hand_anim.playing) $hand_anim.play(); } void MainUI::render_hands() { - if($hand_anim.apply(*$hand.sprite, {0,0})) { + if($hand_anim.playing) { + $hand_anim.update(); + $hand_anim.apply(*$hand.sprite); $hand.sprite->setPosition({RAY_VIEW_X, RAY_VIEW_Y}); $window.draw(*$hand.sprite); } diff --git a/gui/main_ui.hpp b/gui/main_ui.hpp index aed1efa..0b32ffb 100644 --- a/gui/main_ui.hpp +++ b/gui/main_ui.hpp @@ -8,8 +8,11 @@ #include "raycaster.hpp" #include -namespace gui { +namespace animate2 { + class Animate2; +} +namespace gui { class MainUI { public: int $compass_dir = 0; @@ -20,7 +23,7 @@ namespace gui { OverlayUI $overlay_ui; std::shared_ptr $rayview; textures::SpriteTexture $hand; - components::Animation $hand_anim; + animate2::Animate2 $hand_anim; MainUI(sf::RenderWindow& window);