Resolution update work.

This commit is contained in:
Steve 2018-12-13 07:59:31 +00:00
parent ff40191eab
commit 2430f866e0
13 changed files with 104 additions and 80 deletions

View File

@ -276,6 +276,8 @@ static void drawMenu(void)
if (app.modalDialog.type == MD_NONE)
{
SDL_SetRenderTarget(app.renderer, app.uiBuffer);
SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_BLEND);
SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 128);
SDL_RenderFillRect(app.renderer, NULL);
@ -283,8 +285,8 @@ static void drawMenu(void)
r.w = 400;
r.h = 400;
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);
@ -292,6 +294,8 @@ static void drawMenu(void)
SDL_RenderDrawRect(app.renderer, &r);
drawWidgets("inBattle");
SDL_SetRenderTarget(app.renderer, app.backBuffer);
}
}

View File

@ -452,13 +452,13 @@ static void drawNumFighters(void)
{
/* Allies */
setAtlasColor(150, 200, 255, 255);
blit(smallFighter, 400, 15, 0);
drawText(425, 11, 14, TA_LEFT, colors.white, battle.numAllies < 1000 ? "(%d)" : "(999+)", battle.numAllies);
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);
/* Enemies */
setAtlasColor(255, 100, 100, 255);
blit(smallFighter, SCREEN_WIDTH - 410, 15, 0);
drawText(SCREEN_WIDTH - 420, 11, 14, TA_RIGHT, colors.white, !battle.unlimitedEnemies ? "(%d)" : "(999+)", battle.numEnemies);
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);
}
static void drawObjectives(void)
@ -469,12 +469,12 @@ static void drawObjectives(void)
if (!game.currentMission->challengeData.isChallenge)
{
blit(objectives, (SCREEN_WIDTH / 2) - 50, 14, 0);
drawText(SCREEN_WIDTH / 2, 10, 16, TA_CENTER, colors.white, "%d / %d", battle.numObjectivesComplete, (battle.numObjectivesTotal + battle.numConditions));
blit(objectives, (app.winWidth / 2) - 50, 14, 0);
drawText(app.winWidth / 2, 10, 16, TA_CENTER, colors.white, "%d / %d", battle.numObjectivesComplete, (battle.numObjectivesTotal + battle.numConditions));
if (battle.isEpic && battle.epicLives > 0)
{
drawText(SCREEN_WIDTH / 2, 35, 14, TA_CENTER, colors.white, REMAINING_PILOTS_TEXT, battle.epicLives - 1);
drawText(app.winWidth / 2, 35, 14, TA_CENTER, colors.white, REMAINING_PILOTS_TEXT, battle.epicLives - 1);
}
}
else
@ -483,46 +483,46 @@ static void drawObjectives(void)
{
timeRemaining = game.currentMission->challengeData.timeLimit - battle.stats[STAT_TIME];
blit(clockIcon, (SCREEN_WIDTH / 2) - 50, 14, 0);
drawText(SCREEN_WIDTH / 2, 10, 16, TA_CENTER, (timeRemaining < 11 * FPS) ? colors.red : colors.white, timeToString(timeRemaining, 0));
blit(clockIcon, (app.winWidth / 2) - 50, 14, 0);
drawText(app.winWidth / 2, 10, 16, TA_CENTER, (timeRemaining < 11 * FPS) ? colors.red : colors.white, timeToString(timeRemaining, 0));
}
else
{
drawText(SCREEN_WIDTH / 2, 10, 16, TA_CENTER, colors.white, timeToString(battle.stats[STAT_TIME], 0));
blit(clockIcon, (SCREEN_WIDTH / 2) - 50, 14, 0);
drawText(app.winWidth / 2, 10, 16, TA_CENTER, colors.white, timeToString(battle.stats[STAT_TIME], 0));
blit(clockIcon, (app.winWidth / 2) - 50, 14, 0);
}
if (game.currentMission->challengeData.killLimit)
{
drawText(SCREEN_WIDTH / 2, 35, 14, TA_CENTER, colors.white, "%d / %d", battle.stats[STAT_ENEMIES_KILLED_PLAYER] + battle.stats[STAT_ENEMIES_DISABLED], game.currentMission->challengeData.killLimit);
drawText(app.winWidth / 2, 35, 14, TA_CENTER, colors.white, "%d / %d", battle.stats[STAT_ENEMIES_KILLED_PLAYER] + battle.stats[STAT_ENEMIES_DISABLED], game.currentMission->challengeData.killLimit);
}
else if (game.currentMission->challengeData.itemLimit)
{
drawText(SCREEN_WIDTH / 2, 35, 14, TA_CENTER, colors.white, "%d / %d", battle.stats[STAT_ITEMS_COLLECTED] + battle.stats[STAT_ITEMS_COLLECTED_PLAYER], game.currentMission->challengeData.itemLimit);
drawText(app.winWidth / 2, 35, 14, TA_CENTER, colors.white, "%d / %d", battle.stats[STAT_ITEMS_COLLECTED] + battle.stats[STAT_ITEMS_COLLECTED_PLAYER], game.currentMission->challengeData.itemLimit);
}
else if (game.currentMission->challengeData.playerItemLimit)
{
drawText(SCREEN_WIDTH / 2, 35, 14, TA_CENTER, colors.white, "%d / %d", battle.stats[STAT_ITEMS_COLLECTED_PLAYER], game.currentMission->challengeData.playerItemLimit);
drawText(app.winWidth / 2, 35, 14, TA_CENTER, colors.white, "%d / %d", battle.stats[STAT_ITEMS_COLLECTED_PLAYER], game.currentMission->challengeData.playerItemLimit);
}
else if (game.currentMission->challengeData.rescueLimit)
{
drawText(SCREEN_WIDTH / 2, 35, 14, TA_CENTER, colors.white, "%d / %d", battle.stats[STAT_CIVILIANS_RESCUED], game.currentMission->challengeData.rescueLimit);
drawText(app.winWidth / 2, 35, 14, TA_CENTER, colors.white, "%d / %d", battle.stats[STAT_CIVILIANS_RESCUED], game.currentMission->challengeData.rescueLimit);
}
else if (game.currentMission->challengeData.disableLimit)
{
drawText(SCREEN_WIDTH / 2, 35, 14, TA_CENTER, colors.white, "%d / %d", battle.stats[STAT_ENEMIES_DISABLED], game.currentMission->challengeData.disableLimit);
drawText(app.winWidth / 2, 35, 14, TA_CENTER, colors.white, "%d / %d", battle.stats[STAT_ENEMIES_DISABLED], game.currentMission->challengeData.disableLimit);
}
else if (game.currentMission->challengeData.surrenderLimit)
{
drawText(SCREEN_WIDTH / 2, 35, 14, TA_CENTER, colors.white, "%d / %d", battle.stats[STAT_ENEMIES_SURRENDERED], game.currentMission->challengeData.surrenderLimit);
drawText(app.winWidth / 2, 35, 14, TA_CENTER, colors.white, "%d / %d", battle.stats[STAT_ENEMIES_SURRENDERED], game.currentMission->challengeData.surrenderLimit);
}
else if (game.currentMission->challengeData.waypointLimit)
{
drawText(SCREEN_WIDTH / 2, 35, 14, TA_CENTER, colors.white, "%d / %d", battle.stats[STAT_WAYPOINTS_VISITED], game.currentMission->challengeData.waypointLimit);
drawText(app.winWidth / 2, 35, 14, TA_CENTER, colors.white, "%d / %d", battle.stats[STAT_WAYPOINTS_VISITED], game.currentMission->challengeData.waypointLimit);
}
else if (player->flags & EF_MUST_DISABLE)
{
drawText(SCREEN_WIDTH / 2, 35, 14, TA_CENTER, colors.white, SYSTEM_POWER_TEXT, player->systemPower);
drawText(app.winWidth / 2, 35, 14, TA_CENTER, colors.white, SYSTEM_POWER_TEXT, player->systemPower);
}
}
}
@ -552,18 +552,18 @@ static void drawDistancesInfo(void)
{
if (player->target->flags & EF_AI_LEADER && player->target->speed > 0)
{
drawText(SCREEN_WIDTH - 15, y, 18, TA_RIGHT, colors.red, LEADER_DIST_TEXT, player->target->name);
drawText(app.winWidth - 15, y, 18, TA_RIGHT, colors.red, LEADER_DIST_TEXT, player->target->name);
}
else
{
drawText(SCREEN_WIDTH - 15, y, 18, TA_RIGHT, colors.red, player->target->name);
drawText(app.winWidth - 15, y, 18, TA_RIGHT, colors.red, player->target->name);
}
y += 30;
distance = distanceToKM(player->x, player->y, player->target->x, player->target->y);
drawText(SCREEN_WIDTH - 15, y, 14, TA_RIGHT, colors.red, TARGET_DIST_TEXT, distance);
drawText(app.winWidth - 15, y, 14, TA_RIGHT, colors.red, TARGET_DIST_TEXT, distance);
y += 25;
}
@ -572,7 +572,7 @@ static void drawDistancesInfo(void)
{
distance = distanceToKM(player->x, player->y, battle.missionTarget->x, battle.missionTarget->y);
drawText(SCREEN_WIDTH - 15, y, 14, TA_RIGHT, colors.green, OBJECTIVE_DIST_TEXT, distance);
drawText(app.winWidth - 15, y, 14, TA_RIGHT, colors.green, OBJECTIVE_DIST_TEXT, distance);
y += 25;
}
@ -581,7 +581,7 @@ static void drawDistancesInfo(void)
{
distance = distanceToKM(player->x, player->y, battle.jumpgate->x, battle.jumpgate->y);
drawText(SCREEN_WIDTH - 15, y, 14, TA_RIGHT, colors.yellow, JUMPGATE_DIST_TEXT, distance);
drawText(app.winWidth - 15, y, 14, TA_RIGHT, colors.yellow, JUMPGATE_DIST_TEXT, distance);
y += 25;
}
@ -590,7 +590,7 @@ static void drawDistancesInfo(void)
{
distance = distanceToKM(player->x, player->y, battle.messageSpeaker->x, battle.messageSpeaker->y);
drawText(SCREEN_WIDTH - 15, y, 14, TA_RIGHT, colors.white, "%s: %.2fkm", battle.messageSpeaker->name, distance);
drawText(app.winWidth - 15, y, 14, TA_RIGHT, colors.white, "%s: %.2fkm", battle.messageSpeaker->name, distance);
y += 25;
}
@ -599,7 +599,7 @@ static void drawDistancesInfo(void)
static void drawHudMessages(void)
{
HudMessage *hudMessage;
int y = SCREEN_HEIGHT - 25;
int y = app.winHeight - 25;
for (hudMessage = hudMessageHead.next ; hudMessage != NULL ; hudMessage = hudMessage->next)
{
@ -620,17 +620,17 @@ static void drawPlayerSelect(void)
blit(targetCircle, player->x - battle.camera.x, player->y - battle.camera.y, 1);
drawText(SCREEN_WIDTH / 2, 500, 28, TA_CENTER, colors.white, NEW_FIGHTER_TEXT);
drawText(app.winWidth / 2, 500, 28, TA_CENTER, colors.white, NEW_FIGHTER_TEXT);
if (player->health > 0)
{
drawText(SCREEN_WIDTH / 2, 540, 20, TA_CENTER, colors.white, "%s (%d%% / %d%%)", player->defName, getPercent(player->health, player->maxHealth), getPercent(player->shield, player->maxShield));
drawText(app.winWidth / 2, 540, 20, TA_CENTER, colors.white, "%s (%d%% / %d%%)", player->defName, getPercent(player->health, player->maxHealth), getPercent(player->shield, player->maxShield));
}
setAtlasColor(255, 255, 255, 255);
blit(arrowLeft, (SCREEN_WIDTH / 2) - 200, 520, 1);
blit(arrowRight, (SCREEN_WIDTH / 2) + 200, 520, 1);
blit(arrowLeft, (app.winWidth / 2) - 200, 520, 1);
blit(arrowRight, (app.winWidth / 2) + 200, 520, 1);
}
static void drawSuspicionLevel(void)
@ -641,10 +641,10 @@ static void drawSuspicionLevel(void)
{
battle.suspicionLevel = MIN(battle.suspicionLevel, MAX_SUSPICION_LEVEL);
drawText((SCREEN_WIDTH / 2) - 150, SCREEN_HEIGHT - 60, 18, TA_RIGHT, colors.white, SUSPICION_TEXT);
drawText((app.winWidth / 2) - 150, app.winHeight - 60, 18, TA_RIGHT, colors.white, SUSPICION_TEXT);
r.x = (SCREEN_WIDTH / 2) - 140;
r.y = SCREEN_HEIGHT - 58;
r.x = (app.winWidth / 2) - 140;
r.y = app.winHeight - 58;
r.w = 400;
r.h = 20;
@ -678,7 +678,7 @@ static void drawSuspicionLevel(void)
SDL_RenderFillRect(app.renderer, &r);
drawText(r.x + r.w + 7, SCREEN_HEIGHT - 57, 12, TA_LEFT, colors.white, "%d%%", (battle.suspicionLevel > 0) ? getPercent(battle.suspicionLevel, MAX_SUSPICION_LEVEL) : 0);
drawText(r.x + r.w + 7, app.winHeight - 57, 12, TA_LEFT, colors.white, "%d%%", (battle.suspicionLevel > 0) ? getPercent(battle.suspicionLevel, MAX_SUSPICION_LEVEL) : 0);
}
}
@ -686,7 +686,7 @@ static void drawMissileWarning(void)
{
if (battle.incomingMissile && battle.stats[STAT_TIME] % FPS < 40)
{
drawText(SCREEN_WIDTH / 2, SCREEN_HEIGHT - 60, 18, TA_CENTER, colors.red, WARNING_TEXT);
drawText(app.winWidth / 2, app.winHeight - 60, 18, TA_CENTER, colors.red, WARNING_TEXT);
}
}

