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)
downloadrockbox-505eca76e661df673ae3ff77863936e6a533f663.tar.gz
rockbox-505eca76e661df673ae3ff77863936e6a533f663.zip
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;
20#include "button.h" 20#include "button.h"
21#include "kernel.h" 21#include "kernel.h"
22#include "menu.h" 22#include "menu.h"
23 23#include "lang.h"
24 24
25int board[28][16],snakelength; 25int board[28][16],snakelength;
26unsigned int score,hiscore=0; 26unsigned int score,hiscore=0;
@@ -35,14 +35,14 @@ void die (void) {
35 lcd_clear_display(); 35 lcd_clear_display();
36 snprintf(pscore,sizeof(pscore),"%d",score); 36 snprintf(pscore,sizeof(pscore),"%d",score);
37 lcd_putsxy(3,12,"oops...",0); 37 lcd_putsxy(3,12,"oops...",0);
38 lcd_putsxy(3,22,"Your Score :",0); 38 lcd_putsxy(3,22,str(LANG_SNAKE_SCORE),0);
39 lcd_putsxy(3,32, pscore,0); 39 lcd_putsxy(3,32, pscore,0);
40 if (score>hiscore) { 40 if (score>hiscore) {
41 hiscore=score; 41 hiscore=score;
42 lcd_putsxy(3,42,"New High Score!",0); 42 lcd_putsxy(3,42,str(LANG_SNAKE_HISCORE_NEW),0);
43 } 43 }
44 else { 44 else {
45 snprintf(hscore,sizeof(hscore),"High Score %d",hiscore); 45 snprintf(hscore,sizeof(hscore),str(LANG_SNAKE_HISCORE),hiscore);
46 lcd_putsxy(3,42,hscore,0); 46 lcd_putsxy(3,42,hscore,0);
47 } 47 }
48 lcd_update(); 48 lcd_update();
@@ -141,9 +141,9 @@ void redraw (void) {
141 141
142void game_pause (void) { 142void game_pause (void) {
143 lcd_clear_display(); 143 lcd_clear_display();
144 lcd_putsxy(3,12,"Game Paused",0); 144 lcd_putsxy(3,12,str(LANG_SNAKE_PAUSE),0);
145 lcd_putsxy(3,22,"[play] to resume",0); 145 lcd_putsxy(3,22,str(LANG_SNAKE_RESUME),0);
146 lcd_putsxy(3,32,"[off] to quit",0); 146 lcd_putsxy(3,32,str(LANG_SNAKE_QUIT),0);
147 lcd_update(); 147 lcd_update();
148 while (1) { 148 while (1) {
149 switch (button_get(true)) { 149 switch (button_get(true)) {
@@ -221,12 +221,12 @@ void game_init(void) {
221 221
222 222
223 lcd_clear_display(); 223 lcd_clear_display();
224 snprintf(plevel,sizeof(plevel),"Level - %d",level); 224 snprintf(plevel,sizeof(plevel),str(LANG_SNAKE_LEVEL),level);
225 snprintf(phscore,sizeof(phscore),"High Score - %d",hiscore); 225 snprintf(phscore,sizeof(phscore),str(LANG_SNAKE_HISCORE),hiscore);
226 lcd_putsxy(3,2, plevel,0); 226 lcd_putsxy(3,2, plevel,0);
227 lcd_putsxy(3,12, "(1 - slow, 9 - fast)",0); 227 lcd_putsxy(3,12, str(LANG_SNAKE_RANGE),0);
228 lcd_putsxy(3,22, "[off] to quit",0); 228 lcd_putsxy(3,22, str(LANG_SNAKE_QUIT),0);
229 lcd_putsxy(3,32, "[play] to start/pause",0); 229 lcd_putsxy(3,32, str(LANG_SNAKE_START),0);
230 lcd_putsxy(3,42, phscore,0); 230 lcd_putsxy(3,42, phscore,0);
231 lcd_update(); 231 lcd_update();
232 232
@@ -250,7 +250,7 @@ void game_init(void) {
250 return; 250 return;
251 break; 251 break;
252 } 252 }
253 snprintf(plevel,sizeof(plevel),"Level - %d",level); 253 snprintf(plevel,sizeof(plevel),str(LANG_SNAKE_LEVEL),level);
254 lcd_putsxy(3,2, plevel,0); 254 lcd_putsxy(3,2, plevel,0);
255 lcd_update(); 255 lcd_update();
256 } 256 }
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 @@
32#include <stdio.h> 32#include <stdio.h>
33#endif 33#endif
34#include <string.h> 34#include <string.h>
35 35#include "lang.h"
36#define SOKOBAN_TITLE "Sokoban" 36#define SOKOBAN_TITLE "Sokoban"
37#define SOKOBAN_TITLE_FONT 2 37#define SOKOBAN_TITLE_FONT 2
38#define NUM_LEVELS sizeof(levels)/320 38#define NUM_LEVELS sizeof(levels)/320
@@ -1847,8 +1847,8 @@ void update_screen(void) {
1847 1847
1848 lcd_drawrect (80,0,32,32); 1848 lcd_drawrect (80,0,32,32);
1849 lcd_drawrect (80,32,32,64); 1849 lcd_drawrect (80,32,32,64);
1850 lcd_putsxy (81, 10, "Level", 0); 1850 lcd_putsxy (81, 10, str(LANG_SOKOBAN_LEVEL), 0);
1851 lcd_putsxy (81, 42, "Moves", 0); 1851 lcd_putsxy (81, 42, str(LANG_SOKOBAN_MOVE), 0);
1852 /* print out the screen */ 1852 /* print out the screen */
1853 lcd_update(); 1853 lcd_update();
1854} 1854}
@@ -2187,7 +2187,7 @@ void sokoban_loop(void) {
2187 if (current_level == NUM_LEVELS) { 2187 if (current_level == NUM_LEVELS) {
2188 for(ii=0; ii<30 ; ii++) { 2188 for(ii=0; ii<30 ; ii++) {
2189 lcd_clear_display(); 2189 lcd_clear_display();
2190 lcd_putsxy(10, 20, "YOU WIN!!", 2); 2190 lcd_putsxy(10, 20, str(LANG_SOKOBAN_WIN), 2);
2191 lcd_update(); 2191 lcd_update();
2192 lcd_invertrect(0,0,111,63); 2192 lcd_invertrect(0,0,111,63);
2193 lcd_update(); 2193 lcd_update();
@@ -2232,10 +2232,10 @@ Menu sokoban(void)
2232 2232
2233 lcd_clear_display(); 2233 lcd_clear_display();
2234 2234
2235 lcd_putsxy( 3,12, "[Off] to stop", 0); 2235 lcd_putsxy( 3,12, str(LANG_SOKOBAN_QUIT), 0);
2236 lcd_putsxy( 3,22, "[F1] - level",0); 2236 lcd_putsxy( 3,22, str(LANG_SOKOBAN_F1),0);
2237 lcd_putsxy( 3,32, "[F2] same level",0); 2237 lcd_putsxy( 3,32, str(LANG_SOKOBAN_F2),0);
2238 lcd_putsxy( 3,42, "[F3] + level",0); 2238 lcd_putsxy( 3,42, str(LANG_SOKOBAN_F3),0);
2239 2239
2240 lcd_update(); 2240 lcd_update();
2241 sleep(HZ*2); 2241 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 @@
35#include <stdio.h> 35#include <stdio.h>
36#endif 36#endif
37#include "sprintf.h" 37#include "sprintf.h"
38 38#include "lang.h"
39#define TETRIS_TITLE "Tetris!" 39#define TETRIS_TITLE "Tetris!"
40#define TETRIS_TITLE_FONT 1 40#define TETRIS_TITLE_FONT 1
41#define TETRIS_TITLE_XLOC 43 41#define TETRIS_TITLE_XLOC 43
@@ -366,7 +366,7 @@ void game_loop(void)
366 if(gameover()) 366 if(gameover())
367 { 367 {
368 lcd_clearrect(0, 52, LCD_WIDTH, LCD_HEIGHT - 52); 368 lcd_clearrect(0, 52, LCD_WIDTH, LCD_HEIGHT - 52);
369 lcd_putsxy (2, 52, "You lose!", 0); 369 lcd_putsxy (2, 52, str(LANG_TETRIS_LOSE), 0);
370 lcd_update(); 370 lcd_update();
371 sleep(HZ * 3); 371 sleep(HZ * 3);
372 return; 372 return;
@@ -396,7 +396,7 @@ Menu tetris(void)
396 init_tetris(); 396 init_tetris();
397 397
398 draw_frame(start_x, start_x + max_x - 1, start_y - 1, start_y + max_y); 398 draw_frame(start_x, start_x + max_x - 1, start_y - 1, start_y + max_y);
399 lcd_putsxy (2, 42, "0 Rows - Level 0", 0); 399 lcd_putsxy (2, 42, str(LANG_TETRIS_LEVEL), 0);
400 lcd_update(); 400 lcd_update();
401 401
402 next_b = t_rand(blocks); 402 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 @@
33#include "kernel.h" 33#include "kernel.h"
34#include "menu.h" 34#include "menu.h"
35#include "rtc.h" 35#include "rtc.h"
36 36#include "lang.h"
37/* I extracted string constants for output to
38 simplify inernationalization - once we have
39 decided how to do that exactly. Even though
40 there are other strings in the code they don't
41 have to be internationalized because they are
42 only for debugging purposes and are only included
43 if DEBUG_WORMLET is defined anyway.*/
44
45/* Length restriction for score board strings (LANG_SB_XXX):
46 LCD_PROPFONTS: max 43 pixel
47 fix font: max 7 characters*/
48#define LANG_SB_LENGTH "Len:%d"
49#define LANG_SB_GROWING "Growing"
50#define LANG_SB_HUNGRY "Hungry"
51#define LANG_SB_WORMED "Wormed"
52#define LANG_SB_ARGH "Argh"
53#define LANG_SB_CRASHED "Crashed"
54#define LANG_SB_HIGHSCORE "Hs: %d"
55
56/* Length restriction for config screen strings (LANG_CS_XXX):
57 The must fit on the entire screen - preferably
58 with the key names aligned right. */
59#define LANG_CS_PLAYERS "%d Players up/dn"
60#define LANG_CS_WORMS "%d Worms l/r"
61#define LANG_CS_REMOTE_CTRL "Remote control F1"
62#define LANG_CS_NO_REM_CTRL "No rem. control F1"
63#define LANG_CS_2_KEY_CTRL "2 key control F1"
64#define LANG_CS_4_KEY_CTRL "4 key control F1"
65#define LANG_CS_NO_CONTROL "Out of control"
66 37
67/* size of the field the worm lives in */ 38/* size of the field the worm lives in */
68#define FIELD_RECT_X 1 39#define FIELD_RECT_X 1
@@ -1208,37 +1179,37 @@ static void score_board(void)
1208 } 1179 }
1209 1180
1210 /* length */ 1181 /* length */
1211 snprintf(buf, sizeof (buf), LANG_SB_LENGTH, score); 1182 snprintf(buf, sizeof (buf),str(LANG_WORMLET_LENGTH), score);
1212 1183
1213 /* worm state */ 1184 /* worm state */
1214 switch (check_collision(&worms[i])) { 1185 switch (check_collision(&worms[i])) {
1215 case COLLISION_NONE: 1186 case COLLISION_NONE:
1216 if (worms[i].growing > 0){ 1187 if (worms[i].growing > 0){
1217 snprintf(buf2, sizeof(buf2), LANG_SB_GROWING); 1188 snprintf(buf2, sizeof(buf2), str(LANG_WORMLET_GROWING));
1218 } 1189 }
1219 else { 1190 else {
1220 if (worms[i].alive) { 1191 if (worms[i].alive) {
1221 snprintf(buf2, sizeof(buf2), LANG_SB_HUNGRY); 1192 snprintf(buf2, sizeof(buf2), str(LANG_WORMLET_HUNGRY));
1222 } else { 1193 } else {
1223 snprintf(buf2, sizeof(buf2), LANG_SB_WORMED); 1194 snprintf(buf2, sizeof(buf2), str(LANG_WORMLET_WORMED));
1224 } 1195 }
1225 } 1196 }
1226 break; 1197 break;
1227 1198
1228 case COLLISION_WORM: 1199 case COLLISION_WORM:
1229 snprintf(buf2, sizeof(buf2), LANG_SB_WORMED); 1200 snprintf(buf2, sizeof(buf2), str(LANG_WORMLET_WORMED));
1230 break; 1201 break;
1231 1202
1232 case COLLISION_FOOD: 1203 case COLLISION_FOOD:
1233 snprintf(buf2, sizeof(buf2), LANG_SB_GROWING); 1204 snprintf(buf2, sizeof(buf2), str(LANG_WORMLET_GROWING));
1234 break; 1205 break;
1235 1206
1236 case COLLISION_ARGH: 1207 case COLLISION_ARGH:
1237 snprintf(buf2, sizeof(buf2), LANG_SB_ARGH); 1208 snprintf(buf2, sizeof(buf2), str(LANG_WORMLET_ARGH));
1238 break; 1209 break;
1239 1210
1240 case COLLISION_FIELD: 1211 case COLLISION_FIELD:
1241 snprintf(buf2, sizeof(buf2), LANG_SB_CRASHED); 1212 snprintf(buf2, sizeof(buf2), str(LANG_WORMLET_CRASHED));
1242 break; 1213 break;
1243 } 1214 }
1244 lcd_putsxy(FIELD_RECT_WIDTH + 3, y , buf, 0); 1215 lcd_putsxy(FIELD_RECT_WIDTH + 3, y , buf, 0);
@@ -1250,7 +1221,7 @@ static void score_board(void)
1250 } 1221 }
1251 y += 19; 1222 y += 19;
1252 } 1223 }
1253 snprintf(buf , sizeof(buf), LANG_SB_HIGHSCORE, highscore); 1224 snprintf(buf , sizeof(buf), str(LANG_WORMLET_HIGHSCORE), highscore);
1254#ifndef DEBUG_WORMLET 1225#ifndef DEBUG_WORMLET
1255 lcd_putsxy(FIELD_RECT_WIDTH + 3, LCD_HEIGHT - 8, buf, 0); 1226 lcd_putsxy(FIELD_RECT_WIDTH + 3, LCD_HEIGHT - 8, buf, 0);
1256#else 1227#else
@@ -1937,29 +1908,29 @@ Menu wormlet(void)
1937 lcd_clear_display(); 1908 lcd_clear_display();
1938 1909
1939 /* first line players */ 1910 /* first line players */
1940 snprintf(buf, sizeof buf, LANG_CS_PLAYERS, players); 1911 snprintf(buf, sizeof buf, str(LANG_WORMLET_PLAYERS), players);
1941 lcd_puts(0, 0, buf); 1912 lcd_puts(0, 0, buf);
1942 1913
1943 /* second line worms */ 1914 /* second line worms */
1944 snprintf(buf, sizeof buf, LANG_CS_WORMS, worm_count); 1915 snprintf(buf, sizeof buf, str(LANG_WORMLET_WORMS), worm_count);
1945 lcd_puts(0, 1, buf); 1916 lcd_puts(0, 1, buf);
1946 1917
1947 /* third line control */ 1918 /* third line control */
1948 if (players > 1) { 1919 if (players > 1) {
1949 if (use_remote) { 1920 if (use_remote) {
1950 snprintf(buf, sizeof buf, LANG_CS_REMOTE_CTRL); 1921 snprintf(buf, sizeof buf, str(LANG_WORMLET_REMOTE_CTRL));
1951 } else { 1922 } else {
1952 snprintf(buf, sizeof buf, LANG_CS_NO_REM_CTRL); 1923 snprintf(buf, sizeof buf, str(LANG_WORMLET_NO_REM_CTRL));
1953 } 1924 }
1954 } else { 1925 } else {
1955 if (players > 0) { 1926 if (players > 0) {
1956 if (use_remote) { 1927 if (use_remote) {
1957 snprintf(buf, sizeof buf, LANG_CS_2_KEY_CTRL); 1928 snprintf(buf, sizeof buf, str(LANG_WORMLET_2_KEY_CTRL));
1958 } else { 1929 } else {
1959 snprintf(buf, sizeof buf, LANG_CS_4_KEY_CTRL); 1930 snprintf(buf, sizeof buf, str(LANG_WORMLET_4_KEY_CTRL));
1960 } 1931 }
1961 } else { 1932 } else {
1962 snprintf(buf, sizeof buf, LANG_CS_NO_CONTROL); 1933 snprintf(buf, sizeof buf, str(LANG_WORMLET_NO_CONTROL));
1963 } 1934 }
1964 } 1935 }
1965 lcd_puts(0, 2, buf); 1936 lcd_puts(0, 2, buf);