aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndy <drumsetmonkey@gmail.com>2016-11-28 08:43:31 -0500
committerAndy <drumsetmonkey@gmail.com>2016-11-28 08:43:31 -0500
commit320f5d3506a8e0062606b9a178dd40d5a89b37c5 (patch)
tree9f8f765099093928718a12f914ba247bfca79d8b /src
parentb1d3354d93187a6bededc280ddb6dee5b159bbe7 (diff)
Animate and menu
Diffstat (limited to 'src')
-rw-r--r--src/ui_menu.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/ui_menu.cpp b/src/ui_menu.cpp
index e7845c2..f6f962d 100644
--- a/src/ui_menu.cpp
+++ b/src/ui_menu.cpp
@@ -198,12 +198,14 @@ namespace ui {
SDL_Event e;
+ bool clicked = false;
+
Render::useShader(&Render::textShader);
setFontSize(24);
game::config::update();
setFontZ(-9.0);
-
+
mouse.x = ui::premouse.x+offset.x-(SCREEN_WIDTH/2);
mouse.y = (offset.y+SCREEN_HEIGHT/2)-ui::premouse.y;
@@ -218,6 +220,11 @@ namespace ui {
premouse.x=e.motion.x;
premouse.y=e.motion.y;
break;
+ case SDL_MOUSEBUTTONUP:
+ if (e.button.button & SDL_BUTTON_LEFT) {
+ clicked = true;
+ }
+ break;
case SDL_KEYUP:
if (SDL_KEY == SDLK_ESCAPE) {
currentMenu->gotoParent();
@@ -257,7 +264,7 @@ namespace ui {
cMult = 0.6f;
//if the mouse is over the button and clicks
- if (SDL_GetMouseState(NULL, NULL) & SDL_BUTTON(SDL_BUTTON_LEFT)) {
+ if (clicked) {
switch(m.member) {
case 0: //normal button
m.button.func();