diff options
author | Clyne Sullivan <tullivan99@gmail.com> | 2017-09-07 13:38:56 -0400 |
---|---|---|
committer | Clyne Sullivan <tullivan99@gmail.com> | 2017-09-07 13:38:56 -0400 |
commit | c3e164c6845b9b32f132aa37cc9707acba0d9eff (patch) | |
tree | 549b66f19066863628d74860145a07f6b04ad8ba /src/ui_menu.cpp | |
parent | 643e94897ba5fab0570d118a7aafc7772949d4e3 (diff) |
event consumption work
Diffstat (limited to 'src/ui_menu.cpp')
-rw-r--r-- | src/ui_menu.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/ui_menu.cpp b/src/ui_menu.cpp index a48182b..fd316ce 100644 --- a/src/ui_menu.cpp +++ b/src/ui_menu.cpp @@ -13,19 +13,19 @@ static Menu* currentMenu = nullptr; bool SDLReceiver::receive(const MainSDLEvent& mse) { + if (currentMenu == nullptr) + return true; + switch (mse.event.type) { case SDL_QUIT: game::endGame(); - return true; - break; - case SDL_MOUSEMOTION: - //ui::premouse.x = e.motion.x; - //ui::premouse.y = e.motion.y; break; case SDL_MOUSEBUTTONUP: if (mse.event.button.button & SDL_BUTTON_LEFT) clicked = true; - break; + break; + case SDL_MOUSEBUTTONDOWN: + break; // consume events case SDL_KEYUP: if (currentMenu != nullptr && mse.event.key.keysym.sym == SDLK_ESCAPE) { currentMenu->gotoParent(); @@ -33,10 +33,14 @@ bool SDLReceiver::receive(const MainSDLEvent& mse) clicked = false; } break; + case SDL_KEYDOWN: + break; // consume events default: + return true; break; } - return true; + + return false; } bool SDLReceiver::clicked = false; |