Animator tool now has no UI, it just watches the file to change time and reloads.

This commit is contained in:
Zed A. Shaw 2026-02-03 13:03:38 -05:00
parent bdfc2397e2
commit c092b82dfc
3 changed files with 84 additions and 77 deletions

View file

@ -3,6 +3,7 @@
#include "gui/event_router.hpp"
#include "gui/guecstra.hpp"
#include "events.hpp"
#include <filesystem>
namespace animator {
@ -14,10 +15,8 @@ namespace animator {
enum class Event {
TICK=__LINE__,
PLAY=__LINE__,
STOP=__LINE__,
LOOP=__LINE__,
TOGGLE=__LINE__,
PLAY_STOP=__LINE__,
RELOAD=__LINE__,
};
struct FSM;
@ -26,7 +25,7 @@ namespace animator {
guecs::UI $ui;
void button(const std::string& name, std::function<void(guecs::Modifiers mods)> cb);
void init(const std::string& sprite_name, FSM& fsm);
void init(const std::string& sprite_name);
void render(sf::RenderWindow& window);
bool mouse(float x, float y, guecs::Modifiers mods);
std::shared_ptr<sf::Sprite> get_sprite();
@ -36,15 +35,27 @@ namespace animator {
UI $ui;
gui::routing::Router $router;
sf::RenderWindow $window{sf::VideoMode({SCREEN_WIDTH, SCREEN_HEIGHT}), "Animation Crafting Tool"};
sf::Vector2f $pos{0,0};
sf::Vector2f $scale{0,0};
std::shared_ptr<sf::Sprite> $sprite = nullptr;
animate2::Animate2 $anim;
std::string $sprite_name="";
std::filesystem::file_time_type $last_mod_time;
sf::Clock $timer;
void init(const std::string &sprite_name);
void event(Event ev, std::any data={});
void START(Event ev);
void ANIMATE(Event ev);
void END(Event ev);
void handle_keyboard_mouse();
void render();
bool active();
void run_animation();
void tick();
void reload();
void check_update();
};
}