Space now stops/starts the animation.
This commit is contained in:
parent
961a470844
commit
fc01579232
1 changed files with 7 additions and 4 deletions
|
|
@ -26,7 +26,7 @@ namespace animator {
|
||||||
$window = sf::RenderWindow(sf::VideoMode(new_size), "Animation Crafting Tool");
|
$window = sf::RenderWindow(sf::VideoMode(new_size), "Animation Crafting Tool");
|
||||||
$window.setPosition({0,0});
|
$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();
|
$sprite = $ui.get_sprite();
|
||||||
|
|
||||||
// need to keep these aroung
|
// need to keep these aroung
|
||||||
|
|
@ -119,15 +119,19 @@ namespace animator {
|
||||||
void FSM::handle_keyboard_mouse() {
|
void FSM::handle_keyboard_mouse() {
|
||||||
while(const auto ev = $window.pollEvent()) {
|
while(const auto ev = $window.pollEvent()) {
|
||||||
using enum game::Event;
|
using enum game::Event;
|
||||||
|
using KEY = sf::Keyboard::Scan;
|
||||||
auto gui_ev = $router.process_event(ev);
|
auto gui_ev = $router.process_event(ev);
|
||||||
auto mouse_pos = $window.mapPixelToCoords($router.position);
|
auto mouse_pos = $window.mapPixelToCoords($router.position);
|
||||||
|
|
||||||
switch(gui_ev) {
|
switch(gui_ev) {
|
||||||
case MOUSE_CLICK:
|
case KEY_PRESS:
|
||||||
if(!$ui.mouse(mouse_pos.x, mouse_pos.y, guecs::NO_MODS)) {
|
if($router.scancode == KEY::Space) {
|
||||||
event(Event::PLAY_STOP);
|
event(Event::PLAY_STOP);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case MOUSE_CLICK:
|
||||||
|
$ui.mouse(mouse_pos.x, mouse_pos.y, guecs::NO_MODS);
|
||||||
|
break;
|
||||||
case MOUSE_MOVE:
|
case MOUSE_MOVE:
|
||||||
$ui.mouse(mouse_pos.x, mouse_pos.y, {1 << guecs::ModBit::hover});
|
$ui.mouse(mouse_pos.x, mouse_pos.y, {1 << guecs::ModBit::hover});
|
||||||
break;
|
break;
|
||||||
|
|
@ -150,7 +154,6 @@ namespace animator {
|
||||||
}
|
}
|
||||||
|
|
||||||
void UI::init(const std::string& sprite_name, int width, int height) {
|
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.position(0,0, width, height);
|
||||||
$ui.layout("[=viewer]");
|
$ui.layout("[=viewer]");
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue