Start of resolution update.

This commit is contained in:
Steve 2018-12-12 08:32:32 +00:00
parent cc4934c0fb
commit ff40191eab
18 changed files with 98 additions and 57 deletions

View File

@ -62,6 +62,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define SCREEN_WIDTH 1280 #define SCREEN_WIDTH 1280
#define SCREEN_HEIGHT 720 #define SCREEN_HEIGHT 720
#define UI_WIDTH 1280
#define UI_HEIGHT 720
#define MAX_KEYBOARD_KEYS 350 #define MAX_KEYBOARD_KEYS 350
#define MAX_MOUSE_BUTTONS 6 #define MAX_MOUSE_BUTTONS 6

View File

@ -327,7 +327,7 @@ static void doStarSystemView(void)
for (mission = selectedStarSystem->missionHead.next ; mission != NULL ; mission = mission->next) for (mission = selectedStarSystem->missionHead.next ; mission != NULL ; mission = mission->next)
{ {
if (mission->available && collision(app.mouse.x - app.mouse.w / 2, app.mouse.y - app.mouse.h / 2, app.mouse.w, app.mouse.h, mission->rect.x, mission->rect.y, mission->rect.w, mission->rect.h)) if (mission->available && collision(app.uiMouse.x - app.mouse.w / 2, app.uiMouse.y - app.mouse.h / 2, app.mouse.w, app.mouse.h, mission->rect.x, mission->rect.y, mission->rect.w, mission->rect.h))
{ {
hoverMission = mission; hoverMission = mission;
@ -524,17 +524,17 @@ static void drawGalaxy(void)
ay = r.y; ay = r.y;
aa = -1; aa = -1;
ax = MAX(MIN(SCREEN_WIDTH - 64, ax), 64); ax = MAX(MIN(app.winWidth - 64, ax), 64);
ay = MAX(MIN(SCREEN_HEIGHT - 64, ay), 64); ay = MAX(MIN(app.winHeight - 64, ay), 64);
if (r.x < 0) if (r.x < 0)
{ {
ax = 64 + (sin(arrowPulse) * 10); ax = 64 + (sin(arrowPulse) * 10);
aa = 270; aa = 270;
} }
else if (r.x > SCREEN_WIDTH) else if (r.x > app.winWidth)
{ {
ax = SCREEN_WIDTH - 64 + (sin(arrowPulse) * 10); ax = app.winWidth - 64 + (sin(arrowPulse) * 10);
aa = 90; aa = 90;
} }
else if (r.y < 0) else if (r.y < 0)
@ -542,9 +542,9 @@ static void drawGalaxy(void)
ay = 64 + (sin(arrowPulse) * 10); ay = 64 + (sin(arrowPulse) * 10);
aa = 0; aa = 0;
} }
else if (r.y > SCREEN_HEIGHT) else if (r.y > app.winHeight)
{ {
ay = SCREEN_HEIGHT - 64 + (sin(arrowPulse) * 10); ay = app.winHeight - 64 + (sin(arrowPulse) * 10);
aa = 180; aa = 180;
} }
@ -580,8 +580,8 @@ static void drawInfoBars(void)
if (show != SHOW_STAR_SYSTEM && selectedStarSystem != NULL) if (show != SHOW_STAR_SYSTEM && selectedStarSystem != NULL)
{ {
r.x = 0; r.x = 0;
r.y = SCREEN_HEIGHT - 35; r.y = app.winHeight - 35;
r.w = SCREEN_WIDTH; r.w = app.winWidth;
r.h = 35; r.h = 35;
SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_BLEND); SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_BLEND);
@ -589,19 +589,19 @@ static void drawInfoBars(void)
SDL_RenderFillRect(app.renderer, &r); SDL_RenderFillRect(app.renderer, &r);
SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_NONE); SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_NONE);
drawText(SCREEN_WIDTH / 2, SCREEN_HEIGHT - 30, 18, TA_CENTER, colors.white, selectedStarSystem->description); drawText(app.winWidth / 2, app.winHeight - 30, 18, TA_CENTER, colors.white, selectedStarSystem->description);
} }
r.x = 0; r.x = 0;
r.y = 0; r.y = 0;
r.w = SCREEN_WIDTH; r.w = app.winWidth;
r.h = 35; r.h = 35;
SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_BLEND); SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_BLEND);
SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 200); SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 200);
SDL_RenderFillRect(app.renderer, &r); SDL_RenderFillRect(app.renderer, &r);
SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_NONE); SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_NONE);
drawText((SCREEN_WIDTH / 2), 5, 18, TA_CENTER, colors.white, MISSIONS_TEXT, game.completedMissions, game.availableMissions); drawText((app.winWidth / 2), 5, 18, TA_CENTER, colors.white, MISSIONS_TEXT, game.completedMissions, game.availableMissions);
} }
static void selectStarSystem(void) static void selectStarSystem(void)
@ -636,6 +636,8 @@ static void drawStarSystemDetail(void)
Mission *mission; Mission *mission;
SDL_Rect r; SDL_Rect r;
SDL_SetRenderTarget(app.renderer, app.uiBuffer);
r.w = 900; r.w = 900;
r.h = 600; r.h = 600;
r.x = (SCREEN_WIDTH / 2) - (r.w / 2); r.x = (SCREEN_WIDTH / 2) - (r.w / 2);
@ -722,6 +724,8 @@ static void drawStarSystemDetail(void)
startMissionButton->enabled = (!game.currentMission->completed || selectedStarSystem->type == SS_SOL || campaignComplete); startMissionButton->enabled = (!game.currentMission->completed || selectedStarSystem->type == SS_SOL || campaignComplete);
drawWidgets("starSystem"); drawWidgets("starSystem");
SDL_SetRenderTarget(app.renderer, app.backBuffer);
} }
static void fallenOK(void) static void fallenOK(void)