View File

@ -131,7 +131,7 @@ void drawMessageBox(void)
r.y = 50;
r.w = 650;
r.h = msg->height + 40;
r.x = (SCREEN_WIDTH - r.w) / 2;
r.x = (app.winWidth - r.w) / 2;
SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_BLEND);

View File

@ -56,6 +56,8 @@ void initMissionInfo(void)
void drawMissionInfo(void)
{
SDL_SetRenderTarget(app.renderer, app.uiBuffer);
switch (battle.status)
{
case MS_START:
@ -96,6 +98,8 @@ void drawMissionInfo(void)
}
break;
}
SDL_SetRenderTarget(app.renderer, app.backBuffer);
}
static void drawMissionSummary(AtlasImage *header)

View File

@ -42,9 +42,9 @@ void drawRadar(void)
Entity *e;
int dist, inRange, blink;
blit(radarTexture, SCREEN_WIDTH - 85, SCREEN_HEIGHT - 85, 1);
blit(radarTexture, app.winWidth - 85, app.winHeight - 85, 1);
drawText(SCREEN_WIDTH - 160, SCREEN_HEIGHT - 30, 14, TA_RIGHT, colors.white, "%dx", battle.radarRange + 1);
drawText(app.winWidth - 160, app.winHeight - 30, 14, TA_RIGHT, colors.white, "%dx", battle.radarRange + 1);
r.w = r.h = 3;
@ -60,8 +60,8 @@ void drawRadar(void)
if (inRange)
{
r.x = SCREEN_WIDTH - 85;
r.y = SCREEN_HEIGHT - 85;
r.x = app.winWidth - 85;
r.y = app.winHeight - 85;
r.x -= (player->x - e->x) / radarRanges[battle.radarRange];
r.y -= (player->y - e->y) / radarRanges[battle.radarRange];
@ -110,40 +110,40 @@ void drawRadarRangeWarning(void)
{
int x, y, leaving;
x = (int)player->x / (SCREEN_WIDTH / 2);
y = (int)player->y / (SCREEN_HEIGHT / 2);
x = (int)player->x / (app.winWidth / 2);
y = (int)player->y / (app.winHeight / 2);
leaving = 0;
if (x <= 2 && player->dx < 0)
{
blitRotated(radarWarningTexture, SCREEN_WIDTH - 85, SCREEN_HEIGHT - 85, 270);
blitRotated(radarWarningTexture, app.winWidth - 85, app.winHeight - 85, 270);
leaving = 1;
}
if (y <= 3 && player->dy < 0)
{
blitRotated(radarWarningTexture, SCREEN_WIDTH - 85, SCREEN_HEIGHT - 85, 0);
blitRotated(radarWarningTexture, app.winWidth - 85, app.winHeight - 85, 0);
leaving = 1;
}
if (x >= BATTLE_AREA_CELLS - 2 && player->dx > 0)
{
blitRotated(radarWarningTexture, SCREEN_WIDTH - 85, SCREEN_HEIGHT - 85, 90);
blitRotated(radarWarningTexture, app.winWidth - 85, app.winHeight - 85, 90);
leaving = 1;
}
if (y >= BATTLE_AREA_CELLS - 3 && player->dy > 0)
{
blitRotated(radarWarningTexture, SCREEN_WIDTH - 85, SCREEN_HEIGHT - 85, 180);
blitRotated(radarWarningTexture, app.winWidth - 85, app.winHeight - 85, 180);
leaving = 1;
}
if (leaving && battle.stats[STAT_TIME] % FPS < 40)
{
drawText(SCREEN_WIDTH / 2, SCREEN_HEIGHT - 30, 14, TA_CENTER, colors.white, CAUTION_TEXT);
drawText(app.winWidth / 2, app.winHeight - 30, 14, TA_CENTER, colors.white, CAUTION_TEXT);
}
}

View File

@ -30,8 +30,8 @@ void initStars(void)
for (i = 0 ; i < MAX_STARS ; i++)
{
stars[i].x = rand() % SCREEN_WIDTH;
stars[i].y = rand() % SCREEN_HEIGHT;
stars[i].x = rand() % app.winWidth;
stars[i].y = rand() % app.winHeight;
stars[i].speed = 5 + rand() % 35;
stars[i].speed *= 0.1;
@ -47,8 +47,8 @@ void doStars(float dx, float dy)
stars[i].x -= (dx * stars[i].speed);
stars[i].y -= (dy * stars[i].speed);
stars[i].x = mod(stars[i].x, SCREEN_WIDTH - 1);
stars[i].y = mod(stars[i].y, SCREEN_HEIGHT - 1);
stars[i].x = mod(stars[i].x, app.winWidth - 1);
stars[i].y = mod(stars[i].y, app.winHeight - 1);
}
}

