summaryrefslogtreecommitdiff
path: root/apps/recorder
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2002-09-18 14:08:05 +0000
committerBjörn Stenberg <bjorn@haxx.se>2002-09-18 14:08:05 +0000
commit505eca76e661df673ae3ff77863936e6a533f663 (patch)
treec09f07ca4eaf5c4433af9a4365ccb136e02f3d5a /apps/recorder
parenta24bd9a894c1d8594e99f95e470cbd8296e5b3d2 (diff)
New language/string handling
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2327 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/recorder')
-rw-r--r--apps/recorder/snake.c26
-rw-r--r--apps/recorder/sokoban.c16
-rw-r--r--apps/recorder/tetris.c6
-rw-r--r--apps/recorder/wormlet.c63
4 files changed, 41 insertions, 70 deletions
diff --git a/apps/recorder/snake.c b/apps/recorder/snake.c
index b0e42d8fd0..8c14527bd5 100644
--- a/apps/recorder/snake.c
+++ b/apps/recorder/snake.c
@@ -20,7 +20,7 @@ dir is the current direction of the snake - 0=up, 1=right, 2=down, 3=left;
#include "button.h"
#include "kernel.h"
#include "menu.h"
-
+#include "lang.h"
int board[28][16],snakelength;
unsigned int score,hiscore=0;
@@ -35,14 +35,14 @@ void die (void) {
lcd_clear_display();
snprintf(pscore,sizeof(pscore),"%d",score);
lcd_putsxy(3,12,"oops...",0);
- lcd_putsxy(3,22,"Your Score :",0);
+ lcd_putsxy(3,22,str(LANG_SNAKE_SCORE),0);
lcd_putsxy(3,32, pscore,0);
if (score>hiscore) {
hiscore=score;
- lcd_putsxy(3,42,"New High Score!",0);
+ lcd_putsxy(3,42,str(LANG_SNAKE_HISCORE_NEW),0);
}
else {
- snprintf(hscore,sizeof(hscore),"High Score %d",hiscore);
+ snprintf(hscore,sizeof(hscore),str(LANG_SNAKE_HISCORE),hiscore);
lcd_putsxy(3,42,hscore,0);
}
lcd_update();
@@ -141,9 +141,9 @@ void redraw (void) {
void game_pause (void) {
lcd_clear_display();
- lcd_putsxy(3,12,"Game Paused",0);
- lcd_putsxy(3,22,"[play] to resume",0);
- lcd_putsxy(3,32,"[off] to quit",0);
+ lcd_putsxy(3,12,str(LANG_SNAKE_PAUSE),0);
+ lcd_putsxy(3,22,str(LANG_SNAKE_RESUME),0);
+ lcd_putsxy(3,32,str(LANG_SNAKE_QUIT),0);
lcd_update();
while (1) {
switch (button_get(true)) {
@@ -221,12 +221,12 @@ void game_init(void) {
lcd_clear_display();
- snprintf(plevel,sizeof(plevel),"Level - %d",level);
- snprintf(phscore,sizeof(phscore),"High Score - %d",hiscore);
+ snprintf(plevel,sizeof(plevel),str(LANG_SNAKE_LEVEL),level);
+ snprintf(phscore,sizeof(phscore),str(LANG_SNAKE_HISCORE),hiscore);
lcd_putsxy(3,2, plevel,0);
- lcd_putsxy(3,12, "(1 - slow, 9 - fast)",0);
- lcd_putsxy(3,22, "[off] to quit",0);
- lcd_putsxy(3,32, "[play] to start/pause",0);
+ lcd_putsxy(3,12, str(LANG_SNAKE_RANGE),0);
+ lcd_putsxy(3,22, str(LANG_SNAKE_QUIT),0);
+ lcd_putsxy(3,32, str(LANG_SNAKE_START),0);
lcd_putsxy(3,42, phscore,0);
lcd_update();
@@ -250,7 +250,7 @@ void game_init(void) {
return;
break;
}
- snprintf(plevel,sizeof(plevel),"Level - %d",level);
+ snprintf(plevel,sizeof(plevel),str(LANG_SNAKE_LEVEL),level);
lcd_putsxy(3,2, plevel,0);
lcd_update();
}
diff --git a/apps/recorder/sokoban.c b/apps/recorder/sokoban.c
index 078153077e..bec556054a 100644
--- a/apps/recorder/sokoban.c
+++ b/apps/recorder/sokoban.c
@@ -32,7 +32,7 @@
#include <stdio.h>
#endif
#include <string.h>
-
+#include "lang.h"
#define SOKOBAN_TITLE "Sokoban"
#define SOKOBAN_TITLE_FONT 2
#define NUM_LEVELS sizeof(levels)/320
@@ -1847,8 +1847,8 @@ void update_screen(void) {
lcd_drawrect (80,0,32,32);
lcd_drawrect (80,32,32,64);
- lcd_putsxy (81, 10, "Level", 0);
- lcd_putsxy (81, 42, "Moves", 0);
+ lcd_putsxy (81, 10, str(LANG_SOKOBAN_LEVEL), 0);
+ lcd_putsxy (81, 42, str(LANG_SOKOBAN_MOVE), 0);
/* print out the screen */
lcd_update();
}
@@ -2187,7 +2187,7 @@ void sokoban_loop(void) {
if (current_level == NUM_LEVELS) {
for(ii=0; ii<30 ; ii++) {
lcd_clear_display();
- lcd_putsxy(10, 20, "YOU WIN!!", 2);
+ lcd_putsxy(10, 20, str(LANG_SOKOBAN_WIN), 2);
lcd_update();
lcd_invertrect(0,0,111,63);
lcd_update();
@@ -2232,10 +2232,10 @@ Menu sokoban(void)
lcd_clear_display();
- lcd_putsxy( 3,12, "[Off] to stop", 0);
- lcd_putsxy( 3,22, "[F1] - level",0);
- lcd_putsxy( 3,32, "[F2] same level",0);
- lcd_putsxy( 3,42, "[F3] + level",0);
+ lcd_putsxy( 3,12, str(LANG_SOKOBAN_QUIT), 0);
+ lcd_putsxy( 3,22, str(LANG_SOKOBAN_F1),0);
+ lcd_putsxy( 3,32, str(LANG_SOKOBAN_F2),0);
+ lcd_putsxy( 3,42, str(LANG_SOKOBAN_F3),0);
lcd_update();
sleep(HZ*2);
diff --git a/apps/recorder/tetris.c b/apps/recorder/tetris.c
index ba7ff546f7..2455f269b3 100644
--- a/apps/recorder/tetris.c
+++ b/apps/recorder/tetris.c
@@ -35,7 +35,7 @@
#include <stdio.h>
#endif
#include "sprintf.h"
-
+#include "lang.h"
#define TETRIS_TITLE "Tetris!"
#define TETRIS_TITLE_FONT 1
#define TETRIS_TITLE_XLOC 43
@@ -366,7 +366,7 @@ void game_loop(void)
if(gameover())
{
lcd_clearrect(0, 52, LCD_WIDTH, LCD_HEIGHT - 52);
- lcd_putsxy (2, 52, "You lose!", 0);
+ lcd_putsxy (2, 52, str(LANG_TETRIS_LOSE), 0);
lcd_update();
sleep(HZ * 3);
return;
@@ -396,7 +396,7 @@ Menu tetris(void)
init_tetris();
draw_frame(start_x, start_x + max_x - 1, start_y - 1, start_y + max_y);
- lcd_putsxy (2, 42, "0 Rows - Level 0", 0);
+ lcd_putsxy (2, 42, str(LANG_TETRIS_LEVEL), 0);
lcd_update();
next_b = t_rand(blocks);
diff --git a/apps/recorder/wormlet.c b/apps/recorder/wormlet.c
index 71a356134f..acebbad8bf 100644
--- a/apps/recorder/wormlet.c
+++ b/apps/recorder/wormlet.c
@@ -33,36 +33,7 @@
#include "kernel.h"
#include "menu.h"
#include "rtc.h"
-
-/* I extracted string constants for output to
- simplify inernationalization - once we have
- decided how to do that exactly. Even though
- there are other strings in the code they don't
- have to be internationalized because they are
- only for debugging purposes and are only included
- if DEBUG_WORMLET is defined anyway.*/
-
-/* Length restriction for score board strings (LANG_SB_XXX):
- LCD_PROPFONTS: max 43 pixel
- fix font: max 7 characters*/
-#define LANG_SB_LENGTH "Len:%d"
-#define LANG_SB_GROWING "Growing"
-#define LANG_SB_HUNGRY "Hungry"
-#define LANG_SB_WORMED "Wormed"
-#define LANG_SB_ARGH "Argh"
-#define LANG_SB_CRASHED "Crashed"
-#define LANG_SB_HIGHSCORE "Hs: %d"
-
-/* Length restriction for config screen strings (LANG_CS_XXX):
- The must fit on the entire screen - preferably
- with the key names aligned right. */
-#define LANG_CS_PLAYERS "%d Players up/dn"
-#define LANG_CS_WORMS "%d Worms l/r"
-#define LANG_CS_REMOTE_CTRL "Remote control F1"
-#define LANG_CS_NO_REM_CTRL "No rem. control F1"
-#define LANG_CS_2_KEY_CTRL "2 key control F1"
-#define LANG_CS_4_KEY_CTRL "4 key control F1"
-#define LANG_CS_NO_CONTROL "Out of control"
+#include "lang.h"
/* size of the field the worm lives in */
#define FIELD_RECT_X 1
@@ -1208,37 +1179,37 @@ static void score_board(void)
}
/* length */
- snprintf(buf, sizeof (buf), LANG_SB_LENGTH, score);
+ snprintf(buf, sizeof (buf),str(LANG_WORMLET_LENGTH), score);
/* worm state */
switch (check_collision(&worms[i])) {
case COLLISION_NONE:
if (worms[i].growing > 0){
- snprintf(buf2, sizeof(buf2), LANG_SB_GROWING);
+ snprintf(buf2, sizeof(buf2), str(LANG_WORMLET_GROWING));
}
else {
if (worms[i].alive) {
- snprintf(buf2, sizeof(buf2), LANG_SB_HUNGRY);
+ snprintf(buf2, sizeof(buf2), str(LANG_WORMLET_HUNGRY));
} else {
- snprintf(buf2, sizeof(buf2), LANG_SB_WORMED);
+ snprintf(buf2, sizeof(buf2), str(LANG_WORMLET_WORMED));
}
}
break;
case COLLISION_WORM:
- snprintf(buf2, sizeof(buf2), LANG_SB_WORMED);
+ snprintf(buf2, sizeof(buf2), str(LANG_WORMLET_WORMED));
break;
case COLLISION_FOOD:
- snprintf(buf2, sizeof(buf2), LANG_SB_GROWING);
+ snprintf(buf2, sizeof(buf2), str(LANG_WORMLET_GROWING));
break;
case COLLISION_ARGH:
- snprintf(buf2, sizeof(buf2), LANG_SB_ARGH);
+ snprintf(buf2, sizeof(buf2), str(LANG_WORMLET_ARGH));
break;
case COLLISION_FIELD:
- snprintf(buf2, sizeof(buf2), LANG_SB_CRASHED);
+ snprintf(buf2, sizeof(buf2), str(LANG_WORMLET_CRASHED));
break;
}
lcd_putsxy(FIELD_RECT_WIDTH + 3, y , buf, 0);
@@ -1250,7 +1221,7 @@ static void score_board(void)
}
y += 19;
}
- snprintf(buf , sizeof(buf), LANG_SB_HIGHSCORE, highscore);
+ snprintf(buf , sizeof(buf), str(LANG_WORMLET_HIGHSCORE), highscore);
#ifndef DEBUG_WORMLET
lcd_putsxy(FIELD_RECT_WIDTH + 3, LCD_HEIGHT - 8, buf, 0);
#else
@@ -1937,29 +1908,29 @@ Menu wormlet(void)
lcd_clear_display();
/* first line players */
- snprintf(buf, sizeof buf, LANG_CS_PLAYERS, players);
+ snprintf(buf, sizeof buf, str(LANG_WORMLET_PLAYERS), players);
lcd_puts(0, 0, buf);
/* second line worms */
- snprintf(buf, sizeof buf, LANG_CS_WORMS, worm_count);
+ snprintf(buf, sizeof buf, str(LANG_WORMLET_WORMS), worm_count);
lcd_puts(0, 1, buf);
/* third line control */
if (players > 1) {
if (use_remote) {
- snprintf(buf, sizeof buf, LANG_CS_REMOTE_CTRL);
+ snprintf(buf, sizeof buf, str(LANG_WORMLET_REMOTE_CTRL));
} else {
- snprintf(buf, sizeof buf, LANG_CS_NO_REM_CTRL);
+ snprintf(buf, sizeof buf, str(LANG_WORMLET_NO_REM_CTRL));
}
} else {
if (players > 0) {
if (use_remote) {
- snprintf(buf, sizeof buf, LANG_CS_2_KEY_CTRL);
+ snprintf(buf, sizeof buf, str(LANG_WORMLET_2_KEY_CTRL));
} else {
- snprintf(buf, sizeof buf, LANG_CS_4_KEY_CTRL);
+ snprintf(buf, sizeof buf, str(LANG_WORMLET_4_KEY_CTRL));
}
} else {
- snprintf(buf, sizeof buf, LANG_CS_NO_CONTROL);
+ snprintf(buf, sizeof buf, str(LANG_WORMLET_NO_CONTROL));
}
}
lcd_puts(0, 2, buf);