From cf390f0b00bfdc14a7837ee135c43b46c88c2780 Mon Sep 17 00:00:00 2001 From: Steve Date: Fri, 14 Dec 2018 08:00:16 +0000 Subject: [PATCH] More resolution tweaks. --- src/battle/battle.c | 4 +-- src/battle/effects.c | 4 +-- src/battle/entities.c | 6 ++--- src/battle/hud.c | 6 ++--- src/battle/missionInfo.c | 22 +++++++++------- src/battle/missionInfo.h | 1 + src/battle/player.c | 4 +-- src/challenges/challengeHome.c | 38 +++++++++++++-------------- src/galaxy/galacticMap.c | 12 ++++----- src/galaxy/mission.c | 8 +++--- src/galaxy/mission.h | 1 + src/game/credits.h | 2 +- src/system/controls.c | 12 ++++----- src/system/draw.c | 48 +++++++++++++++++----------------- src/system/widgets.c | 4 +-- 15 files changed, 88 insertions(+), 84 deletions(-) diff --git a/src/battle/battle.c b/src/battle/battle.c index 6c85d8b..fe72c05 100644 --- a/src/battle/battle.c +++ b/src/battle/battle.c @@ -216,8 +216,8 @@ static void draw(void) { if (player->alive == ALIVE_ALIVE) { - battle.camera.x = player->x - (SCREEN_WIDTH / 2); - battle.camera.y = player->y - (SCREEN_HEIGHT / 2); + battle.camera.x = player->x - (app.winWidth / 2); + battle.camera.y = player->y - (app.winHeight / 2); } drawBackground(battle.background); diff --git a/src/battle/effects.c b/src/battle/effects.c index 976dcbd..459b2ff 100644 --- a/src/battle/effects.c +++ b/src/battle/effects.c @@ -112,7 +112,7 @@ void doEffects(void) static int pointOnScreen(float x, float y) { - return collision(x, y, 1, 1, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); + return collision(x, y, 1, 1, 0, 0, app.winWidth, app.winHeight); } static void resizeDrawList(void) @@ -166,7 +166,7 @@ void drawEffects(void) case EFFECT_ECM: setAtlasColor(e->r, e->g, e->b, e->a); - blitScaled(e->texture, SCREEN_WIDTH / 2 - (e->size / 2), SCREEN_HEIGHT / 2 - (e->size / 2), e->size, e->size, 0); + blitScaled(e->texture, app.winWidth / 2 - (e->size / 2), app.winHeight / 2 - (e->size / 2), e->size, e->size, 0); break; } diff --git a/src/battle/entities.c b/src/battle/entities.c index 4905afc..49c6d84 100644 --- a/src/battle/entities.c +++ b/src/battle/entities.c @@ -390,7 +390,7 @@ void drawEntities(void) int i; Entity *e, **candidates; - candidates = getAllEntsWithin(battle.camera.x, battle.camera.y, SCREEN_WIDTH, SCREEN_HEIGHT, NULL); + candidates = getAllEntsWithin(battle.camera.x, battle.camera.y, app.winWidth, app.winHeight, NULL); /* counting entities to draw */ for (i = 0, e = candidates[i] ; e != NULL ; e = candidates[++i]) {}; @@ -613,8 +613,8 @@ static void activateEpicFighters(int side) e->x = player->x; e->y = player->y; - e->x += (rand() % 2) ? -SCREEN_WIDTH : SCREEN_WIDTH; - e->y += (rand() % 2) ? -SCREEN_HEIGHT : SCREEN_HEIGHT; + e->x += (rand() % 2) ? -app.winWidth : app.winWidth; + e->y += (rand() % 2) ? -app.winHeight : app.winHeight; } return; diff --git a/src/battle/hud.c b/src/battle/hud.c index 3221f7a..00a2a10 100644 --- a/src/battle/hud.c +++ b/src/battle/hud.c @@ -453,12 +453,12 @@ static void drawNumFighters(void) /* Allies */ setAtlasColor(150, 200, 255, 255); blit(smallFighter, (app.winWidth / 2) - 200, 15, 0); - drawText((app.winWidth / 2) - 175, 11, 14, TA_LEFT, colors.white, battle.numAllies < 1000 ? "(%d)" : "(999+)", battle.numAllies); + drawText((app.winWidth / 2) - 160, 11, 14, TA_RIGHT, colors.white, battle.numAllies < 1000 ? "(%d)" : "(999+)", battle.numAllies); /* Enemies */ setAtlasColor(255, 100, 100, 255); - blit(smallFighter, (app.winWidth / 2) + 195, 15, 0); - drawText((app.winWidth / 2) + 185, 11, 14, TA_RIGHT, colors.white, !battle.unlimitedEnemies ? "(%d)" : "(999+)", battle.numEnemies); + blit(smallFighter, (app.winWidth / 2) + 185, 15, 0); + drawText((app.winWidth / 2) + 160, 11, 14, TA_LEFT, colors.white, !battle.unlimitedEnemies ? "(%d)" : "(999+)", battle.numEnemies); } static void drawObjectives(void) diff --git a/src/battle/missionInfo.c b/src/battle/missionInfo.c index ddeea6d..4fc62f7 100644 --- a/src/battle/missionInfo.c +++ b/src/battle/missionInfo.c @@ -58,6 +58,8 @@ void drawMissionInfo(void) { SDL_SetRenderTarget(app.renderer, app.uiBuffer); + setAtlasColor(255, 255, 255, 255); + switch (battle.status) { case MS_START: @@ -109,7 +111,7 @@ static void drawMissionSummary(AtlasImage *header) SDL_RenderFillRect(app.renderer, NULL); SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_NONE); - blit(header, SCREEN_WIDTH / 2, 150, 1); + blit(header, UI_WIDTH / 2, 150, 1); if (!game.currentMission->challengeData.isChallenge) { @@ -127,7 +129,7 @@ static void drawObjectives(void) SDL_Color color; int y = 215; - drawText(SCREEN_WIDTH / 2, y, 28, TA_CENTER, colors.white, OBJECTIVES_TEXT); + drawText(UI_WIDTH / 2, y, 28, TA_CENTER, colors.white, OBJECTIVES_TEXT); y += 10; @@ -152,14 +154,14 @@ static void drawObjectives(void) break; } - drawText(SCREEN_WIDTH / 2 - 100, y, 22, TA_RIGHT, colors.white, o->description); + drawText(UI_WIDTH / 2 - 100, y, 22, TA_RIGHT, colors.white, o->description); if (o->targetValue > 1 && !o->hideNumbers) { - drawText(SCREEN_WIDTH / 2, y, 22, TA_CENTER, colors.white, "%d / %d", o->currentValue, o->targetValue); + drawText(UI_WIDTH / 2, y, 22, TA_CENTER, colors.white, "%d / %d", o->currentValue, o->targetValue); } - drawText(SCREEN_WIDTH / 2 + 100, y, 22, TA_LEFT, color, objectiveStatus[o->status]); + drawText(UI_WIDTH / 2 + 100, y, 22, TA_LEFT, color, objectiveStatus[o->status]); } } @@ -167,7 +169,7 @@ static void drawObjectives(void) { y += 50; - drawText(SCREEN_WIDTH / 2, y, 22, TA_CENTER, colors.white, NONE_TEXT); + drawText(UI_WIDTH / 2, y, 22, TA_CENTER, colors.white, NONE_TEXT); } y += 75; @@ -181,13 +183,13 @@ static void drawChallenges(void) SDL_Color color; int y = 215; - drawText(SCREEN_WIDTH / 2, y, 24, TA_CENTER, colors.white, game.currentMission->description); + drawText(UI_WIDTH / 2, y, 24, TA_CENTER, colors.white, game.currentMission->description); if (battle.status == MS_START && game.currentMission->challengeData.timeLimit) { y+= 50; - drawText(SCREEN_WIDTH / 2, y, 20, TA_CENTER, colors.white, TIME_LIMIT_TEXT, timeToString(game.currentMission->challengeData.timeLimit, 0)); + drawText(UI_WIDTH / 2, y, 20, TA_CENTER, colors.white, TIME_LIMIT_TEXT, timeToString(game.currentMission->challengeData.timeLimit, 0)); } y += 25; @@ -217,8 +219,8 @@ static void drawChallenges(void) challengeStatus = _("Failed"); } - drawText(SCREEN_WIDTH / 2 - 50, y, 22, TA_RIGHT, colors.white, "%s", getChallengeDescription(c)); - drawText(SCREEN_WIDTH / 2 + 50, y, 22, TA_LEFT, color, challengeStatus); + drawText(UI_WIDTH / 2 - 50, y, 22, TA_RIGHT, colors.white, "%s", getChallengeDescription(c)); + drawText(UI_WIDTH / 2 + 50, y, 22, TA_LEFT, color, challengeStatus); } } } diff --git a/src/battle/missionInfo.h b/src/battle/missionInfo.h index a443c84..4e9e5f1 100644 --- a/src/battle/missionInfo.h +++ b/src/battle/missionInfo.h @@ -26,6 +26,7 @@ extern void drawWidgets(char *groupName); extern AtlasImage *getAtlasImage(char *filename); extern char *getChallengeDescription(Challenge *c); extern char *timeToString(long millis, int showHours); +extern void setAtlasColor(int r, int g, int b, int a); extern App app; extern Battle battle; diff --git a/src/battle/player.c b/src/battle/player.c index 7fa1220..9497602 100644 --- a/src/battle/player.c +++ b/src/battle/player.c @@ -515,8 +515,8 @@ static void selectNewPlayer(int dir) } while (player == NULL); - battle.camera.x = player->x - (SCREEN_WIDTH / 2); - battle.camera.y = player->y - (SCREEN_HEIGHT / 2); + battle.camera.x = player->x - (app.winWidth / 2); + battle.camera.y = player->y - (app.winHeight / 2); } static void activateBoost(void) diff --git a/src/challenges/challengeHome.c b/src/challenges/challengeHome.c index fb2a58e..f7f0cbd 100644 --- a/src/challenges/challengeHome.c +++ b/src/challenges/challengeHome.c @@ -100,8 +100,8 @@ void initChallengeHome(void) battle.camera.x = battle.camera.y = 0; - planet.x = rand() % SCREEN_WIDTH; - planet.y = rand() % SCREEN_HEIGHT; + planet.x = rand() % app.winWidth; + planet.y = rand() % app.winHeight; maxPages = page = 0; @@ -202,8 +202,8 @@ static void logic(void) planet.x -= 0.25; if (planet.x <= -200) { - planet.x = SCREEN_WIDTH + 128 + (rand() % SCREEN_WIDTH); - planet.y = (rand() % SCREEN_HEIGHT - 128); + planet.x = app.winWidth + 128 + (rand() % app.winWidth); + planet.y = (rand() % app.winHeight - 128); } switch (show) @@ -310,9 +310,9 @@ static void draw(void) SDL_SetRenderTarget(app.renderer, app.uiBuffer); - drawText(SCREEN_WIDTH / 2, 40, 28, TA_CENTER, colors.white, CHALLENGES_TEXT); - drawText(SCREEN_WIDTH / 2, 83, 16, TA_CENTER, colors.lightGrey, COMPLETED_TEXT, game.completedChallenges, game.totalChallenges); - drawText(SCREEN_WIDTH / 2, 110, 16, TA_CENTER, colors.lightGrey, PAGE_TEXT, page + 1, (int)maxPages); + drawText(UI_WIDTH / 2, 40, 28, TA_CENTER, colors.white, CHALLENGES_TEXT); + drawText(UI_WIDTH / 2, 83, 16, TA_CENTER, colors.lightGrey, COMPLETED_TEXT, game.completedChallenges, game.totalChallenges); + drawText(UI_WIDTH / 2, 110, 16, TA_CENTER, colors.lightGrey, PAGE_TEXT, page + 1, (int)maxPages); drawChallenges(); @@ -390,7 +390,7 @@ static void drawChallenges(void) r.x += 150; - if (r.x > SCREEN_WIDTH - 200) + if (r.x > UI_WIDTH - 200) { r.y += 165; r.x = 135; @@ -400,9 +400,9 @@ static void drawChallenges(void) i++; } - r.y = SCREEN_HEIGHT - 245; + r.y = UI_HEIGHT - 245; r.x = 100; - r.w = SCREEN_WIDTH - 200; + r.w = UI_WIDTH - 200; r.h = 150; SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_BLEND); @@ -416,29 +416,29 @@ static void drawChallenges(void) if (game.currentMission) { - drawText(SCREEN_WIDTH / 2, SCREEN_HEIGHT - r.y, 24, TA_CENTER, colors.white, game.currentMission->description); + drawText(UI_WIDTH / 2, SCREEN_HEIGHT - r.y, 24, TA_CENTER, colors.white, game.currentMission->description); r.y -= 50; c = game.currentMission->challengeData.challenges[0]; - drawText((SCREEN_WIDTH / 2) - 25, SCREEN_HEIGHT - r.y, 18, TA_RIGHT, colors.white, CRAFT_TEXT, game.currentMission->craft); - drawText((SCREEN_WIDTH / 2) + 25, SCREEN_HEIGHT - r.y, 18, TA_LEFT, (c->passed) ? colors.green : colors.white, "1. %s", getChallengeDescription(c)); + drawText((UI_WIDTH / 2) - 25, SCREEN_HEIGHT - r.y, 18, TA_RIGHT, colors.white, CRAFT_TEXT, game.currentMission->craft); + drawText((UI_WIDTH / 2) + 25, SCREEN_HEIGHT - r.y, 18, TA_LEFT, (c->passed) ? colors.green : colors.white, "1. %s", getChallengeDescription(c)); r.y -= 30; - drawText((SCREEN_WIDTH / 2) - 25, SCREEN_HEIGHT - r.y, 18, TA_RIGHT, colors.white, TIME_TEXT, timeLimit); + drawText((UI_WIDTH / 2) - 25, SCREEN_HEIGHT - r.y, 18, TA_RIGHT, colors.white, TIME_TEXT, timeLimit); c = game.currentMission->challengeData.challenges[1]; if (c) { - drawText((SCREEN_WIDTH / 2) + 25, SCREEN_HEIGHT - r.y, 18, TA_LEFT, (c->passed) ? colors.green : colors.white, "2. %s", getChallengeDescription(c)); + drawText((UI_WIDTH / 2) + 25, SCREEN_HEIGHT - r.y, 18, TA_LEFT, (c->passed) ? colors.green : colors.white, "2. %s", getChallengeDescription(c)); } r.y -= 30; - drawText((SCREEN_WIDTH / 2) - 25, SCREEN_HEIGHT - r.y, 18, TA_RIGHT, hasRestrictions ? colors.red : colors.white, RESTRICTIONS_TEXT, restrictions); + drawText((UI_WIDTH / 2) - 25, SCREEN_HEIGHT - r.y, 18, TA_RIGHT, hasRestrictions ? colors.red : colors.white, RESTRICTIONS_TEXT, restrictions); c = game.currentMission->challengeData.challenges[2]; if (c) { - drawText((SCREEN_WIDTH / 2) + 25, SCREEN_HEIGHT - r.y, 18, TA_LEFT, (c->passed) ? colors.green : colors.white, "3. %s", getChallengeDescription(c)); + drawText((UI_WIDTH / 2) + 25, SCREEN_HEIGHT - r.y, 18, TA_LEFT, (c->passed) ? colors.green : colors.white, "3. %s", getChallengeDescription(c)); } } } @@ -454,8 +454,8 @@ static void drawMenu(void) r.w = 400; r.h = 500; - r.x = (SCREEN_WIDTH / 2) - r.w / 2; - r.y = (SCREEN_HEIGHT / 2) - r.h / 2; + r.x = (UI_WIDTH / 2) - r.w / 2; + r.y = (UI_HEIGHT / 2) - r.h / 2; SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 255); SDL_RenderFillRect(app.renderer, &r); diff --git a/src/galaxy/galacticMap.c b/src/galaxy/galacticMap.c index 1962138..a4476e7 100644 --- a/src/galaxy/galacticMap.c +++ b/src/galaxy/galacticMap.c @@ -278,11 +278,11 @@ static void doStarSystems(void) } } - cameraMin.x -= SCREEN_WIDTH / 2; - cameraMin.y -= SCREEN_HEIGHT / 2; + cameraMin.x -= app.winWidth / 2; + cameraMin.y -= app.winHeight / 2; - cameraMax.x -= SCREEN_WIDTH / 2; - cameraMax.y -= SCREEN_HEIGHT / 2; + cameraMax.x -= app.winWidth / 2; + cameraMax.y -= app.winHeight / 2; } } @@ -481,10 +481,10 @@ static void drawPulses(void) static void centerOnSelectedStarSystem(void) { camera.x = selectedStarSystem->x; - camera.x -= SCREEN_WIDTH / 2; + camera.x -= app.winWidth / 2; camera.y = selectedStarSystem->y; - camera.y -= SCREEN_HEIGHT / 2; + camera.y -= app.winHeight / 2; } static void drawGalaxy(void) diff --git a/src/galaxy/mission.c b/src/galaxy/mission.c index 66449f3..542e90d 100644 --- a/src/galaxy/mission.c +++ b/src/galaxy/mission.c @@ -157,8 +157,8 @@ void loadMission(char *filename) battle.planetTexture = getAtlasImage(planet); battle.fireStormTexture = getAtlasImage("gfx/misc/torelliFireStorm.png"); - battle.planet.x = (SCREEN_WIDTH / 2) - (rand() % SCREEN_WIDTH) + (rand() % SCREEN_WIDTH); - battle.planet.y = (SCREEN_HEIGHT / 2) - (rand() % SCREEN_HEIGHT) + (rand() % SCREEN_HEIGHT); + battle.planet.x = (app.winWidth / 2) - (rand() % app.winWidth) + (rand() % app.winWidth); + battle.planet.y = (app.winHeight / 2) - (rand() % app.winHeight) + (rand() % app.winHeight); if (strcmp(planet, "gfx/planets/star.png") != 0) { @@ -170,8 +170,8 @@ void loadMission(char *filename) if (getJSONValue(root, "largePlanet", 0)) { - battle.planet.x = (SCREEN_WIDTH / 2); - battle.planet.y = (SCREEN_HEIGHT / 2); + battle.planet.x = (app.winWidth / 2); + battle.planet.y = (app.winHeight / 2); planetScale = 5; } diff --git a/src/galaxy/mission.h b/src/galaxy/mission.h index ac654c4..94c2101 100644 --- a/src/galaxy/mission.h +++ b/src/galaxy/mission.h @@ -67,6 +67,7 @@ extern void stopMusic(void); extern void updateChallengeMissions(void); extern void updateStarSystemMissions(void); +extern App app; extern Battle battle; extern Dev dev; extern Entity *player; diff --git a/src/game/credits.h b/src/game/credits.h index cc112a3..4d63a9d 100644 --- a/src/game/credits.h +++ b/src/game/credits.h @@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "../common.h" #include "../json/cJSON.h" -#define CREDIT_LINE_LIMIT (SCREEN_WIDTH - 300) +#define CREDIT_LINE_LIMIT (UI_WIDTH - 300) extern void blit(AtlasImage *atlasImage, int x, int y, int centered); extern void drawBackground(SDL_Texture *texture); diff --git a/src/system/controls.c b/src/system/controls.c index b76440d..3a875bd 100644 --- a/src/system/controls.c +++ b/src/system/controls.c @@ -161,15 +161,15 @@ void drawControls(void) r.w = 800; r.h = 650; - r.x = (SCREEN_WIDTH / 2) - r.w / 2; - r.y = (SCREEN_HEIGHT / 2) - r.h / 2; + r.x = (UI_WIDTH / 2) - r.w / 2; + r.y = (UI_HEIGHT / 2) - r.h / 2; SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 255); SDL_RenderFillRect(app.renderer, &r); SDL_SetRenderDrawColor(app.renderer, 200, 200, 200, 255); SDL_RenderDrawRect(app.renderer, &r); - drawText(SCREEN_WIDTH / 2, 50, 28, TA_CENTER, colors.white, CONTROLS_TEXT); + drawText(UI_WIDTH / 2, 50, 28, TA_CENTER, colors.white, CONTROLS_TEXT); SDL_SetRenderDrawColor(app.renderer, 128, 128, 128, 255); SDL_RenderDrawLine(app.renderer, r.x, r.y + 65, r.x + r.w, r.y + 65); @@ -193,12 +193,12 @@ void drawControls(void) } } - drawText((SCREEN_WIDTH / 2) - 50, 525, 16, TA_RIGHT, colors.white, BACKSPACE_TEXT); - drawText((SCREEN_WIDTH / 2) + 50, 525, 16, TA_LEFT, colors.white, ESCAPE_TEXT); + drawText((UI_WIDTH / 2) - 50, 525, 16, TA_RIGHT, colors.white, BACKSPACE_TEXT); + drawText((UI_WIDTH / 2) + 50, 525, 16, TA_LEFT, colors.white, ESCAPE_TEXT); app.textWidth = r.w - 100; - drawText(SCREEN_WIDTH / 2, 560, 16, TA_CENTER, colors.white, HELP_TEXT); + drawText(UI_WIDTH / 2, 560, 16, TA_CENTER, colors.white, HELP_TEXT); app.textWidth = 0; diff --git a/src/system/draw.c b/src/system/draw.c index dbd612c..6d7a895 100644 --- a/src/system/draw.c +++ b/src/system/draw.c @@ -26,17 +26,17 @@ static PointF backgroundPoint[4]; void initGraphics(void) { - backgroundPoint[0].x = -SCREEN_WIDTH / 2; - backgroundPoint[0].y = -SCREEN_HEIGHT / 2; + backgroundPoint[0].x = -app.winWidth / 2; + backgroundPoint[0].y = -app.winHeight / 2; - backgroundPoint[1].x = SCREEN_WIDTH / 2; - backgroundPoint[1].y = -SCREEN_HEIGHT / 2; + backgroundPoint[1].x = app.winWidth / 2; + backgroundPoint[1].y = -app.winHeight / 2; - backgroundPoint[2].x = -SCREEN_WIDTH / 2; - backgroundPoint[2].y = SCREEN_HEIGHT / 2; + backgroundPoint[2].x = -app.winWidth / 2; + backgroundPoint[2].y = app.winHeight / 2; - backgroundPoint[3].x = SCREEN_WIDTH / 2; - backgroundPoint[3].y = SCREEN_HEIGHT / 2; + backgroundPoint[3].x = app.winWidth / 2; + backgroundPoint[3].y = app.winHeight / 2; initColor(&colors.red, 255, 0, 0); initColor(&colors.orange, 255, 128, 0); @@ -75,11 +75,11 @@ void presentScene(void) { if (dev.debug) { - drawText(5, SCREEN_HEIGHT - 25, 14, TA_LEFT, colors.white, "DEBUG MODE"); + drawText(5, app.winHeight - 25, 14, TA_LEFT, colors.white, "DEBUG MODE"); if (dev.showFPS) { - drawText(SCREEN_WIDTH / 2, SCREEN_HEIGHT - 25, 14, TA_CENTER, colors.white, "FPS: %d", dev.fps); + drawText(app.winWidth / 2, app.winHeight - 25, 14, TA_CENTER, colors.white, "FPS: %d", dev.fps); } } @@ -193,22 +193,22 @@ void scrollBackground(float x, float y) if (backgroundPoint[i].x < 0) { - backgroundPoint[i].x += (SCREEN_WIDTH * 2); + backgroundPoint[i].x += (app.winWidth * 2); } - if (backgroundPoint[i].x >= SCREEN_WIDTH) + if (backgroundPoint[i].x >= app.winWidth) { - backgroundPoint[i].x -= (SCREEN_WIDTH * 2); + backgroundPoint[i].x -= (app.winWidth * 2); } if (backgroundPoint[i].y < 0) { - backgroundPoint[i].y += (SCREEN_HEIGHT * 2); + backgroundPoint[i].y += (app.winHeight * 2); } - if (backgroundPoint[i].y >= SCREEN_HEIGHT) + if (backgroundPoint[i].y >= app.winHeight) { - backgroundPoint[i].y -= (SCREEN_HEIGHT * 2); + backgroundPoint[i].y -= (app.winHeight * 2); } } } @@ -222,8 +222,8 @@ void drawBackground(SDL_Texture *texture) { dstRect.x = backgroundPoint[i].x; dstRect.y = backgroundPoint[i].y; - dstRect.w = SCREEN_WIDTH; - dstRect.h = SCREEN_HEIGHT; + dstRect.w = app.winWidth; + dstRect.h = app.winHeight; SDL_RenderCopy(app.renderer, texture, NULL, &dstRect); } @@ -232,20 +232,20 @@ void drawBackground(SDL_Texture *texture) int isOnBattleScreen(int x, int y, int w, int h) { x -= (w / 2); - x -= (SCREEN_WIDTH / 2); + x -= (app.winWidth / 2); x -= battle.camera.x; y -= (h / 2); - y -= (SCREEN_HEIGHT / 2); + y -= (app.winHeight / 2); y -= battle.camera.y; w *= 2; - w += SCREEN_WIDTH; + w += app.winWidth; h *= 2; - h += SCREEN_HEIGHT; + h += app.winHeight; - return collision(x, y, w, h, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); + return collision(x, y, w, h, 0, 0, app.winWidth, app.winHeight); } void saveScreenshot(void) @@ -256,7 +256,7 @@ void saveScreenshot(void) sprintf(filename, "/tmp/tbftss/%d.bmp", ++i); - sshot = SDL_CreateRGBSurface(0, SCREEN_WIDTH, SCREEN_HEIGHT, 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000); + sshot = SDL_CreateRGBSurface(0, app.winWidth, app.winHeight, 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000); SDL_RenderReadPixels(app.renderer, NULL, SDL_PIXELFORMAT_ARGB8888, sshot->pixels, sshot->pitch); SDL_SaveBMP(sshot, filename); SDL_FreeSurface(sshot); diff --git a/src/system/widgets.c b/src/system/widgets.c index 107fc1d..8613733 100644 --- a/src/system/widgets.c +++ b/src/system/widgets.c @@ -408,7 +408,7 @@ static void loadWidgetSet(char *filename) if (w->rect.x == -1) { - w->rect.x = SCREEN_WIDTH / 2; + w->rect.x = UI_WIDTH / 2; } switch (w->type) @@ -553,7 +553,7 @@ void autoSizeWidgetButtons(char *group, int recenter) if (recenter) { - w->rect.x = (SCREEN_WIDTH / 2) - (w->rect.w / 2); + w->rect.x = (UI_WIDTH / 2) - (w->rect.w / 2); } } }