diff --git a/startmenu.c b/startmenu.c index 4fdc72a..c39bb64 100644 --- a/startmenu.c +++ b/startmenu.c @@ -5,6 +5,7 @@ #include "gamestate.h" #include "main.h" +extern float XScale, YScale; SDL_Texture * TITLE_Texture; SDL_Texture * PLAYBUTTON_Texture; @@ -23,7 +24,11 @@ SDL_Rect HIGHSCORESBUTTON_Rect; SDL_Rect QUITBUTTON_Rect; int clickInRect(SDL_MouseButtonEvent b, SDL_Rect * area_rect) { - return (((b.x) >= (area_rect->x)) && ((b.x) <= ((area_rect->x) + (area_rect->w))) && ((b.y) >= (area_rect->y)) && ((b.y) <= ((area_rect->y) + (area_rect->h)))); + int clickx, clicky; + + clickx = (int)roundf((float)b.x / XScale); + clicky = (int)roundf((float)b.y / YScale); + return ((clickx >= (area_rect->x)) && (clickx <= ((area_rect->x) + (area_rect->w))) && (clicky >= (area_rect->y)) && (clicky <= ((area_rect->y) + (area_rect->h)))); } void Load_Textures(SDL_Renderer * renderer) {