View File

@ -243,7 +243,7 @@ static void doChallenges(void)
for (c = game.challengeMissionHead.next ; c != NULL ; c = c->next)
{
if (i >= startIndex && i < end && app.mouse.button[SDL_BUTTON_LEFT] && collision(app.mouse.x, app.mouse.y, 3, 3, c->rect.x, c->rect.y, c->rect.w, c->rect.h))
if (i >= startIndex && i < end && app.mouse.button[SDL_BUTTON_LEFT] && collision(app.uiMouse.x, app.uiMouse.y, 3, 3, c->rect.x, c->rect.y, c->rect.w, c->rect.h))
{
if (c->available)
{
@ -308,6 +308,8 @@ static void draw(void)
drawStars();
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);
@ -340,6 +342,8 @@ static void draw(void)
drawFighterDatabase();
break;
}
SDL_SetRenderTarget(app.renderer, app.backBuffer);
}
static void drawChallenges(void)

View File

@ -640,8 +640,8 @@ static void drawStarSystemDetail(void)
r.w = 900;
r.h = 600;
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_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_BLEND);
SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 225);
@ -654,7 +654,7 @@ static void drawStarSystemDetail(void)
y = 70;
drawText(SCREEN_WIDTH / 2, y, 28, TA_CENTER, colors.cyan, selectedStarSystem->name);
drawText(UI_WIDTH / 2, y, 28, TA_CENTER, colors.cyan, selectedStarSystem->name);
SDL_RenderDrawLine(app.renderer, r.x, 120, r.x + r.w - 1, 120);
@ -710,15 +710,15 @@ static void drawStarSystemDetail(void)
if (game.currentMission->completed)
{
drawText(525, SCREEN_HEIGHT - 95, 18, TA_LEFT, colors.green, COMPLETED_TEXT);
drawText(525, UI_HEIGHT - 95, 18, TA_LEFT, colors.green, COMPLETED_TEXT);
}
else if (game.currentMission->epic)
{
drawText(525, SCREEN_HEIGHT - 95, 18, TA_LEFT, colors.yellow, EPIC_TEXT);
drawText(525, UI_HEIGHT - 95, 18, TA_LEFT, colors.yellow, EPIC_TEXT);
}
else if (game.currentMission->isOptional)
{
drawText(525, SCREEN_HEIGHT - 95, 18, TA_LEFT, colors.cyan, OPTIONAL_TEXT);
drawText(525, UI_HEIGHT - 95, 18, TA_LEFT, colors.cyan, OPTIONAL_TEXT);
}
startMissionButton->enabled = (!game.currentMission->completed || selectedStarSystem->type == SS_SOL || campaignComplete);
@ -805,6 +805,8 @@ static void startMission(void)
static void drawMenu(void)
{
SDL_Rect r;
SDL_SetRenderTarget(app.renderer, app.uiBuffer);
SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_BLEND);
SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 128);
@ -813,8 +815,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);
@ -822,6 +824,8 @@ static void drawMenu(void)
SDL_RenderDrawRect(app.renderer, &r);
drawWidgets("galacticMap");
SDL_SetRenderTarget(app.renderer, app.backBuffer);
}
static void resume(void)