View File

@ -70,7 +70,7 @@ static void logic(void)
if (!c->next) if (!c->next)
{ {
c->y = MAX(c->y, (SCREEN_HEIGHT - c->h) / 2); c->y = MAX(c->y, (app.winHeight - c->h) / 2);
} }
} }
@ -88,15 +88,15 @@ static void draw(void)
drawBackground(background); drawBackground(background);
blit(earthTexture, SCREEN_WIDTH - 200, (SCREEN_HEIGHT / 2) + 100, 1); blit(earthTexture, app.winWidth - 200, (app.winHeight / 2) + 100, 1);
app.textWidth = CREDIT_LINE_LIMIT; app.textWidth = CREDIT_LINE_LIMIT;
for (c = head.next ; c != NULL ; c = c->next) for (c = head.next ; c != NULL ; c = c->next)
{ {
if (c->y > -c->h && c->y < SCREEN_HEIGHT) if (c->y > -c->h && c->y < app.winHeight)
{ {
drawText(SCREEN_WIDTH / 2, (int)c->y, c->size, TA_CENTER, colors.white, c->text); drawText(app.winWidth / 2, (int)c->y, c->size, TA_CENTER, colors.white, c->text);
} }
} }
@ -110,7 +110,7 @@ static void loadCredits(void)
char *text; char *text;
Credit *c; Credit *c;
y = SCREEN_HEIGHT + 100; y = app.winHeight + 100;
text = readFile("data/credits/credits.json"); text = readFile("data/credits/credits.json");
root = cJSON_Parse(text); root = cJSON_Parse(text);

View File

@ -100,6 +100,8 @@ void drawFighterDatabase(void)
Entity *fighter; Entity *fighter;
int i, y, numCannons; int i, y, numCannons;
SDL_SetRenderTarget(app.renderer, app.uiBuffer);
SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_BLEND); SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_BLEND);
SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 128); SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 128);
SDL_RenderFillRect(app.renderer, NULL); SDL_RenderFillRect(app.renderer, NULL);
@ -164,6 +166,8 @@ void drawFighterDatabase(void)
app.textWidth = 0; app.textWidth = 0;
drawWidgets("fighterDB"); drawWidgets("fighterDB");
SDL_SetRenderTarget(app.renderer, app.backBuffer);
} }
static int countFighterGuns(Entity *fighter, int type) static int countFighterGuns(Entity *fighter, int type)

