From d54273821dca9afd56820677d14053bfe7a0d6da Mon Sep 17 00:00:00 2001 From: Steve Date: Tue, 19 Jul 2016 09:26:19 +0100 Subject: [PATCH] Start of i18n look up optimisations. --- src/battle/bullets.c | 5 +++- src/battle/hud.c | 43 ++++++++++++++++++++++++++-------- src/battle/missionInfo.c | 13 +++++++--- src/battle/radar.c | 5 +++- src/challenges/challengeHome.c | 29 +++++++++++++++++------ src/galaxy/galacticMap.c | 29 +++++++++++++++++------ src/game/stats.c | 9 +++++-- src/game/trophies.c | 17 ++++++++++---- src/system/controls.c | 17 ++++++++++---- src/system/options.c | 14 ++++++----- 10 files changed, 136 insertions(+), 45 deletions(-) diff --git a/src/battle/bullets.c b/src/battle/bullets.c index 2e9b241..81884b4 100644 --- a/src/battle/bullets.c +++ b/src/battle/bullets.c @@ -30,6 +30,7 @@ static Bullet bulletDef[BT_MAX]; static Bullet **bulletsToDraw; static int incomingMissile; static int drawCapacity; +static char *WARNING_TEXT; void initBullets(void) { @@ -39,6 +40,8 @@ void initBullets(void) bulletsToDraw = malloc(sizeof(Bullet*) * drawCapacity); memset(bulletsToDraw, 0, sizeof(Bullet*) * drawCapacity); + + WARNING_TEXT = _("WARNING: INCOMING MISSILE!"); } void initBulletDefs(void) @@ -294,7 +297,7 @@ void drawBullets(void) if (incomingMissile && battle.stats[STAT_TIME] % FPS < 40) { - drawText(SCREEN_WIDTH / 2, SCREEN_HEIGHT - 60, 18, TA_CENTER, colors.red, _("WARNING: INCOMING MISSILE!")); + drawText(SCREEN_WIDTH / 2, SCREEN_HEIGHT - 60, 18, TA_CENTER, colors.red, WARNING_TEXT); } } diff --git a/src/battle/hud.c b/src/battle/hud.c index f8df36c..818db05 100644 --- a/src/battle/hud.c +++ b/src/battle/hud.c @@ -49,6 +49,17 @@ static SDL_Texture *clock; static SDL_Texture *objectives; static int numMessages; static const char *gunName[BT_MAX]; +static char *MISSILES_TEXT; +static char *TARGET_TEXT; +static char *NONE_TEXT; +static char *COMBINED_TEXT; +static char *SYSTEM_POWER_TEXT; +static char *LEADER_DIST_TEXT; +static char *TARGET_DIST_TEXT; +static char *OBJECTIVE_DIST_TEXT; +static char *JUMPGATE_DIST_TEXT; +static char *NEW_FIGHTER_TEXT; +static char *SUSPICION_TEXT; void initHud(void) { @@ -63,6 +74,18 @@ void initHud(void) gunName[BT_ROCKET] = _("Rockets"); gunName[BT_MISSILE] = _("Missiles"); + MISSILES_TEXT = _("Missiles (%d)"); + TARGET_TEXT = _("Target: %.2fkm"); + NONE_TEXT = _("(None)"); + COMBINED_TEXT = _("(Combined Guns)"); + SYSTEM_POWER_TEXT = _("System Power : %d%%"); + LEADER_DIST_TEXT = _("%s (Leader)"); + TARGET_DIST_TEXT = _("Target: %.2fkm"); + OBJECTIVE_DIST_TEXT = _("Objective: %.2fkm"); + JUMPGATE_DIST_TEXT = _("Jumpgate: %.2fkm"); + NEW_FIGHTER_TEXT = _("SELECT NEW FIGHTER"); + SUSPICION_TEXT = _("Suspicion"); + targetPointer = getTexture("gfx/hud/targetPointer.png"); targetCircle = getTexture("gfx/hud/targetCircle.png"); smallFighter = getTexture("gfx/hud/smallFighter.png"); @@ -320,15 +343,15 @@ static void drawWeaponInfo(void) } else { - drawText(30, 70, 14, TA_LEFT, colors.white, _("(None)")); + drawText(30, 70, 14, TA_LEFT, colors.white, NONE_TEXT); } } else { - drawText(30, 70, 14, TA_LEFT, colors.white, _("(Combined Guns)")); + drawText(30, 70, 14, TA_LEFT, colors.white, COMBINED_TEXT); } - drawText(280, 70, 14, TA_RIGHT, colors.white, _("Missiles (%d)"), player->missiles); + drawText(280, 70, 14, TA_RIGHT, colors.white, MISSILES_TEXT, player->missiles); } static void drawPlayerTargeter(void) @@ -482,7 +505,7 @@ static void drawObjectives(void) } else if (player->flags & EF_MUST_DISABLE) { - drawText(SCREEN_WIDTH / 2, 35, 14, TA_CENTER, colors.white, _("System Power : %d%%"), player->systemPower); + drawText(SCREEN_WIDTH / 2, 35, 14, TA_CENTER, colors.white, SYSTEM_POWER_TEXT, player->systemPower); } } } @@ -512,7 +535,7 @@ 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, _("%s (Leader)"), player->target->name); + drawText(SCREEN_WIDTH - 15, y, 18, TA_RIGHT, colors.red, LEADER_DIST_TEXT, player->target->name); } else { @@ -523,7 +546,7 @@ static void drawDistancesInfo(void) distance = distanceToKM(player->x, player->y, player->target->x, player->target->y); - drawText(SCREEN_WIDTH - 15, y, 14, TA_RIGHT, colors.red, _("Target: %.2fkm"), distance); + drawText(SCREEN_WIDTH - 15, y, 14, TA_RIGHT, colors.red, TARGET_DIST_TEXT, distance); y += 25; } @@ -532,7 +555,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: %.2fkm"), distance); + drawText(SCREEN_WIDTH - 15, y, 14, TA_RIGHT, colors.green, OBJECTIVE_DIST_TEXT, distance); y += 25; } @@ -541,7 +564,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: %.2fkm"), distance); + drawText(SCREEN_WIDTH - 15, y, 14, TA_RIGHT, colors.yellow, JUMPGATE_DIST_TEXT, distance); y += 25; } @@ -580,7 +603,7 @@ 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, _("SELECT NEW FIGHTER")); + drawText(SCREEN_WIDTH / 2, 500, 28, TA_CENTER, colors.white, NEW_FIGHTER_TEXT); if (player->health > 0) { @@ -597,7 +620,7 @@ 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")); + drawText((SCREEN_WIDTH / 2) - 150, SCREEN_HEIGHT - 60, 18, TA_RIGHT, colors.white, SUSPICION_TEXT); r.x = (SCREEN_WIDTH / 2) - 140; r.y = SCREEN_HEIGHT - 58; diff --git a/src/battle/missionInfo.c b/src/battle/missionInfo.c index 0402dbd..2b705a9 100644 --- a/src/battle/missionInfo.c +++ b/src/battle/missionInfo.c @@ -30,6 +30,9 @@ static SDL_Texture *missionCompleteTexture; static SDL_Texture *missionFailedTexture; static SDL_Texture *timeUpTexture; static const char *objectiveStatus[OS_MAX]; +static char *OBJECTIVES_TEXT; +static char *NONE_TEXT; +static char *TIME_LIMIT_TEXT; void initMissionInfo(void) { @@ -40,6 +43,10 @@ void initMissionInfo(void) objectiveStatus[OS_FAILED] = _("Failed"); objectiveStatus[OS_CONDITION] = _("Condition"); + OBJECTIVES_TEXT = _("OBJECTIVES"); + NONE_TEXT = _("(none)"); + TIME_LIMIT_TEXT = _("Time Limit: %s"); + missionStartTexture = !isChallenge ? getTexture("gfx/battle/missionStart.png") : getTexture("gfx/battle/challengeStart.png"); missionInProgressTexture = !isChallenge ? getTexture("gfx/battle/missionInProgress.png") : getTexture("gfx/battle/challengeInProgress.png"); missionCompleteTexture = !isChallenge ? getTexture("gfx/battle/missionComplete.png") : getTexture("gfx/battle/challengeComplete.png"); @@ -116,7 +123,7 @@ static void drawObjectives(void) SDL_Color color; int y = 215; - drawText(SCREEN_WIDTH / 2, y, 28, TA_CENTER, colors.white, _("OBJECTIVES")); + drawText(SCREEN_WIDTH / 2, y, 28, TA_CENTER, colors.white, OBJECTIVES_TEXT); y += 10; @@ -156,7 +163,7 @@ static void drawObjectives(void) { y += 50; - drawText(SCREEN_WIDTH / 2, y, 22, TA_CENTER, colors.white, _("(none)")); + drawText(SCREEN_WIDTH / 2, y, 22, TA_CENTER, colors.white, NONE_TEXT); } y += 75; @@ -176,7 +183,7 @@ static void drawChallenges(void) { y+= 50; - drawText(SCREEN_WIDTH / 2, y, 20, TA_CENTER, colors.white, _("Time Limit: %s"), timeToString(game.currentMission->challengeData.timeLimit, 0)); + drawText(SCREEN_WIDTH / 2, y, 20, TA_CENTER, colors.white, TIME_LIMIT_TEXT, timeToString(game.currentMission->challengeData.timeLimit, 0)); } y += 25; diff --git a/src/battle/radar.c b/src/battle/radar.c index c4a8afa..ab4c9d3 100644 --- a/src/battle/radar.c +++ b/src/battle/radar.c @@ -23,6 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static SDL_Texture *radarTexture; static SDL_Texture *radarWarningTexture; static int radarRanges[] = {20, 40, 60}; +static char *CAUTION_TEXT; void initRadar(void) { @@ -31,6 +32,8 @@ void initRadar(void) /* medium range by default */ battle.radarRange = 1; + + CAUTION_TEXT = _("Caution: Leaving battle area - turn around."); } void drawRadar(void) @@ -141,6 +144,6 @@ void drawRadarRangeWarning(void) if (leaving && battle.stats[STAT_TIME] % FPS < 40) { - drawText(SCREEN_WIDTH / 2, SCREEN_HEIGHT - 30, 14, TA_CENTER, colors.white, _("Caution: Leaving battle area - turn around.")); + drawText(SCREEN_WIDTH / 2, SCREEN_HEIGHT - 30, 14, TA_CENTER, colors.white, CAUTION_TEXT); } } diff --git a/src/challenges/challengeHome.c b/src/challenges/challengeHome.c index 3de4305..279f486 100644 --- a/src/challenges/challengeHome.c +++ b/src/challenges/challengeHome.c @@ -54,6 +54,13 @@ static char restrictions[MAX_DESCRIPTION_LENGTH]; static int hasRestrictions; static Widget *prev; static Widget *next; +static char *CHALLENGES_TEXT; +static char *COMPLETED_TEXT; +static char *PAGE_TEXT; +static char *LOCKED_TEXT; +static char *CRAFT_TEXT; +static char *TIME_TEXT; +static char *RESTRICTIONS_TEXT; void initChallengeHome(void) { @@ -72,6 +79,14 @@ void initChallengeHome(void) awardStatsTrophies(); app.saveGame = 1; + + CHALLENGES_TEXT = _("Challenges"); + COMPLETED_TEXT = _("Completed : %d / %d"); + PAGE_TEXT = _("Page : %d / %d"); + LOCKED_TEXT = _("[Locked]"); + CRAFT_TEXT = _("Craft: %s"); + TIME_TEXT = _("Time Limit: %s"); + RESTRICTIONS_TEXT = _("Restrictions: %s"); app.delegate.logic = &logic; app.delegate.draw = &draw; @@ -283,9 +298,9 @@ static void draw(void) drawStars(); - drawText(SCREEN_WIDTH / 2, 40, 28, TA_CENTER, colors.white, _("Challenges")); - drawText(SCREEN_WIDTH / 2, 83, 16, TA_CENTER, colors.lightGrey, _("Completed : %d / %d"), game.completedChallenges, game.totalChallenges); - drawText(SCREEN_WIDTH / 2, 110, 16, TA_CENTER, colors.lightGrey, _("Page : %d / %d"), page + 1, (int)maxPages); + 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); drawChallenges(); @@ -352,7 +367,7 @@ static void drawChallenges(void) } else { - drawText(r.x + (r.w / 2), r.y + r.w + 5, 18, TA_CENTER, colors.lightGrey, _("[Locked]")); + drawText(r.x + (r.w / 2), r.y + r.w + 5, 18, TA_CENTER, colors.lightGrey, LOCKED_TEXT); } r.x += 150; @@ -387,11 +402,11 @@ static void drawChallenges(void) r.y -= 50; c = game.currentMission->challengeData.challenges[0]; - drawText((SCREEN_WIDTH / 2) - 25, SCREEN_HEIGHT - r.y, 18, TA_RIGHT, colors.white, _("Craft: %s"), game.currentMission->craft); + 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)); r.y -= 30; - drawText((SCREEN_WIDTH / 2) - 25, SCREEN_HEIGHT - r.y, 18, TA_RIGHT, colors.white, _("Time Limit: %s"), timeLimit); + drawText((SCREEN_WIDTH / 2) - 25, SCREEN_HEIGHT - r.y, 18, TA_RIGHT, colors.white, TIME_TEXT, timeLimit); c = game.currentMission->challengeData.challenges[1]; if (c) @@ -400,7 +415,7 @@ static void drawChallenges(void) } r.y -= 30; - drawText((SCREEN_WIDTH / 2) - 25, SCREEN_HEIGHT - r.y, 18, TA_RIGHT, hasRestrictions ? colors.red : colors.white, _("Restrictions: %s"), restrictions); + drawText((SCREEN_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) diff --git a/src/galaxy/galacticMap.c b/src/galaxy/galacticMap.c index 83943f9..39eba1e 100644 --- a/src/galaxy/galacticMap.c +++ b/src/galaxy/galacticMap.c @@ -62,6 +62,13 @@ static int show; static int scrollingMap; static PointF cameraMin, cameraMax; static Widget *startMissionButton; +static char *MISSIONS_TEXT; +static char *PILOT_TEXT; +static char *CRAFT_TEXT; +static char *SQUADRON_TEXT; +static char *COMPLETED_TEXT; +static char *EPIC_TEXT; +static char *OPTIONAL_TEXT; void initGalacticMap(void) { @@ -74,6 +81,14 @@ void initGalacticMap(void) app.delegate.logic = &logic; app.delegate.draw = &draw; memset(&app.keyboard, 0, sizeof(int) * MAX_KEYBOARD_KEYS); + + MISSIONS_TEXT = _("Missions: %d / %d"); + PILOT_TEXT = _("Pilot: %s"); + CRAFT_TEXT = _("Craft: %s"); + SQUADRON_TEXT = _("Squadron: %s"); + COMPLETED_TEXT = _("This mission has been completed."); + EPIC_TEXT = _("Note: this is an epic mission."); + OPTIONAL_TEXT = _("Note: this is an optional mission."); background = getTexture("gfx/backgrounds/background02.jpg"); @@ -532,7 +547,7 @@ static void drawInfoBars(void) SDL_RenderFillRect(app.renderer, &r); SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_NONE); - drawText((SCREEN_WIDTH / 2), 5, 18, TA_CENTER, colors.white, _("Missions: %d / %d"), game.completedMissions, game.availableMissions); + drawText((SCREEN_WIDTH / 2), 5, 18, TA_CENTER, colors.white, MISSIONS_TEXT, game.completedMissions, game.availableMissions); } static void selectStarSystem(void) @@ -615,9 +630,9 @@ static void drawStarSystemDetail(void) if (game.currentMission->available) { - drawText(525, 135, 18, TA_LEFT, colors.lightGrey, _("Pilot: %s"), game.currentMission->pilot); - drawText(525, 160, 18, TA_LEFT, colors.lightGrey, _("Craft: %s"), game.currentMission->craft); - drawText(525, 185, 18, TA_LEFT, colors.lightGrey, _("Squadron: %s"), game.currentMission->squadron); + drawText(525, 135, 18, TA_LEFT, colors.lightGrey, PILOT_TEXT, game.currentMission->pilot); + drawText(525, 160, 18, TA_LEFT, colors.lightGrey, CRAFT_TEXT, game.currentMission->craft); + drawText(525, 185, 18, TA_LEFT, colors.lightGrey, SQUADRON_TEXT, game.currentMission->squadron); limitTextWidth(500); drawText(525, 230, 22, TA_LEFT, colors.white, game.currentMission->description); @@ -626,15 +641,15 @@ static void drawStarSystemDetail(void) if (game.currentMission->completed) { - drawText(525, SCREEN_HEIGHT - 95, 18, TA_LEFT, colors.green, _("This mission has been completed.")); + drawText(525, SCREEN_HEIGHT - 95, 18, TA_LEFT, colors.green, COMPLETED_TEXT); } else if (game.currentMission->epic) { - drawText(525, SCREEN_HEIGHT - 95, 18, TA_LEFT, colors.yellow, _("Note: this is an epic mission.")); + drawText(525, SCREEN_HEIGHT - 95, 18, TA_LEFT, colors.yellow, EPIC_TEXT); } else if (game.currentMission->isOptional) { - drawText(525, SCREEN_HEIGHT - 95, 18, TA_LEFT, colors.cyan, _("Note: this is an optional mission.")); + drawText(525, SCREEN_HEIGHT - 95, 18, TA_LEFT, colors.cyan, OPTIONAL_TEXT); } startMissionButton->enabled = (!game.currentMission->completed || selectedStarSystem->type == SS_SOL); diff --git a/src/game/stats.c b/src/game/stats.c index 5f314a3..0ca9872 100644 --- a/src/game/stats.c +++ b/src/game/stats.c @@ -30,6 +30,8 @@ static int page; static float maxPages; static Widget *prev; static Widget *next; +static char *STATS_TEXT; +static char *PAGE_TEXT; void initStats(void) { @@ -72,6 +74,9 @@ void initStats(void) statDescription[STAT_MINES_DESTROYED] = _("Mines Destroyed"); statDescription[STAT_ENEMIES_SURRENDERED] = _("Enemies Surrendered"); statDescription[STAT_TIME] = _("Time Played"); + + STATS_TEXT = _("Stats"); + PAGE_TEXT = _("Page %d / %d"); } void initStatsDisplay(void) @@ -141,9 +146,9 @@ void drawStats(void) SDL_SetRenderDrawColor(app.renderer, 200, 200, 200, 255); SDL_RenderDrawRect(app.renderer, &r); - drawText(SCREEN_WIDTH / 2, 70, 28, TA_CENTER, colors.white, _("Stats")); + drawText(SCREEN_WIDTH / 2, 70, 28, TA_CENTER, colors.white, STATS_TEXT); - drawText(SCREEN_WIDTH / 2, 110, 16, TA_CENTER, colors.lightGrey, _("Page %d / %d"), page + 1, (int)maxPages); + drawText(SCREEN_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); diff --git a/src/game/trophies.c b/src/game/trophies.c index ad05728..18e7d62 100644 --- a/src/game/trophies.c +++ b/src/game/trophies.c @@ -41,6 +41,10 @@ static float sparkleAngle; static float maxPages; static Widget *prev; static Widget *next; +static char *TROPHIES_TEXT; +static char *AWARDED_TEXT; +static char *PAGE_TEXT; +static char *HIDDEN_TEXT; void initTrophies(void) { @@ -58,6 +62,11 @@ void initTrophies(void) alertRect.y = 10; sparkleAngle = 0; + + TROPHIES_TEXT = _("Trophies"); + AWARDED_TEXT = _("Awarded : %d / %d"); + PAGE_TEXT = _("Page : %d / %d"); + HIDDEN_TEXT = _("[Hidden]"); resetAlert(); } @@ -139,9 +148,9 @@ void drawTrophies(void) SDL_SetRenderDrawColor(app.renderer, 200, 200, 200, 255); SDL_RenderDrawRect(app.renderer, &r); - drawText(SCREEN_WIDTH / 2, 40, 28, TA_CENTER, colors.white, _("Trophies")); - drawText(SCREEN_WIDTH / 2, 83, 16, TA_CENTER, colors.lightGrey, _("Awarded : %d / %d"), awarded, total); - drawText(SCREEN_WIDTH / 2, 110, 16, TA_CENTER, colors.lightGrey, _("Page : %d / %d"), page + 1, (int)maxPages); + 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); SDL_SetRenderDrawColor(app.renderer, 128, 128, 128, 255); SDL_RenderDrawLine(app.renderer, r.x, 150, r.x + r.w, 150); @@ -179,7 +188,7 @@ void drawTrophies(void) } else { - drawText(x + 85, y + 20, 20, TA_LEFT, colors.darkGrey, _("[Hidden]")); + drawText(x + 85, y + 20, 20, TA_LEFT, colors.darkGrey, HIDDEN_TEXT); } } diff --git a/src/system/controls.c b/src/system/controls.c index 4fc320c..033ef5c 100644 --- a/src/system/controls.c +++ b/src/system/controls.c @@ -24,6 +24,10 @@ static void restoreDefaults(void); static const char *controlName[CONTROL_MAX]; static Widget *controlWidget[CONTROL_MAX]; +static char *CONTROLS_TEXT; +static char *HELP_TEXT; +static char *BACKSPACE_TEXT; +static char *ESCAPE_TEXT; void initControls(void) { @@ -52,6 +56,11 @@ void initControls(void) strcpy(controlWidget[i]->options[0], ""); strcpy(controlWidget[i]->options[1], ""); } + + CONTROLS_TEXT = _("Controls"); + HELP_TEXT = _("Click a control to change it, and then the key or mouse button you want to use."); + BACKSPACE_TEXT = _("[BACKSPACE] - Clear"); + ESCAPE_TEXT = _("[ESCAPE] - Cancel"); } void initControlsDisplay(void) @@ -158,7 +167,7 @@ void drawControls(void) SDL_SetRenderDrawColor(app.renderer, 200, 200, 200, 255); SDL_RenderDrawRect(app.renderer, &r); - drawText(SCREEN_WIDTH / 2, 50, 28, TA_CENTER, colors.white, _("Controls")); + drawText(SCREEN_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); @@ -183,9 +192,9 @@ void drawControls(void) } limitTextWidth(r.w - 100); - drawText(SCREEN_WIDTH / 2, 525, 16, TA_CENTER, colors.white, _("Click a control to change it, and then the key or mouse button you want to use.")); - drawText((SCREEN_WIDTH / 2) - 50, 560, 16, TA_RIGHT, colors.white, _("[BACKSPACE] - Clear")); - drawText((SCREEN_WIDTH / 2) + 50, 560, 16, TA_LEFT, colors.white, _("[ESCAPE] - Cancel")); + drawText(SCREEN_WIDTH / 2, 525, 16, TA_CENTER, colors.white, HELP_TEXT); + drawText((SCREEN_WIDTH / 2) - 50, 560, 16, TA_RIGHT, colors.white, BACKSPACE_TEXT); + drawText((SCREEN_WIDTH / 2) + 50, 560, 16, TA_LEFT, colors.white, ESCAPE_TEXT); limitTextWidth(0); drawWidgets("controls"); diff --git a/src/system/options.c b/src/system/options.c index 69d9175..a2cd648 100644 --- a/src/system/options.c +++ b/src/system/options.c @@ -31,6 +31,8 @@ static void controls(void); static void (*returnFromOptions)(void); static int show; +static char *OPTIONS_TEXT; +static char *RESOLUTION_TEXT; void initOptions(void (*rtn)(void)) { @@ -56,10 +58,14 @@ void initOptions(void (*rtn)(void)) setWidgetOption("musicVolume", "options", optionStr); setWidgetOption("fullscreen", "options", app.fullscreen ? "On" : "Off"); + + OPTIONS_TEXT = _("Options"); + RESOLUTION_TEXT = _("Note: you must restart the game for window size and fullscreen options to take effect."); #if FIXED_RESOLUTION getWidget("windowSize", "options")->enabled = 0; getWidget("fullscreen", "options")->enabled = 0; + RESOLUTION_TEXT = _("Note: this device does not support changing the screen resolution."); #endif returnFromOptions = rtn; @@ -100,7 +106,7 @@ static void drawMain(void) SDL_SetRenderDrawColor(app.renderer, 200, 200, 200, 255); SDL_RenderDrawRect(app.renderer, &r); - drawText(SCREEN_WIDTH / 2, 70, 28, TA_CENTER, colors.white, _("Options")); + drawText(SCREEN_WIDTH / 2, 70, 28, TA_CENTER, colors.white, OPTIONS_TEXT); SDL_SetRenderDrawColor(app.renderer, 128, 128, 128, 255); SDL_RenderDrawLine(app.renderer, r.x, 120, r.x + r.w, 120); @@ -108,11 +114,7 @@ static void drawMain(void) drawWidgets("options"); limitTextWidth(r.w - 100); - #if !FIXED_RESOLUTION - drawText(SCREEN_WIDTH / 2, r.y + r.h - 135, 16, TA_CENTER, colors.yellow, _("Note: you must restart the game for window size and fullscreen options to take effect.")); - #else - drawText(SCREEN_WIDTH / 2, r.y + r.h - 135, 16, TA_CENTER, colors.yellow, _("Note: this device does not support changing the screen resolution.")); - #endif + drawText(SCREEN_WIDTH / 2, r.y + r.h - 135, 16, TA_CENTER, colors.yellow, RESOLUTION_TEXT); limitTextWidth(0); }