Start of i18n look up optimisations.

This commit is contained in:
Steve 2016-07-19 09:26:19 +01:00
parent 157f1bc28a
commit d54273821d
10 changed files with 136 additions and 45 deletions

View File

@ -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);
}
}

View File

@ -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;

View File

@ -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;

View File

@ -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);
}
}

View File

@ -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)
{
@ -73,6 +80,14 @@ void initChallengeHome(void)
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;
memset(&app.keyboard, 0, sizeof(int) * MAX_KEYBOARD_KEYS);
@ -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)

View File

@ -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)
{
@ -75,6 +82,14 @@ void initGalacticMap(void)
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");
starSystemTexture = getTexture("gfx/galaxy/starSystem.png");
@ -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);

View File

@ -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);

View File

@ -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)
{
@ -59,6 +63,11 @@ void initTrophies(void)
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);
}
}

View File

@ -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");

View File

@ -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))
{
@ -57,9 +59,13 @@ void initOptions(void (*rtn)(void))
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);
}