View File

@ -91,6 +91,8 @@ static void drawMain(void)
{ {
SDL_Rect r; SDL_Rect r;
SDL_SetRenderTarget(app.renderer, app.uiBuffer);
SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_BLEND); SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_BLEND);
SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 128); SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 128);
SDL_RenderFillRect(app.renderer, NULL); SDL_RenderFillRect(app.renderer, NULL);
@ -98,15 +100,15 @@ static void drawMain(void)
r.w = 500; r.w = 500;
r.h = 600; r.h = 600;
r.x = (SCREEN_WIDTH / 2) - r.w / 2; r.x = (UI_WIDTH / 2) - r.w / 2;
r.y = (SCREEN_HEIGHT / 2) - r.h / 2; r.y = (UI_HEIGHT / 2) - r.h / 2;
SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 255); SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 255);
SDL_RenderFillRect(app.renderer, &r); SDL_RenderFillRect(app.renderer, &r);
SDL_SetRenderDrawColor(app.renderer, 200, 200, 200, 255); SDL_SetRenderDrawColor(app.renderer, 200, 200, 200, 255);
SDL_RenderDrawRect(app.renderer, &r); SDL_RenderDrawRect(app.renderer, &r);
drawText(SCREEN_WIDTH / 2, 70, 28, TA_CENTER, colors.white, OPTIONS_TEXT); drawText(UI_WIDTH / 2, 70, 28, TA_CENTER, colors.white, OPTIONS_TEXT);
SDL_SetRenderDrawColor(app.renderer, 128, 128, 128, 255); SDL_SetRenderDrawColor(app.renderer, 128, 128, 128, 255);
SDL_RenderDrawLine(app.renderer, r.x, 120, r.x + r.w, 120); SDL_RenderDrawLine(app.renderer, r.x, 120, r.x + r.w, 120);
@ -115,9 +117,11 @@ static void drawMain(void)
app.textWidth = r.w - 100; app.textWidth = r.w - 100;
drawText(SCREEN_WIDTH / 2, r.y + r.h - 135, 16, TA_CENTER, colors.yellow, RESOLUTION_TEXT); drawText(UI_WIDTH / 2, r.y + r.h - 135, 16, TA_CENTER, colors.yellow, RESOLUTION_TEXT);
app.textWidth = 0; app.textWidth = 0;
SDL_SetRenderTarget(app.renderer, app.backBuffer);
} }
void updateCustomResolutionOption(void) void updateCustomResolutionOption(void)

View File

@ -131,6 +131,8 @@ void drawStats(void)
int i, y, startIndex; int i, y, startIndex;
SDL_Rect r; SDL_Rect r;
SDL_SetRenderTarget(app.renderer, app.uiBuffer);
SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_BLEND); SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_BLEND);
SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 128); SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 128);
SDL_RenderFillRect(app.renderer, NULL); SDL_RenderFillRect(app.renderer, NULL);
@ -185,6 +187,8 @@ void drawStats(void)
drawText(r.x + r.w - 20, 565, 18, TA_RIGHT, colors.white, timeToString(game.stats[STAT_TIME], 1)); drawText(r.x + r.w - 20, 565, 18, TA_RIGHT, colors.white, timeToString(game.stats[STAT_TIME], 1));
drawWidgets("stats"); drawWidgets("stats");
SDL_SetRenderTarget(app.renderer, app.backBuffer);
} }
static void nextPage(void) static void nextPage(void)

View File

