diff options
Diffstat (limited to 'src/game/interface.cpp')
-rw-r--r-- | src/game/interface.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/game/interface.cpp b/src/game/interface.cpp index 0ffdbab..0c2125b 100644 --- a/src/game/interface.cpp +++ b/src/game/interface.cpp @@ -62,6 +62,8 @@ void state_t::tick(double dt) window->setView(sf::View(view_center, view_size)); + wmouse = window->mapPixelToCoords(sf::Mouse::getPosition(*window)); + while (window->pollEvent(event)) { // FIXME: refactor this nested switch clusterfuck switch (event.type) { @@ -70,8 +72,6 @@ void state_t::tick(double dt) return; case sf::Event::MouseButtonPressed: - wmouse = window->mapPixelToCoords(sf::Vector2i(event.mouseButton.x, event.mouseButton.y)); - switch (event.mouseButton.button) { case sf::Mouse::Button::Left: select.selecting = true; @@ -140,6 +140,10 @@ void state_t::tick(double dt) } break; + case sf::Keyboard::Key::H: + game->spawn_soldier(wmouse); + break; + case sf::Keyboard::Key::F1: debug_draw_cmodels ^= 1; print("debug_draw_cmodels = " + std::to_string(debug_draw_cmodels)); @@ -165,9 +169,6 @@ void state_t::tick(double dt) } } - // Compute this _after_ the setView above. - wmouse = window->mapPixelToCoords(sf::Mouse::getPosition(*window)); - if (select.selecting) select.rect[1] = wmouse; } |