More resolution tweaks.

This commit is contained in:
Steve 2018-12-14 08:00:16 +00:00
parent 5d54c2bbe1
commit cf390f0b00
15 changed files with 88 additions and 84 deletions

View File

@ -216,8 +216,8 @@ static void draw(void)
{ {
if (player->alive == ALIVE_ALIVE) if (player->alive == ALIVE_ALIVE)
{ {
battle.camera.x = player->x - (SCREEN_WIDTH / 2); battle.camera.x = player->x - (app.winWidth / 2);
battle.camera.y = player->y - (SCREEN_HEIGHT / 2); battle.camera.y = player->y - (app.winHeight / 2);
} }
drawBackground(battle.background); drawBackground(battle.background);

View File

@ -112,7 +112,7 @@ void doEffects(void)
static int pointOnScreen(float x, float y) 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) static void resizeDrawList(void)
@ -166,7 +166,7 @@ void drawEffects(void)
case EFFECT_ECM: case EFFECT_ECM:
setAtlasColor(e->r, e->g, e->b, e->a); 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; break;
} }

View File

@ -390,7 +390,7 @@ void drawEntities(void)
int i; int i;
Entity *e, **candidates; 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 */ /* counting entities to draw */
for (i = 0, e = candidates[i] ; e != NULL ; e = candidates[++i]) {}; 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->x = player->x;
e->y = player->y; e->y = player->y;
e->x += (rand() % 2) ? -SCREEN_WIDTH : SCREEN_WIDTH; e->x += (rand() % 2) ? -app.winWidth : app.winWidth;
e->y += (rand() % 2) ? -SCREEN_HEIGHT : SCREEN_HEIGHT; e->y += (rand() % 2) ? -app.winHeight : app.winHeight;
} }
return; return;

View File

@ -453,12 +453,12 @@ static void drawNumFighters(void)
/* Allies */ /* Allies */
setAtlasColor(150, 200, 255, 255); setAtlasColor(150, 200, 255, 255);
blit(smallFighter, (app.winWidth / 2) - 200, 15, 0); 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 */ /* Enemies */
setAtlasColor(255, 100, 100, 255); setAtlasColor(255, 100, 100, 255);
blit(smallFighter, (app.winWidth / 2) + 195, 15, 0); blit(smallFighter, (app.winWidth / 2) + 185, 15, 0);
drawText((app.winWidth / 2) + 185, 11, 14, TA_RIGHT, colors.white, !battle.unlimitedEnemies ? "(%d)" : "(999+)", battle.numEnemies); drawText((app.winWidth / 2) + 160, 11, 14, TA_LEFT, colors.white, !battle.unlimitedEnemies ? "(%d)" : "(999+)", battle.numEnemies);
} }
static void drawObjectives(void) static void drawObjectives(void)

View File

@ -58,6 +58,8 @@ void drawMissionInfo(void)
{ {
SDL_SetRenderTarget(app.renderer, app.uiBuffer); SDL_SetRenderTarget(app.renderer, app.uiBuffer);
setAtlasColor(255, 255, 255, 255);
switch (battle.status) switch (battle.status)
{ {
case MS_START: case MS_START:
@ -109,7 +111,7 @@ static void drawMissionSummary(AtlasImage *header)
SDL_RenderFillRect(app.renderer, NULL); SDL_RenderFillRect(app.renderer, NULL);
SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_NONE); 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) if (!game.currentMission->challengeData.isChallenge)
{ {
@ -127,7 +129,7 @@ static void drawObjectives(void)
SDL_Color color; SDL_Color color;
int y = 215; 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; y += 10;
@ -152,14 +154,14 @@ static void drawObjectives(void)
break; 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) 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; 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; y += 75;
@ -181,13 +183,13 @@ static void drawChallenges(void)
SDL_Color color; SDL_Color color;
int y = 215; 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) if (battle.status == MS_START && game.currentMission->challengeData.timeLimit)
{ {
y+= 50; 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; y += 25;
@ -217,8 +219,8 @@ static void drawChallenges(void)
challengeStatus = _("Failed"); challengeStatus = _("Failed");
} }
drawText(SCREEN_WIDTH / 2 - 50, y, 22, TA_RIGHT, colors.white, "%s", getChallengeDescription(c)); drawText(UI_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_LEFT, color, challengeStatus);
} }
} }
} }

View File

@ -26,6 +26,7 @@ extern void drawWidgets(char *groupName);
extern AtlasImage *getAtlasImage(char *filename); extern AtlasImage *getAtlasImage(char *filename);
extern char *getChallengeDescription(Challenge *c); extern char *getChallengeDescription(Challenge *c);
extern char *timeToString(long millis, int showHours); extern char *timeToString(long millis, int showHours);
extern void setAtlasColor(int r, int g, int b, int a);
extern App app; extern App app;
extern Battle battle; extern Battle battle;

View File

@ -515,8 +515,8 @@ static void selectNewPlayer(int dir)
} }
while (player == NULL); while (player == NULL);
battle.camera.x = player->x - (SCREEN_WIDTH / 2); battle.camera.x = player->x - (app.winWidth / 2);
battle.camera.y = player->y - (SCREEN_HEIGHT / 2); battle.camera.y = player->y - (app.winHeight / 2);
} }
static void activateBoost(void) static void activateBoost(void)