@ -69,7 +69,7 @@ void initTitle(void)
earthTexture = getAtlasImage("gfx/planets/earth.png"); earthTexture = getAtlasImage("gfx/planets/earth.png");
earth.x = rand() % SCREEN_WIDTH; earth.x = rand() % app.winWidth;
earth.y = -(128 + (rand() % 128)); earth.y = -(128 + (rand() % 128));
initEffects(); initEffects();
@ -110,8 +110,8 @@ static void initFighters(void)
for (i = 0 ; i < NUM_FIGHTERS ; i++) for (i = 0 ; i < NUM_FIGHTERS ; i++)
{ {
fighters[i].x = rand() % (SCREEN_WIDTH - 32); fighters[i].x = rand() % (app.winWidth - 32);
fighters[i].y = SCREEN_HEIGHT + (rand() % SCREEN_HEIGHT); fighters[i].y = app.winHeight + (rand() % app.winHeight);
fighters[i].texture = getAtlasImage(fighterTextures[rand() % numTextures]); fighters[i].texture = getAtlasImage(fighterTextures[rand() % numTextures]);
fighters[i].dy = -(1 + rand() % 3); fighters[i].dy = -(1 + rand() % 3);
} }
@ -127,9 +127,9 @@ static void logic(void)
earth.y += 0.1; earth.y += 0.1;
if (earth.y > SCREEN_HEIGHT + 128) if (earth.y > app.winHeight + 128)
{ {
earth.x = rand() % SCREEN_WIDTH; earth.x = rand() % app.winWidth;
earth.y = -(128 + (rand() % 128)); earth.y = -(128 + (rand() % 128));
} }
@ -166,8 +166,8 @@ static void doFighters(void)
if (self->y <= -64) if (self->y <= -64)
{ {
self->x = rand() % (SCREEN_WIDTH - 32); self->x = rand() % (app.winWidth - 32);
self->y = SCREEN_HEIGHT + (rand() % SCREEN_HEIGHT); self->y = app.winHeight + (rand() % app.winHeight);
self->texture = getAtlasImage(fighterTextures[rand() % numTextures]); self->texture = getAtlasImage(fighterTextures[rand() % numTextures]);
self->dy = -(1 + rand() % 3); self->dy = -(1 + rand() % 3);
} }
@ -190,18 +190,20 @@ static void draw(void)
setAtlasColor(255, 255, 255, 255); setAtlasColor(255, 255, 255, 255);
blit(logo[0], (SCREEN_WIDTH / 2) - logo[0]->rect.w, 30, 0); blit(logo[0], (app.winWidth / 2) - logo[0]->rect.w, 30, 0);
blit(logo[1], (SCREEN_WIDTH / 2), 30, 0); blit(logo[1], (app.winWidth / 2), 30, 0);
blit(pandoranWar, SCREEN_WIDTH / 2, 110, 1); blit(pandoranWar, app.winWidth / 2, 110, 1);
drawText(10, SCREEN_HEIGHT - 25, 14, TA_LEFT, colors.white, "Copyright Parallel Realities, 2015-2018"); drawText(10, app.winHeight - 25, 14, TA_LEFT, colors.white, "Copyright Parallel Realities, 2015-2018");
drawText(SCREEN_WIDTH - 10, SCREEN_HEIGHT - 25, 14, TA_RIGHT, colors.white, "Version %.2f.%d", VERSION, REVISION); drawText(app.winWidth - 10, app.winHeight - 25, 14, TA_RIGHT, colors.white, "Version %.2f.%d", VERSION, REVISION);
switch (show) switch (show)
{ {
case SHOW_TITLE: case SHOW_TITLE:
SDL_SetRenderTarget(app.renderer, app.uiBuffer);
drawWidgets("title"); drawWidgets("title");
SDL_SetRenderTarget(app.renderer, app.backBuffer);
break; break;
case SHOW_STATS: case SHOW_STATS:

View File

@ -133,6 +133,8 @@ void drawTrophies(void)
SDL_Rect r; SDL_Rect r;
int start, end, i, x, y; int start, end, i, x, y;
SDL_SetRenderTarget(app.renderer, app.uiBuffer);
SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_BLEND); SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_BLEND);
SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 128); SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 128);
SDL_RenderFillRect(app.renderer, NULL); SDL_RenderFillRect(app.renderer, NULL);
@ -201,6 +203,8 @@ void drawTrophies(void)
} }
drawWidgets("trophies"); drawWidgets("trophies");
SDL_SetRenderTarget(app.renderer, app.backBuffer);
} }
void awardTrophy(char *id) void awardTrophy(char *id)

