diff --git a/tools/animator.cpp b/tools/animator.cpp index 3521910..bfd0e07 100644 --- a/tools/animator.cpp +++ b/tools/animator.cpp @@ -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]");