Now have a fancy hand animation when you cast your rituals.
This commit is contained in:
parent
ad3e580495
commit
7af264e147
9 changed files with 43 additions and 8 deletions
|
|
@ -243,6 +243,7 @@ namespace gui {
|
|||
run_systems();
|
||||
break;
|
||||
case ATTACK:
|
||||
$main_ui.play_hands();
|
||||
$main_ui.dirty();
|
||||
sound::play("Sword_Hit_1");
|
||||
state(State::ATTACKING);
|
||||
|
|
|
|||
|
|
@ -11,7 +11,9 @@ namespace gui {
|
|||
|
||||
MainUI::MainUI(sf::RenderWindow& window) :
|
||||
$window(window),
|
||||
$rayview(std::make_shared<Raycaster>(RAY_VIEW_WIDTH, RAY_VIEW_HEIGHT))
|
||||
$rayview(std::make_shared<Raycaster>(RAY_VIEW_WIDTH, RAY_VIEW_HEIGHT)),
|
||||
$hand(textures::get_sprite("hand")),
|
||||
$hand_anim(animation::load("hand"))
|
||||
{
|
||||
$window.setVerticalSyncEnabled(VSYNC);
|
||||
$window.setFramerateLimit(FRAME_LIMIT);
|
||||
|
|
@ -39,6 +41,8 @@ namespace gui {
|
|||
|
||||
if($mind_reading) render_mind_reading();
|
||||
$overlay_ui.render($window);
|
||||
|
||||
if($hand_anim.playing) render_hands();
|
||||
}
|
||||
|
||||
lel::Cell MainUI::overlay_cell(const std::string& name) {
|
||||
|
|
@ -133,4 +137,15 @@ namespace gui {
|
|||
void MainUI::mouse(int x, int y, guecs::Modifiers mods) {
|
||||
$overlay_ui.$gui.mouse(x, y, mods);
|
||||
}
|
||||
|
||||
void MainUI::play_hands() {
|
||||
$hand_anim.play();
|
||||
}
|
||||
|
||||
void MainUI::render_hands() {
|
||||
if(animation::apply($hand_anim, *$hand.sprite)) {
|
||||
$hand.sprite->setPosition({RAY_VIEW_X, RAY_VIEW_Y});
|
||||
$window.draw(*$hand.sprite);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
#include "gui/overlay_ui.hpp"
|
||||
#include "gui/debug_ui.hpp"
|
||||
#include "raycaster.hpp"
|
||||
#include "animation.hpp"
|
||||
#include <optional>
|
||||
|
||||
namespace gui {
|
||||
|
|
@ -19,6 +20,8 @@ namespace gui {
|
|||
sf::RenderWindow& $window;
|
||||
OverlayUI $overlay_ui;
|
||||
std::shared_ptr<Raycaster> $rayview;
|
||||
textures::SpriteTexture $hand;
|
||||
components::Animation $hand_anim;
|
||||
|
||||
MainUI(sf::RenderWindow& window);
|
||||
|
||||
|
|
@ -41,5 +44,7 @@ namespace gui {
|
|||
void dead_entity(DinkyECS::Entity entity);
|
||||
void toggle_mind_reading();
|
||||
void render_mind_reading();
|
||||
void play_hands();
|
||||
void render_hands();
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue