Fixed start Menu Click event at scaled window
This commit is contained in:
parent
9088047c68
commit
affda45ac5
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user