#pragma once #include #include "gui/event_router.hpp" #include "gui/guecstra.hpp" #include "events.hpp" namespace animator { enum class State { START=__LINE__, ANIMATE=__LINE__, END=__LINE__, }; enum class Event { TICK=__LINE__, PLAY=__LINE__, STOP=__LINE__, LOOP=__LINE__, TOGGLE=__LINE__, }; struct FSM; struct UI { guecs::UI $ui; void button(const std::string& name, std::function cb); void init(const std::string& sprite_name, FSM& fsm); void render(sf::RenderWindow& window); bool mouse(float x, float y, guecs::Modifiers mods); std::shared_ptr get_sprite(); }; struct FSM : public DeadSimpleFSM { UI $ui; gui::routing::Router $router; sf::RenderWindow $window{sf::VideoMode({SCREEN_WIDTH, SCREEN_HEIGHT}), "Animation Crafting Tool"}; 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(); }; }