Implemented an initial cut at the event router. Its job is to take the random events from SFML and translate them into nice clean orderly events to the Gui::FSM.
This commit is contained in:
parent
5c47a0151c
commit
0674908e49
8 changed files with 184 additions and 6 deletions
|
@ -280,7 +280,7 @@ namespace gui {
|
|||
dbc::log(fmt::format("END: received event after done: {}", int(ev)));
|
||||
}
|
||||
|
||||
void FSM::keyboard_mouse() {
|
||||
void FSM::handle_keyboard_mouse() {
|
||||
while(const auto ev = $window.pollEvent()) {
|
||||
|
||||
if(ev->is<sf::Event::Closed>()) {
|
||||
|
@ -290,6 +290,7 @@ namespace gui {
|
|||
if(const auto* mouse = ev->getIf<sf::Event::MouseButtonPressed>()) {
|
||||
if(mouse->button == sf::Mouse::Button::Left) {
|
||||
sf::Vector2f pos = $window.mapPixelToCoords(mouse->position);
|
||||
|
||||
if(in_state(State::NEXT_LEVEL)) {
|
||||
$boss_fight_ui->mouse(pos.x, pos.y, false);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue