aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui_menu.cpp
diff options
context:
space:
mode:
authorClyne Sullivan <tullivan99@gmail.com>2017-09-07 13:38:56 -0400
committerClyne Sullivan <tullivan99@gmail.com>2017-09-07 13:38:56 -0400
commitc3e164c6845b9b32f132aa37cc9707acba0d9eff (patch)
tree549b66f19066863628d74860145a07f6b04ad8ba /src/ui_menu.cpp
parent643e94897ba5fab0570d118a7aafc7772949d4e3 (diff)
event consumption work
Diffstat (limited to 'src/ui_menu.cpp')
-rw-r--r--src/ui_menu.cpp18
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;