View File

@ -100,8 +100,8 @@ void initChallengeHome(void)
battle.camera.x = battle.camera.y = 0; battle.camera.x = battle.camera.y = 0;
planet.x = rand() % SCREEN_WIDTH; planet.x = rand() % app.winWidth;
planet.y = rand() % SCREEN_HEIGHT; planet.y = rand() % app.winHeight;
maxPages = page = 0; maxPages = page = 0;
@ -202,8 +202,8 @@ static void logic(void)
planet.x -= 0.25; planet.x -= 0.25;
if (planet.x <= -200) if (planet.x <= -200)
{ {
planet.x = SCREEN_WIDTH + 128 + (rand() % SCREEN_WIDTH); planet.x = app.winWidth + 128 + (rand() % app.winWidth);
planet.y = (rand() % SCREEN_HEIGHT - 128); planet.y = (rand() % app.winHeight - 128);
} }
switch (show) switch (show)
@ -310,9 +310,9 @@ static void draw(void)
SDL_SetRenderTarget(app.renderer, app.uiBuffer); SDL_SetRenderTarget(app.renderer, app.uiBuffer);
drawText(SCREEN_WIDTH / 2, 40, 28, TA_CENTER, colors.white, CHALLENGES_TEXT); drawText(UI_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(UI_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, 110, 16, TA_CENTER, colors.lightGrey, PAGE_TEXT, page + 1, (int)maxPages);
drawChallenges(); drawChallenges();
@ -390,7 +390,7 @@ static void drawChallenges(void)
r.x += 150; r.x += 150;
if (r.x > SCREEN_WIDTH - 200) if (r.x > UI_WIDTH - 200)
{ {
r.y += 165; r.y += 165;
r.x = 135; r.x = 135;
@ -400,9 +400,9 @@ static void drawChallenges(void)
i++; i++;
} }
r.y = SCREEN_HEIGHT - 245; r.y = UI_HEIGHT - 245;
r.x = 100; r.x = 100;
r.w = SCREEN_WIDTH - 200; r.w = UI_WIDTH - 200;
r.h = 150; r.h = 150;
SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_BLEND); SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_BLEND);
@ -416,29 +416,29 @@ static void drawChallenges(void)
if (game.currentMission) 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; r.y -= 50;
c = game.currentMission->challengeData.challenges[0]; 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((UI_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_LEFT, (c->passed) ? colors.green : colors.white, "1. %s", getChallengeDescription(c));
r.y -= 30; 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]; c = game.currentMission->challengeData.challenges[1];
if (c) 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; 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]; c = game.currentMission->challengeData.challenges[2];
if (c) 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.w = 400;
r.h = 500; r.h = 500;
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);

View File

@ -278,11 +278,11 @@ static void doStarSystems(void)
} }
} }
cameraMin.x -= SCREEN_WIDTH / 2; cameraMin.x -= app.winWidth / 2;
cameraMin.y -= SCREEN_HEIGHT / 2; cameraMin.y -= app.winHeight / 2;
cameraMax.x -= SCREEN_WIDTH / 2; cameraMax.x -= app.winWidth / 2;
cameraMax.y -= SCREEN_HEIGHT / 2; cameraMax.y -= app.winHeight / 2;
} }
} }
@ -481,10 +481,10 @@ static void drawPulses(void)
static void centerOnSelectedStarSystem(void) static void centerOnSelectedStarSystem(void)
{ {
camera.x = selectedStarSystem->x; camera.x = selectedStarSystem->x;
camera.x -= SCREEN_WIDTH / 2; camera.x -= app.winWidth / 2;
camera.y = selectedStarSystem->y; camera.y = selectedStarSystem->y;
camera.y -= SCREEN_HEIGHT / 2; camera.y -= app.winHeight / 2;
} }
static void drawGalaxy(void) static void drawGalaxy(void)

View File

