Hand animation is now converted.

This commit is contained in:
Zed A. Shaw 2026-02-23 11:27:54 -05:00
parent e3065f7add
commit 1a9c395ae6
3 changed files with 42 additions and 6 deletions

View file

@ -2,7 +2,7 @@
#include "components.hpp"
#include "easings.hpp"
#include <fmt/xchar.h>
#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);
}