summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Hak <adiamas@rockbox.org>2002-10-29 10:45:29 +0000
committerRobert Hak <adiamas@rockbox.org>2002-10-29 10:45:29 +0000
commit8f11dc00ac1a0a5fe009d1d07d9a1378c3300ba8 (patch)
tree759d57e1894de9f86f324fcb54d0b089e2b9eb8c
parentdae8deaf1f4ce56158e9385844885f7b9faa9a42 (diff)
downloadrockbox-8f11dc00ac1a0a5fe009d1d07d9a1378c3300ba8.tar.gz
rockbox-8f11dc00ac1a0a5fe009d1d07d9a1378c3300ba8.zip
usb detection in bounce, and all files use default font (not loaded)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2773 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/recorder/bounce.c43
-rw-r--r--apps/recorder/cube.c158
-rw-r--r--apps/recorder/sokoban.c9
-rw-r--r--apps/recorder/tetris.c37
-rw-r--r--apps/recorder/wormlet.c23
5 files changed, 169 insertions, 101 deletions
diff --git a/apps/recorder/bounce.c b/apps/recorder/bounce.c
index f89f699862..4f00d50470 100644
--- a/apps/recorder/bounce.c
+++ b/apps/recorder/bounce.c
@@ -28,6 +28,8 @@
28#include "menu.h" 28#include "menu.h"
29#include "sprintf.h" 29#include "sprintf.h"
30#include "rtc.h" 30#include "rtc.h"
31#include "font.h"
32#include "screens.h"
31 33
32#ifdef SIMULATOR 34#ifdef SIMULATOR
33#include <stdio.h> 35#include <stdio.h>
@@ -37,6 +39,13 @@
37#define SS_TITLE "Bouncer" 39#define SS_TITLE "Bouncer"
38#define SS_TITLE_FONT 2 40#define SS_TITLE_FONT 2
39 41
42#define LETTERS_ON_SCREEN 12
43
44#define YSPEED 2
45#define XSPEED 3
46#define YADD -4
47
48
40static unsigned char table[]={ 49static unsigned char table[]={
4126,28,30,33,35,37,39,40,42,43,45,46,46,47,47,47,47,47,46,46,45,43,42,40,39,37,35,33,30,28,26,24,21,19,17,14,12,10,8,7,5,4,2,1,1,0,0,0,0,0,1,1,2,4,5,7,8,10,12,14,17,19,21,23, 5026,28,30,33,35,37,39,40,42,43,45,46,46,47,47,47,47,47,46,46,45,43,42,40,39,37,35,33,30,28,26,24,21,19,17,14,12,10,8,7,5,4,2,1,1,0,0,0,0,0,1,1,2,4,5,7,8,10,12,14,17,19,21,23,
42}; 51};
@@ -225,12 +234,6 @@ static void addclock(void)
225 } 234 }
226} 235}
227 236
228#define LETTERS_ON_SCREEN 12
229
230#define YSPEED 2
231#define XSPEED 3
232#define YADD -4
233
234static int scrollit(void) 237static int scrollit(void)
235{ 238{
236 int b; 239 int b;
@@ -301,6 +304,12 @@ static int loopit(void)
301 b = button_get_w_tmo(HZ/10); 304 b = button_get_w_tmo(HZ/10);
302 if ( b == (BUTTON_OFF|BUTTON_REL) ) 305 if ( b == (BUTTON_OFF|BUTTON_REL) )
303 return 0; 306 return 0;
307
308 if ( b == SYS_USB_CONNECTED) {
309 usb_screen();
310 return 0;
311 }
312
304 if ( b == (BUTTON_ON|BUTTON_REL) ) 313 if ( b == (BUTTON_ON|BUTTON_REL) )
305 return 1; 314 return 1;
306 else if(b != BUTTON_NONE) 315 else if(b != BUTTON_NONE)
@@ -355,6 +364,8 @@ bool bounce(void)
355 char *off = "[Off] to stop"; 364 char *off = "[Off] to stop";
356 int len = strlen(SS_TITLE); 365 int len = strlen(SS_TITLE);
357 366
367 lcd_setfont(FONT_SYSFIXED);
368
358 lcd_getstringsize(SS_TITLE,&w, &h); 369 lcd_getstringsize(SS_TITLE,&w, &h);
359 370
360 /* Get horizontel centering for text */ 371 /* Get horizontel centering for text */
@@ -363,41 +374,43 @@ bool bounce(void)
363 len = ((len+1)/2)+(w/2); 374 len = ((len+1)/2)+(w/2);
364 else 375 else
365 len /= 2; 376 len /= 2;
366 377
367 if (h%2 != 0) 378 if (h%2 != 0)
368 h = (h/2)+1; 379 h = (h/2)+1;
369 else 380 else
370 h /= 2; 381 h /= 2;
371 382
372 lcd_clear_display(); 383 lcd_clear_display();
373 lcd_putsxy(LCD_WIDTH/2-len, (LCD_HEIGHT/2)-h, SS_TITLE); 384 lcd_putsxy(LCD_WIDTH/2-len, (LCD_HEIGHT/2)-h, SS_TITLE);
374 385
375 len = 1; 386 len = 1;
376 lcd_getstringsize(off, &w, &h); 387 lcd_getstringsize(off, &w, &h);
377 388
378 /* Get horizontel centering for text */ 389 /* Get horizontel centering for text */
379 len *= w; 390 len *= w;
380 if (len%2 != 0) 391 if (len%2 != 0)
381 len = ((len+1)/2)+(w/2); 392 len = ((len+1)/2)+(w/2);
382 else 393 else
383 len /= 2; 394 len /= 2;
384 395
385 if (h%2 != 0) 396 if (h%2 != 0)
386 h = (h/2)+1; 397 h = (h/2)+1;
387 else 398 else
388 h /= 2; 399 h /= 2;
389 400
390 lcd_putsxy(LCD_WIDTH/2-len, LCD_HEIGHT-(2*h), off); 401 lcd_putsxy(LCD_WIDTH/2-len, LCD_HEIGHT-(2*h), off);
391 402
392 lcd_update(); 403 lcd_update();
393 sleep(HZ); 404 sleep(HZ);
394 405
395 do { 406 do {
396 h= loopit(); 407 h= loopit();
397 if(h) 408 if(h)
398 h= scrollit(); 409 h = scrollit();
399 } while(h); 410 } while(h);
400 411
412 lcd_setfont(FONT_UI);
413
401 return false; 414 return false;
402} 415}
403 416
diff --git a/apps/recorder/cube.c b/apps/recorder/cube.c
index fddd294773..4ad7ebb80b 100644
--- a/apps/recorder/cube.c
+++ b/apps/recorder/cube.c
@@ -31,25 +31,33 @@
31#include "button.h" 31#include "button.h"
32#include "sprintf.h" 32#include "sprintf.h"
33#include "screens.h" 33#include "screens.h"
34#include "font.h"
34 35
35typedef struct 36/* Loops that the values are displayed */
36{long x,y,z;} point3D; 37#define DISP_TIME 30
38
39struct point_3D {
40 long x, y, z;
41};
42
43struct point_2D {
44 long x, y;
45};
37 46
38typedef struct 47static struct point_3D sommet[8];
39{long x,y;} point2D; 48static struct point_3D point3D[8];
49static struct point_2D point2D[8];
40 50
41static point3D Sommet[8]; 51static long matrice[3][3];
42static point3D Point3D[8];
43static point2D Point2D[8];
44 52
45static int Nb_points = 8; 53static int nb_points = 8;
46 54
47static int Xoff = 56; 55static int x_off = 56;
48static int Yoff = 95; 56static int y_off = 95;
49static int Zoff = 600; 57static int z_off = 600;
50 58
51/* Precalculated sine and cosine * 10000 (four digit fixed point math) */ 59/* Precalculated sine and cosine * 10000 (four digit fixed point math) */
52static int SinTable[91] = 60static int sin_table[91] =
53{ 61{
54 0, 174, 348, 523, 697, 62 0, 174, 348, 523, 697,
55 871,1045,1218,1391,1564, 63 871,1045,1218,1391,1564,
@@ -72,76 +80,83 @@ static int SinTable[91] =
72 10000 80 10000
73}; 81};
74 82
75static long Sin(int val) 83static long sin(int val)
76{ 84{
77 /* Speed improvement through sukzessive lookup */ 85 /* Speed improvement through sukzessive lookup */
78 if (val<181) 86 if (val<181)
79 { 87 {
80 if (val<91)/* phase 0-90 degree */ 88 if (val<91)
81 { 89 {
82 return (long)SinTable[val]; 90 /* phase 0-90 degree */
91 return (long)sin_table[val];
83 } 92 }
84 else/* phase 91-180 degree */ 93 else
85 { 94 {
86 return (long)SinTable[180-val]; 95 /* phase 91-180 degree */
96 return (long)sin_table[180-val];
87 } 97 }
88 } 98 }
89 else 99 else
90 { 100 {
91 if (val<271)/* phase 181-270 degree */ 101 if (val<271)
92 { 102 {
93 return (-1L)*(long)SinTable[val-180]; 103 /* phase 181-270 degree */
104 return (-1L)*(long)sin_table[val-180];
94 } 105 }
95 else/* phase 270-359 degree */ 106 else
96 { 107 {
97 return (-1L)*(long)SinTable[360-val]; 108 /* phase 270-359 degree */
109 return (-1L)*(long)sin_table[360-val];
98 } 110 }
99 } 111 }
100 return 0; 112 return 0;
101} 113}
102 114
103static long Cos(int val) 115static long cos(int val)
104{ 116{
105 /* Speed improvement through sukzessive lookup */ 117 /* Speed improvement through sukzessive lookup */
106 if (val<181) 118 if (val<181)
107 { 119 {
108 if (val<91)/* phase 0-90 degree */ 120 if (val<91)
109 { 121 {
110 return (long)SinTable[90-val]; 122 /* phase 0-90 degree */
123 return (long)sin_table[90-val];
111 } 124 }
112 else/* phase 91-180 degree */ 125 else
113 { 126 {
114 return (-1L)*(long)SinTable[val-90]; 127 /* phase 91-180 degree */
128 return (-1L)*(long)sin_table[val-90];
115 } 129 }
116 } 130 }
117 else 131 else
118 { 132 {
119 if (val<271)/* phase 181-270 degree */ 133 if (val<271)
120 { 134 {
121 return (-1L)*(long)SinTable[270-val]; 135 /* phase 181-270 degree */
136 return (-1L)*(long)sin_table[270-val];
122 } 137 }
123 else/* phase 270-359 degree */ 138 else
124 { 139 {
125 return (long)SinTable[val-270]; 140 /* phase 270-359 degree */
141 return (long)sin_table[val-270];
126 } 142 }
127 } 143 }
128 return 0; 144 return 0;
129} 145}
130 146
131static long matrice[3][3];
132 147
133static void cube_rotate(int Xa, int Ya, int Za) 148static void cube_rotate(int xa, int ya, int za)
134{ 149{
135 int i; 150 int i;
136 151
137 /* Just to prevent unnecessary lookups */ 152 /* Just to prevent unnecessary lookups */
138 long sxa,cxa,sya,cya,sza,cza; 153 long sxa,cxa,sya,cya,sza,cza;
139 sxa=Sin(Xa); 154 sxa=sin(xa);
140 cxa=Cos(Xa); 155 cxa=cos(xa);
141 sya=Sin(Ya); 156 sya=sin(ya);
142 cya=Cos(Ya); 157 cya=cos(ya);
143 sza=Sin(Za); 158 sza=sin(za);
144 cza=Cos(Za); 159 cza=cos(za);
145 160
146 /* calculate overall translation matrix */ 161 /* calculate overall translation matrix */
147 matrice[0][0] = cza*cya/10000L; 162 matrice[0][0] = cza*cya/10000L;
@@ -157,19 +172,16 @@ static void cube_rotate(int Xa, int Ya, int Za)
157 matrice[2][2] = cxa*cya/10000L; 172 matrice[2][2] = cxa*cya/10000L;
158 173
159 /* apply translation matrix to all points */ 174 /* apply translation matrix to all points */
160 for(i=0;i<Nb_points;i++) 175 for(i=0;i<nb_points;i++)
161 { 176 {
162 Point3D[i].x = matrice[0][0]*Sommet[i].x 177 point3D[i].x = matrice[0][0]*sommet[i].x + matrice[1][0]*sommet[i].y
163 + matrice[1][0]*Sommet[i].y 178 + matrice[2][0]*sommet[i].z;
164 + matrice[2][0]*Sommet[i].z; 179
165 180 point3D[i].y = matrice[0][1]*sommet[i].x + matrice[1][1]*sommet[i].y
166 Point3D[i].y = matrice[0][1]*Sommet[i].x 181 + matrice[2][1]*sommet[i].z;
167 + matrice[1][1]*Sommet[i].y 182
168 + matrice[2][1]*Sommet[i].z; 183 point3D[i].z = matrice[0][2]*sommet[i].x + matrice[1][2]*sommet[i].y
169 184 + matrice[2][2]*sommet[i].z;
170 Point3D[i].z = matrice[0][2]*Sommet[i].x
171 + matrice[1][2]*Sommet[i].y
172 + matrice[2][2]*Sommet[i].z;
173 } 185 }
174} 186}
175 187
@@ -178,31 +190,31 @@ static void cube_viewport(void)
178 int i; 190 int i;
179 191
180 /* Do viewport transformation for all points */ 192 /* Do viewport transformation for all points */
181 for(i=0;i<Nb_points;i++) 193 for(i=0;i<nb_points;i++)
182 { 194 {
183 Point2D[i].x=(((Point3D[i].x)<<8)/10000L)/ 195 point2D[i].x=(((point3D[i].x)<<8)/10000L)/
184 (Point3D[i].z/10000L+Zoff)+Xoff; 196 (point3D[i].z/10000L+z_off)+x_off;
185 Point2D[i].y=(((Point3D[i].y)<<8)/10000L)/ 197 point2D[i].y=(((point3D[i].y)<<8)/10000L)/
186 (Point3D[i].z/10000L+Zoff)+Yoff; 198 (point3D[i].z/10000L+z_off)+y_off;
187 } 199 }
188} 200}
189 201
190static void cube_init(void) 202static void cube_init(void)
191{ 203{
192 /* Original 3D-position of cube's corners */ 204 /* Original 3D-position of cube's corners */
193 Sommet[0].x = -40; Sommet[0].y = -40; Sommet[0].z = -40; 205 sommet[0].x = -40; sommet[0].y = -40; sommet[0].z = -40;
194 Sommet[1].x = 40; Sommet[1].y = -40; Sommet[1].z = -40; 206 sommet[1].x = 40; sommet[1].y = -40; sommet[1].z = -40;
195 Sommet[2].x = 40; Sommet[2].y = 40; Sommet[2].z = -40; 207 sommet[2].x = 40; sommet[2].y = 40; sommet[2].z = -40;
196 Sommet[3].x = -40; Sommet[3].y = 40; Sommet[3].z = -40; 208 sommet[3].x = -40; sommet[3].y = 40; sommet[3].z = -40;
197 Sommet[4].x = 40; Sommet[4].y = -40; Sommet[4].z = 40; 209 sommet[4].x = 40; sommet[4].y = -40; sommet[4].z = 40;
198 Sommet[5].x = -40; Sommet[5].y = -40; Sommet[5].z = 40; 210 sommet[5].x = -40; sommet[5].y = -40; sommet[5].z = 40;
199 Sommet[6].x = -40; Sommet[6].y = 40; Sommet[6].z = 40; 211 sommet[6].x = -40; sommet[6].y = 40; sommet[6].z = 40;
200 Sommet[7].x = 40; Sommet[7].y = 40; Sommet[7].z = 40; 212 sommet[7].x = 40; sommet[7].y = 40; sommet[7].z = 40;
201} 213}
202 214
203static void line(int a, int b) 215static void line(int a, int b)
204{ 216{
205 lcd_drawline(Point2D[a].x,Point2D[a].y,Point2D[b].x,Point2D[b].y); 217 lcd_drawline(point2D[a].x, point2D[a].y, point2D[b].x, point2D[b].y);
206} 218}
207 219
208static void cube_draw(void) 220static void cube_draw(void)
@@ -222,10 +234,6 @@ static void cube_draw(void)
222 line(3,6); 234 line(3,6);
223} 235}
224 236
225
226/* Loops that the values are displayed */
227#define DISP_TIME 30
228
229bool cube(void) 237bool cube(void)
230{ 238{
231 int t_disp=0; 239 int t_disp=0;
@@ -240,11 +248,14 @@ bool cube(void)
240 bool highspeed=0; 248 bool highspeed=0;
241 bool exit=0; 249 bool exit=0;
242 250
251 lcd_setfont(FONT_SYSFIXED);
252
243 cube_init(); 253 cube_init();
244 254
245 while(!exit) 255 while(!exit)
246 { 256 {
247 if (!highspeed) sleep(4); 257 if (!highspeed)
258 sleep(4);
248 259
249 lcd_clear_display(); 260 lcd_clear_display();
250 cube_rotate(xa,ya,za); 261 cube_rotate(xa,ya,za);
@@ -255,7 +266,7 @@ bool cube(void)
255 t_disp--; 266 t_disp--;
256 snprintf(buffer, 30, "x:%d y:%d z:%d h:%d",xs,ys,zs,highspeed); 267 snprintf(buffer, 30, "x:%d y:%d z:%d h:%d",xs,ys,zs,highspeed);
257 lcd_putsxy(0, 56, buffer); 268 lcd_putsxy(0, 56, buffer);
258 } 269 }
259 lcd_update(); 270 lcd_update();
260 271
261 xa+=xs; 272 xa+=xs;
@@ -322,10 +333,13 @@ bool cube(void)
322 333
323 case SYS_USB_CONNECTED: 334 case SYS_USB_CONNECTED:
324 usb_screen(); 335 usb_screen();
336 lcd_setfont(FONT_UI);
325 return true; 337 return true;
326
327 } 338 }
328 } 339 }
340
341 lcd_setfont(FONT_UI);
342
329 return false; 343 return false;
330} 344}
331 345
@@ -338,3 +352,5 @@ bool cube(void)
338 * vim: et sw=4 ts=8 sts=4 tw=78 352 * vim: et sw=4 ts=8 sts=4 tw=78
339 */ 353 */
340 354
355
356
diff --git a/apps/recorder/sokoban.c b/apps/recorder/sokoban.c
index 5081ddc8ce..bac1101838 100644
--- a/apps/recorder/sokoban.c
+++ b/apps/recorder/sokoban.c
@@ -19,6 +19,7 @@
19 19
20#include "config.h" 20#include "config.h"
21#include "options.h" 21#include "options.h"
22
22#ifdef USE_GAMES 23#ifdef USE_GAMES
23 24
24#include <sprintf.h> 25#include <sprintf.h>
@@ -28,6 +29,7 @@
28#include "kernel.h" 29#include "kernel.h"
29#include "menu.h" 30#include "menu.h"
30#include "screens.h" 31#include "screens.h"
32#include "font.h"
31 33
32#include "sokoban_levels.h" 34#include "sokoban_levels.h"
33 35
@@ -503,6 +505,8 @@ bool sokoban(void)
503 int w, h; 505 int w, h;
504 int len; 506 int len;
505 507
508 lcd_setfont(FONT_SYSFIXED);
509
506 lcd_getstringsize(SOKOBAN_TITLE, &w, &h); 510 lcd_getstringsize(SOKOBAN_TITLE, &w, &h);
507 511
508 /* Get horizontel centering for text */ 512 /* Get horizontel centering for text */
@@ -535,10 +539,9 @@ bool sokoban(void)
535 lcd_clear_display(); 539 lcd_clear_display();
536 result = sokoban_loop(); 540 result = sokoban_loop();
537 541
542 lcd_setfont(FONT_UI);
543
538 return result; 544 return result;
539} 545}
540 546
541#endif 547#endif
542
543
544
diff --git a/apps/recorder/tetris.c b/apps/recorder/tetris.c
index 9c706e9c8e..6302e40109 100644
--- a/apps/recorder/tetris.c
+++ b/apps/recorder/tetris.c
@@ -25,12 +25,13 @@
25#ifdef USE_GAMES 25#ifdef USE_GAMES
26 26
27#include <stdbool.h> 27#include <stdbool.h>
28#include <string.h>
28#include "lcd.h" 29#include "lcd.h"
29#include "button.h" 30#include "button.h"
30#include "kernel.h" 31#include "kernel.h"
31#include <string.h>
32#include "menu.h" 32#include "menu.h"
33#include "screens.h" 33#include "screens.h"
34#include "font.h"
34 35
35#ifdef SIMULATOR 36#ifdef SIMULATOR
36#include <stdio.h> 37#include <stdio.h>
@@ -46,7 +47,9 @@ static const int start_x = 5;
46static const int start_y = 5; 47static const int start_y = 5;
47static const int max_x = 4 * 17; 48static const int max_x = 4 * 17;
48static const int max_y = 3 * 10; 49static const int max_y = 3 * 10;
49static const short level_speeds[10] = {1000,900,800,700,600,500,400,300,250,200}; 50static const short level_speeds[10] = {
51 1000, 900, 800, 700, 600, 500, 400, 300, 250, 200
52};
50static const int blocks = 7; 53static const int blocks = 7;
51static const int block_frames[7] = {1,2,2,2,4,4,4}; 54static const int block_frames[7] = {1,2,2,2,4,4,4};
52 55
@@ -147,14 +150,15 @@ static void draw_block(int x, int y, int block, int frame, bool clear)
147 150
148static void to_virtual(void) 151static void to_virtual(void)
149{ 152{
150 int i,a,b; 153 int i, a, b;
151 154
152 for(i = 0; i < 4; i++) 155 for(i = 0; i < 4; i++)
153 for (a = 0; a < 3; a++) 156 for (a = 0; a < 3; a++)
154 for (b = 0; b < 4; b++) 157 for (b = 0; b < 4; b++)
155 *(virtual + 158 *(virtual +
156 (current_y + block_data[current_b][current_f][0][i] * 3 + a) * max_x + 159 (current_y + block_data[current_b][current_f][0][i] * 3 + a) *
157 current_x + block_data[current_b][current_f][1][i] * 4 - b) = current_b + 1; 160 max_x + current_x + block_data[current_b][current_f][1][i] *
161 4 - b) = current_b + 1;
158} 162}
159 163
160static bool block_touch (int x, int y) 164static bool block_touch (int x, int y)
@@ -179,7 +183,8 @@ static bool gameover(void)
179 183
180 for(i = 0; i < 4; i++){ 184 for(i = 0; i < 4; i++){
181 /* Do we have blocks touching? */ 185 /* Do we have blocks touching? */
182 if(block_touch(x + block_data[block][frame][1][i] * 4, y + block_data[block][frame][0][i] * 3)) 186 if(block_touch(x + block_data[block][frame][1][i] * 4,
187 y + block_data[block][frame][0][i] * 3))
183 { 188 {
184 /* Are we at the top of the frame? */ 189 /* Are we at the top of the frame? */
185 if(x + block_data[block][frame][1][i] * 4 >= max_x - 16) 190 if(x + block_data[block][frame][1][i] * 4 >= max_x - 16)
@@ -200,8 +205,11 @@ static bool valid_position(int x, int y, int block, int frame)
200 (x + block_data[block][frame][1][i] * 4 > max_x - 4) || 205 (x + block_data[block][frame][1][i] * 4 > max_x - 4) ||
201 (y + block_data[block][frame][0][i] * 3 < 0) || 206 (y + block_data[block][frame][0][i] * 3 < 0) ||
202 (x + block_data[block][frame][1][i] * 4 < 4) || 207 (x + block_data[block][frame][1][i] * 4 < 4) ||
203 block_touch (x + block_data[block][frame][1][i] * 4, y + block_data[block][frame][0][i] * 3)) 208 block_touch (x + block_data[block][frame][1][i] * 4,
209 y + block_data[block][frame][0][i] * 3))
210 {
204 return false; 211 return false;
212 }
205 return true; 213 return true;
206} 214}
207 215
@@ -290,7 +298,7 @@ static int check_lines(void)
290 /* move rows down */ 298 /* move rows down */
291 for(i = x; i < max_x - 1; i++) 299 for(i = x; i < max_x - 1; i++)
292 for (j = 0; j < max_y; j++) 300 for (j = 0; j < max_y; j++)
293 *(virtual + j * max_x + i) = *(virtual + j * max_x + (i + 1)); 301 *(virtual + j * max_x + i)=*(virtual + j * max_x + (i + 1));
294 302
295 x--; /* re-check this line */ 303 x--; /* re-check this line */
296 } 304 }
@@ -402,6 +410,10 @@ static void init_tetris(void)
402bool tetris(void) 410bool tetris(void)
403{ 411{
404 char buf[20]; 412 char buf[20];
413 bool val;
414
415 /* Lets use the default font */
416 lcd_setfont(FONT_SYSFIXED);
405 417
406 init_tetris(); 418 init_tetris();
407 419
@@ -413,7 +425,14 @@ bool tetris(void)
413 next_b = t_rand(blocks); 425 next_b = t_rand(blocks);
414 next_f = t_rand(block_frames[next_b]); 426 next_f = t_rand(block_frames[next_b]);
415 new_block(); 427 new_block();
416 return game_loop(); 428 val = game_loop();
429
430 lcd_setfont(FONT_UI);
431
432 return val;
417} 433}
418 434
419#endif 435#endif
436
437
438
diff --git a/apps/recorder/wormlet.c b/apps/recorder/wormlet.c
index 76f70169b5..f1654227ff 100644
--- a/apps/recorder/wormlet.c
+++ b/apps/recorder/wormlet.c
@@ -35,6 +35,7 @@
35#include "rtc.h" 35#include "rtc.h"
36#include "lang.h" 36#include "lang.h"
37#include "screens.h" 37#include "screens.h"
38#include "font.h"
38 39
39/* size of the field the worm lives in */ 40/* size of the field the worm lives in */
40#define FIELD_RECT_X 1 41#define FIELD_RECT_X 1
@@ -1891,8 +1892,11 @@ extern bool use_old_rect;
1891 */ 1892 */
1892bool wormlet(void) 1893bool wormlet(void)
1893{ 1894{
1894 bool wormDead = false; 1895 bool worm_dead = false;
1895 int button; 1896 int button;
1897
1898 lcd_setfont(FONT_SYSFIXED);
1899
1896#ifdef DEBUG_WORMLET 1900#ifdef DEBUG_WORMLET
1897 testline_in_rect(); 1901 testline_in_rect();
1898 test_worm_argh_collision_in_moves(); 1902 test_worm_argh_collision_in_moves();
@@ -1978,6 +1982,7 @@ bool wormlet(void)
1978 1982
1979 case SYS_USB_CONNECTED: 1983 case SYS_USB_CONNECTED:
1980 usb_screen(); 1984 usb_screen();
1985 lcd_setfont(FONT_UI);
1981 return true; 1986 return true;
1982 } 1987 }
1983 } while (button != BUTTON_PLAY && 1988 } while (button != BUTTON_PLAY &&
@@ -1997,11 +2002,11 @@ bool wormlet(void)
1997 button = BUTTON_OFF; 2002 button = BUTTON_OFF;
1998 2003
1999 /* start the game */ 2004 /* start the game */
2000 wormDead = run(); 2005 worm_dead = run();
2001 2006
2002 /* if worm isn't dead the game was quit 2007 /* if worm isn't dead the game was quit
2003 via BUTTON_OFF -> no need to wait for buttons. */ 2008 via BUTTON_OFF -> no need to wait for buttons. */
2004 if (wormDead) { 2009 if (worm_dead) {
2005 do { 2010 do {
2006 button = button_get(true); 2011 button = button_get(true);
2007 } 2012 }
@@ -2012,8 +2017,20 @@ bool wormlet(void)
2012 } 2017 }
2013 while (button != BUTTON_OFF); 2018 while (button != BUTTON_OFF);
2014 2019
2020 lcd_setfont(FONT_UI);
2021
2015 return false; 2022 return false;
2016} 2023}
2017 2024
2018 2025
2019#endif /* USE_GAMES */ 2026#endif /* USE_GAMES */
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036