@ -157,8 +157,8 @@ void loadMission(char *filename)
battle.planetTexture = getAtlasImage(planet); battle.planetTexture = getAtlasImage(planet);
battle.fireStormTexture = getAtlasImage("gfx/misc/torelliFireStorm.png"); battle.fireStormTexture = getAtlasImage("gfx/misc/torelliFireStorm.png");
battle.planet.x = (SCREEN_WIDTH / 2) - (rand() % SCREEN_WIDTH) + (rand() % SCREEN_WIDTH); battle.planet.x = (app.winWidth / 2) - (rand() % app.winWidth) + (rand() % app.winWidth);
battle.planet.y = (SCREEN_HEIGHT / 2) - (rand() % SCREEN_HEIGHT) + (rand() % SCREEN_HEIGHT); battle.planet.y = (app.winHeight / 2) - (rand() % app.winHeight) + (rand() % app.winHeight);
if (strcmp(planet, "gfx/planets/star.png") != 0) if (strcmp(planet, "gfx/planets/star.png") != 0)
{ {
@ -170,8 +170,8 @@ void loadMission(char *filename)
if (getJSONValue(root, "largePlanet", 0)) if (getJSONValue(root, "largePlanet", 0))
{ {
battle.planet.x = (SCREEN_WIDTH / 2); battle.planet.x = (app.winWidth / 2);
battle.planet.y = (SCREEN_HEIGHT / 2); battle.planet.y = (app.winHeight / 2);
planetScale = 5; planetScale = 5;
} }

View File

@ -67,6 +67,7 @@ extern void stopMusic(void);
extern void updateChallengeMissions(void); extern void updateChallengeMissions(void);
extern void updateStarSystemMissions(void); extern void updateStarSystemMissions(void);
extern App app;
extern Battle battle; extern Battle battle;
extern Dev dev; extern Dev dev;
extern Entity *player; extern Entity *player;

View File

@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "../common.h" #include "../common.h"
#include "../json/cJSON.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 blit(AtlasImage *atlasImage, int x, int y, int centered);
extern void drawBackground(SDL_Texture *texture); extern void drawBackground(SDL_Texture *texture);

View File

@ -161,15 +161,15 @@ void drawControls(void)
r.w = 800; r.w = 800;
r.h = 650; r.h = 650;
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, 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_SetRenderDrawColor(app.renderer, 128, 128, 128, 255);
SDL_RenderDrawLine(app.renderer, r.x, r.y + 65, r.x + r.w, r.y + 65); 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((UI_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_LEFT, colors.white, ESCAPE_TEXT);
app.textWidth = r.w - 100; 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; app.textWidth = 0;

View File

@ -26,17 +26,17 @@ static PointF backgroundPoint[4];
void initGraphics(void) void initGraphics(void)
{ {
backgroundPoint[0].x = -SCREEN_WIDTH / 2; backgroundPoint[0].x = -app.winWidth / 2;
backgroundPoint[0].y = -SCREEN_HEIGHT / 2; backgroundPoint[0].y = -app.winHeight / 2;
backgroundPoint[1].x = SCREEN_WIDTH / 2; backgroundPoint[1].x = app.winWidth / 2;
backgroundPoint[1].y = -SCREEN_HEIGHT / 2; backgroundPoint[1].y = -app.winHeight / 2;
backgroundPoint[2].x = -SCREEN_WIDTH / 2; backgroundPoint[2].x = -app.winWidth / 2;
backgroundPoint[2].y = SCREEN_HEIGHT / 2; backgroundPoint[2].y = app.winHeight / 2;
backgroundPoint[3].x = SCREEN_WIDTH / 2; backgroundPoint[3].x = app.winWidth / 2;
backgroundPoint[3].y = SCREEN_HEIGHT / 2; backgroundPoint[3].y = app.winHeight / 2;
initColor(&colors.red, 255, 0, 0); initColor(&colors.red, 255, 0, 0);
initColor(&colors.orange, 255, 128, 0); initColor(&colors.orange, 255, 128, 0);
@ -75,11 +75,11 @@ void presentScene(void)
{ {
if (dev.debug) 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) 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) 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) 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.x = backgroundPoint[i].x;
dstRect.y = backgroundPoint[i].y; dstRect.y = backgroundPoint[i].y;
dstRect.w = SCREEN_WIDTH; dstRect.w = app.winWidth;
dstRect.h = SCREEN_HEIGHT; dstRect.h = app.winHeight;
SDL_RenderCopy(app.renderer, texture, NULL, &dstRect); 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) int isOnBattleScreen(int x, int y, int w, int h)
{ {
x -= (w / 2); x -= (w / 2);
x -= (SCREEN_WIDTH / 2); x -= (app.winWidth / 2);
x -= battle.camera.x; x -= battle.camera.x;
y -= (h / 2); y -= (h / 2);
y -= (SCREEN_HEIGHT / 2); y -= (app.winHeight / 2);
y -= battle.camera.y; y -= battle.camera.y;
w *= 2; w *= 2;
w += SCREEN_WIDTH; w += app.winWidth;
h *= 2; 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) void saveScreenshot(void)
@ -256,7 +256,7 @@ void saveScreenshot(void)
sprintf(filename, "/tmp/tbftss/%d.bmp", ++i); 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_RenderReadPixels(app.renderer, NULL, SDL_PIXELFORMAT_ARGB8888, sshot->pixels, sshot->pitch);
SDL_SaveBMP(sshot, filename); SDL_SaveBMP(sshot, filename);
SDL_FreeSurface(sshot); SDL_FreeSurface(sshot);

View File

@ -408,7 +408,7 @@ static void loadWidgetSet(char *filename)
if (w->rect.x == -1) if (w->rect.x == -1)
{ {
w->rect.x = SCREEN_WIDTH / 2; w->rect.x = UI_WIDTH / 2;
} }
switch (w->type) switch (w->type)
@ -553,7 +553,7 @@ void autoSizeWidgetButtons(char *group, int recenter)
if (recenter) if (recenter)
{ {
w->rect.x = (SCREEN_WIDTH / 2) - (w->rect.w / 2); w->rect.x = (UI_WIDTH / 2) - (w->rect.w / 2);
} }
} }
} }