View File

@ -109,27 +109,27 @@ void drawFighterDatabase(void)
r.w = 700;
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, DB_TEXT);
drawText(UI_WIDTH / 2, 50, 28, TA_CENTER, colors.white, DB_TEXT);
drawText(SCREEN_WIDTH / 2, 90, 16, TA_CENTER, colors.lightGrey, PAGE_TEXT, page + 1, (int)maxPages);
drawText(UI_WIDTH / 2, 90, 16, TA_CENTER, colors.lightGrey, PAGE_TEXT, page + 1, (int)maxPages);
fighter = dbFighters[page];
drawText(SCREEN_WIDTH / 2, 130, 28, TA_CENTER, colors.white, fighter->name);
drawText(UI_WIDTH / 2, 130, 28, TA_CENTER, colors.white, fighter->name);
blitRotated(fighter->texture, r.x + (r.w / 2), 250, rotation);
if (fighter->flags & EF_COMMON_FIGHTER)
{
drawText(SCREEN_WIDTH / 2, 170, 18, TA_CENTER, colors.darkGrey, COMMON_TEXT);
drawText(UI_WIDTH / 2, 170, 18, TA_CENTER, colors.darkGrey, COMMON_TEXT);
drawText(r.x + (r.w / 2), 290, 18, TA_CENTER, colors.lightGrey, "%s: %d", DESTROYED_TEXT, numDestroyed);
}

View File

@ -140,17 +140,17 @@ void drawStats(void)
r.w = 500;
r.h = 600;
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, 70, 28, TA_CENTER, colors.white, STATS_TEXT);
drawText(UI_WIDTH / 2, 70, 28, TA_CENTER, colors.white, STATS_TEXT);
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);
SDL_SetRenderDrawColor(app.renderer, 128, 128, 128, 255);
SDL_RenderDrawLine(app.renderer, r.x, 150, r.x + r.w, 150);

View File

@ -142,17 +142,17 @@ void drawTrophies(void)
r.w = boxWidth;
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, 40, 28, TA_CENTER, colors.white, TROPHIES_TEXT);
drawText(SCREEN_WIDTH / 2, 83, 16, TA_CENTER, colors.lightGrey, AWARDED_TEXT, awarded, total);
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, TROPHIES_TEXT);
drawText(UI_WIDTH / 2, 83, 16, TA_CENTER, colors.lightGrey, AWARDED_TEXT, awarded, total);
drawText(UI_WIDTH / 2, 110, 16, TA_CENTER, colors.lightGrey, PAGE_TEXT, page + 1, (int)maxPages);
SDL_SetRenderDrawColor(app.renderer, 128, 128, 128, 255);
SDL_RenderDrawLine(app.renderer, r.x, 150, r.x + r.w, 150);

View File

@ -151,6 +151,8 @@ void drawControls(void)
{
int i;
SDL_Rect r;
SDL_SetRenderTarget(app.renderer, app.uiBuffer);
SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_BLEND);
SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 128);
@ -201,6 +203,8 @@ void drawControls(void)
app.textWidth = 0;
drawWidgets("controls");
SDL_SetRenderTarget(app.renderer, app.backBuffer);
}
static void restoreDefaults(void)

View File

@ -100,6 +100,8 @@ void doModalDialog(void)
void drawModalDialog(void)
{
SDL_Rect r;
SDL_SetRenderTarget(app.renderer, app.uiBuffer);
app.textWidth = 700;
@ -109,8 +111,8 @@ void drawModalDialog(void)
r.w = 800;
r.h = getWrappedTextHeight(app.modalDialog.message, 24) + 100;
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);
ok->rect.y = okCancelOK->rect.y = okCancelCancel->rect.y = r.y + r.h - 50;
@ -122,7 +124,7 @@ void drawModalDialog(void)
SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_NONE);
drawText(SCREEN_WIDTH / 2, r.y + 10, 24, TA_CENTER, colors.white, app.modalDialog.message);
drawText(UI_WIDTH / 2, r.y + 10, 24, TA_CENTER, colors.white, app.modalDialog.message);
switch (app.modalDialog.type)
{
@ -136,4 +138,6 @@ void drawModalDialog(void)
}
app.textWidth = 0;
SDL_SetRenderTarget(app.renderer, app.backBuffer);
}