Finally unified all of my events into one place.
This commit is contained in:
parent
6c34fea64a
commit
c618a4828f
30 changed files with 215 additions and 216 deletions
|
|
@ -9,7 +9,6 @@
|
|||
#include "backend.hpp"
|
||||
#include "game_level.hpp"
|
||||
#include "boss/system.hpp"
|
||||
#include "gui/fsm_events.hpp"
|
||||
#include "events.hpp"
|
||||
#include "constants.hpp"
|
||||
#include "gui/event_router.hpp"
|
||||
|
|
@ -55,16 +54,16 @@ int main(int, char*[]) {
|
|||
while(const auto ev = window.pollEvent()) {
|
||||
auto gui_ev = router.process_event(ev);
|
||||
|
||||
if(gui_ev == gui::Event::QUIT || main->event(gui_ev, {})) {
|
||||
if(gui_ev == game::Event::QUIT || main->event(gui_ev, {})) {
|
||||
return 0;
|
||||
} else {
|
||||
main->event(gui::Event::TICK, {});
|
||||
main->event(game::Event::TICK, {});
|
||||
}
|
||||
}
|
||||
|
||||
if(main->$world->has_event<Events::GUI>()) {
|
||||
if(main->$world->has_event<game::Event>()) {
|
||||
main->handle_world_events();
|
||||
dbc::check(!main->$world->has_event<Events::GUI>(), "You didn't eat all the events.");
|
||||
dbc::check(!main->$world->has_event<game::Event>(), "You didn't eat all the events.");
|
||||
}
|
||||
|
||||
main->render(window);
|
||||
|
|
|
|||
|
|
@ -34,9 +34,9 @@ int main(int, char*[]) {
|
|||
auto gui_ev = router.process_event(ev);
|
||||
auto mouse_pos = window.mapPixelToCoords(router.position);
|
||||
|
||||
if(gui_ev == gui::Event::QUIT) {
|
||||
if(gui_ev == game::Event::QUIT) {
|
||||
return 0;
|
||||
} else if(gui_ev == gui::Event::MOUSE_CLICK) {
|
||||
} else if(gui_ev == game::Event::MOUSE_CLICK) {
|
||||
main.mouse(mouse_pos.x, mouse_pos.y, guecs::NO_MODS);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue