Space now stops/starts the animation.

This commit is contained in:
Zed A. Shaw 2026-02-03 23:30:12 -05:00
parent 961a470844
commit fc01579232

View file

@ -26,7 +26,7 @@ namespace animator {
$window = sf::RenderWindow(sf::VideoMode(new_size), "Animation Crafting Tool");
$window.setPosition({0,0});
$ui.init($sprite_name, win_size.x, win_size.y);
$ui.init($sprite_name, new_size.x, new_size.y);
$sprite = $ui.get_sprite();
// need to keep these aroung
@ -119,15 +119,19 @@ namespace animator {
void FSM::handle_keyboard_mouse() {
while(const auto ev = $window.pollEvent()) {
using enum game::Event;
using KEY = sf::Keyboard::Scan;
auto gui_ev = $router.process_event(ev);
auto mouse_pos = $window.mapPixelToCoords($router.position);
switch(gui_ev) {
case MOUSE_CLICK:
if(!$ui.mouse(mouse_pos.x, mouse_pos.y, guecs::NO_MODS)) {
case KEY_PRESS:
if($router.scancode == KEY::Space) {
event(Event::PLAY_STOP);
}
break;
case MOUSE_CLICK:
$ui.mouse(mouse_pos.x, mouse_pos.y, guecs::NO_MODS);
break;
case MOUSE_MOVE:
$ui.mouse(mouse_pos.x, mouse_pos.y, {1 << guecs::ModBit::hover});
break;
@ -150,7 +154,6 @@ namespace animator {
}
void UI::init(const std::string& sprite_name, int width, int height) {
fmt::println("IN UI SIZE IS {},{}", width, height);
$ui.position(0,0, width, height);
$ui.layout("[=viewer]");