View File

@ -498,8 +498,8 @@ typedef struct {
int saveGame; int saveGame;
int winWidth; int winWidth;
int winHeight; int winHeight;
float scaleX; PointF scale;
float scaleY; PointF uiScale;
int fullscreen; int fullscreen;
int musicVolume; int musicVolume;
int soundVolume; int soundVolume;
@ -508,8 +508,10 @@ typedef struct {
int hideMouse; int hideMouse;
Gameplay gameplay; Gameplay gameplay;
Mouse mouse; Mouse mouse;
PointF uiMouse;
int keyboard[MAX_KEYBOARD_KEYS]; int keyboard[MAX_KEYBOARD_KEYS];
SDL_Texture *backBuffer; SDL_Texture *backBuffer;
SDL_Texture *uiBuffer;
SDL_Renderer *renderer; SDL_Renderer *renderer;
SDL_Window *window; SDL_Window *window;
Delegate delegate; Delegate delegate;

View File

@ -62,6 +62,10 @@ static void initColor(SDL_Color *c, int r, int g, int b)
void prepareScene(void) void prepareScene(void)
{ {
SDL_SetRenderTarget(app.renderer, app.uiBuffer);
SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 0);
SDL_RenderClear(app.renderer);
SDL_SetRenderTarget(app.renderer, app.backBuffer); SDL_SetRenderTarget(app.renderer, app.backBuffer);
SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 255); SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 255);
SDL_RenderClear(app.renderer); SDL_RenderClear(app.renderer);
@ -72,19 +76,20 @@ void presentScene(void)
if (dev.debug) if (dev.debug)
{ {
drawText(5, SCREEN_HEIGHT - 25, 14, TA_LEFT, colors.white, "DEBUG MODE"); drawText(5, SCREEN_HEIGHT - 25, 14, TA_LEFT, colors.white, "DEBUG MODE");
if (dev.showFPS) if (dev.showFPS)
{ {
drawText(SCREEN_WIDTH / 2, SCREEN_HEIGHT - 25, 14, TA_CENTER, colors.white, "FPS: %d", dev.fps); drawText(SCREEN_WIDTH / 2, SCREEN_HEIGHT - 25, 14, TA_CENTER, colors.white, "FPS: %d", dev.fps);
} }
} }
SDL_SetRenderTarget(app.renderer, NULL);
SDL_RenderCopy(app.renderer, app.backBuffer, NULL, NULL);
SDL_RenderCopy(app.renderer, app.uiBuffer, NULL, NULL);
if (!app.hideMouse) if (!app.hideMouse)
{ {
drawMouse(); drawMouse();
} }
SDL_SetRenderTarget(app.renderer, NULL);
SDL_RenderCopy(app.renderer, app.backBuffer, NULL, NULL);
SDL_RenderPresent(app.renderer); SDL_RenderPresent(app.renderer);
} }

View File

