Hand animation is now converted.
This commit is contained in:
parent
e3065f7add
commit
1a9c395ae6
3 changed files with 42 additions and 6 deletions
|
|
@ -129,5 +129,36 @@
|
||||||
"sounds": {
|
"sounds": {
|
||||||
"idle": []
|
"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": []
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
#include "components.hpp"
|
#include "components.hpp"
|
||||||
#include "easings.hpp"
|
#include "easings.hpp"
|
||||||
#include <fmt/xchar.h>
|
#include <fmt/xchar.h>
|
||||||
#include "animation.hpp"
|
#include "animate2.hpp"
|
||||||
#include "constants.hpp"
|
#include "constants.hpp"
|
||||||
#include "game_level.hpp"
|
#include "game_level.hpp"
|
||||||
#include "ai.hpp"
|
#include "ai.hpp"
|
||||||
|
|
@ -20,7 +20,7 @@ namespace gui {
|
||||||
auto config = settings::get("config");
|
auto config = settings::get("config");
|
||||||
|
|
||||||
$hand = textures::get_sprite(config["player"]["hands"]);
|
$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() {
|
void MainUI::dirty() {
|
||||||
|
|
@ -142,11 +142,13 @@ namespace gui {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainUI::play_hands() {
|
void MainUI::play_hands() {
|
||||||
$hand_anim.play();
|
if(!$hand_anim.playing) $hand_anim.play();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainUI::render_hands() {
|
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});
|
$hand.sprite->setPosition({RAY_VIEW_X, RAY_VIEW_Y});
|
||||||
$window.draw(*$hand.sprite);
|
$window.draw(*$hand.sprite);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,11 @@
|
||||||
#include "raycaster.hpp"
|
#include "raycaster.hpp"
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
|
||||||
namespace gui {
|
namespace animate2 {
|
||||||
|
class Animate2;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace gui {
|
||||||
class MainUI {
|
class MainUI {
|
||||||
public:
|
public:
|
||||||
int $compass_dir = 0;
|
int $compass_dir = 0;
|
||||||
|
|
@ -20,7 +23,7 @@ namespace gui {
|
||||||
OverlayUI $overlay_ui;
|
OverlayUI $overlay_ui;
|
||||||
std::shared_ptr<Raycaster> $rayview;
|
std::shared_ptr<Raycaster> $rayview;
|
||||||
textures::SpriteTexture $hand;
|
textures::SpriteTexture $hand;
|
||||||
components::Animation $hand_anim;
|
animate2::Animate2 $hand_anim;
|
||||||
|
|
||||||
MainUI(sf::RenderWindow& window);
|
MainUI(sf::RenderWindow& window);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue