diff options
author | P. J. McDermott <pj@pehjota.net> | 2021-03-19 06:55:48 (EDT) |
---|---|---|
committer | P. J. McDermott <pj@pehjota.net> | 2021-03-19 06:58:52 (EDT) |
commit | 7dbdadbebcd8aa7708d416c839d11cba512d5014 (patch) | |
tree | 993cc6f3bb055013ca7a5f2f061d5d8bc076270c /src | |
parent | 60b29b8bfba5feb5b8075d604fa98c97941c85e6 (diff) | |
download | dodge-balls-7dbdadbebcd8aa7708d416c839d11cba512d5014.zip dodge-balls-7dbdadbebcd8aa7708d416c839d11cba512d5014.tar.gz dodge-balls-7dbdadbebcd8aa7708d416c839d11cba512d5014.tar.bz2 |
main-menu: Handle mouse motion events
Diffstat (limited to 'src')
-rw-r--r-- | src/main-menu.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/main-menu.c b/src/main-menu.c index 2a0ace8..75d2ce0 100644 --- a/src/main-menu.c +++ b/src/main-menu.c @@ -20,6 +20,7 @@ #include <SDL.h> #include <SDL_ttf.h> #include <stdlib.h> +#include "collision.h" #include "game.h" #include "main-menu.h" #include "main.h" @@ -330,6 +331,20 @@ db_main_menu(void) break; } break; + case SDL_MOUSEMOTION: + if (event.motion.state != 0) { + break; + } + for (i = 0; i < n + 2; ++i) { + if (db_pt_in_rect(event.motion.x, + event.motion.y, + &buttons[i]->rect)) + { + active = buttons[i]; + break; + } + } + break; default: break; } |