@ -111,14 +111,21 @@ void initSDL(int argc, char *argv[])
exit(1); exit(1);
} }
app.backBuffer = SDL_CreateTexture(app.renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, SCREEN_WIDTH, SCREEN_HEIGHT); app.backBuffer = SDL_CreateTexture(app.renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, app.winWidth, app.winHeight);
app.scaleX = SCREEN_WIDTH; app.scale.x = app.scale.y = 1;
app.scaleX /= app.winWidth;
app.scaleY = SCREEN_HEIGHT;
app.scaleY /= app.winHeight;
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, "Game scale factor: %.2f,%.2f\n", app.scaleX, app.scaleY); SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, "Game scale factor: %.2f,%.2f\n", app.scale.x, app.scale.y);
app.uiBuffer = SDL_CreateTexture(app.renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, UI_WIDTH, UI_HEIGHT);
SDL_SetTextureBlendMode(app.uiBuffer, SDL_BLENDMODE_BLEND);
app.uiScale.x = UI_WIDTH;
app.uiScale.x /= app.winWidth;
app.uiScale.y = UI_HEIGHT;
app.uiScale.y /= app.winHeight;
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, "UI scale factor: %.2f,%.2f\n", app.uiScale.x, app.uiScale.y);
} }
void initGameSystem(void) void initGameSystem(void)
@ -169,10 +176,10 @@ static void showLoadingStep(float step, float maxSteps)
prepareScene(); prepareScene();
r.w = SCREEN_WIDTH - 400; r.w = 600;
r.h = 14; r.h = 12;
r.x = (SCREEN_WIDTH / 2) - r.w / 2; r.x = (app.winWidth / 2) - r.w / 2;
r.y = (SCREEN_HEIGHT / 2) - r.h / 2; r.y = (app.winHeight / 2) - r.h / 2;
SDL_SetRenderDrawColor(app.renderer, 128, 128, 128, 255); SDL_SetRenderDrawColor(app.renderer, 128, 128, 128, 255);
SDL_RenderDrawRect(app.renderer, &r); SDL_RenderDrawRect(app.renderer, &r);

View File

@ -108,13 +108,6 @@ void setMouseCursor(int isDrag)
void drawMouse(void) void drawMouse(void)
{ {
int x, y;
SDL_GetMouseState(&x, &y);
app.mouse.x = x * app.scaleX;
app.mouse.y = y * app.scaleY;
setAtlasColor(255, 255, 255, 255); setAtlasColor(255, 255, 255, 255);
blit(mousePointer, app.mouse.x, app.mouse.y, 1); blit(mousePointer, app.mouse.x, app.mouse.y, 1);
@ -123,6 +116,7 @@ void drawMouse(void)
void doInput(void) void doInput(void)
{ {
SDL_Event event; SDL_Event event;
int x, y;
while (SDL_PollEvent(&event)) while (SDL_PollEvent(&event))
{ {
@ -169,6 +163,14 @@ void doInput(void)
break; break;
} }
} }
SDL_GetMouseState(&x, &y);
app.mouse.x = x * app.scale.x;
app.mouse.y = y * app.scale.y;
app.uiMouse.x = x * app.uiScale.x;
app.uiMouse.y = y * app.uiScale.y;
} }
void clearInput(void) void clearInput(void)

View File

@ -131,7 +131,7 @@ void drawWidgets(const char *group)
{ {
if (!mouseOver && !app.awaitingWidgetInput) if (!mouseOver && !app.awaitingWidgetInput)
{ {
mouseOver = (w->type != WT_SELECT && w->enabled && collision(w->rect.x, w->rect.y, w->rect.w, w->rect.h, app.mouse.x, app.mouse.y, 1, 1)); mouseOver = (w->type != WT_SELECT && w->enabled && collision(w->rect.x, w->rect.y, w->rect.w, w->rect.h, app.uiMouse.x, app.uiMouse.y, 1, 1));
if (mouseOver && selectedWidget != w) if (mouseOver && selectedWidget != w)
{ {
@ -257,7 +257,7 @@ static void handleMouse(void)
{ {
Widget *old; Widget *old;
if (selectedWidget && collision(selectedWidget->rect.x, selectedWidget->rect.y, selectedWidget->rect.w, selectedWidget->rect.h, app.mouse.x, app.mouse.y, 1, 1)) if (selectedWidget && collision(selectedWidget->rect.x, selectedWidget->rect.y, selectedWidget->rect.w, selectedWidget->rect.h, app.uiMouse.x, app.uiMouse.y, 1, 1))
{ {
if (app.mouse.button[SDL_BUTTON_LEFT]) if (app.mouse.button[SDL_BUTTON_LEFT])
{ {