diff options
Diffstat (limited to 'apps/recorder')
-rw-r--r-- | apps/recorder/bounce.c | 16 | ||||
-rw-r--r-- | apps/recorder/icons.c | 15 | ||||
-rw-r--r-- | apps/recorder/oscillograph.c | 6 | ||||
-rw-r--r-- | apps/recorder/sokoban.c | 27 | ||||
-rw-r--r-- | apps/recorder/tetris.c | 6 | ||||
-rw-r--r-- | apps/recorder/wormlet.c | 54 |
6 files changed, 64 insertions, 60 deletions
diff --git a/apps/recorder/bounce.c b/apps/recorder/bounce.c index fc11aefe68..cfb194e7ec 100644 --- a/apps/recorder/bounce.c +++ b/apps/recorder/bounce.c | |||
@@ -224,7 +224,7 @@ static void loopit(void) | |||
224 | } | 224 | } |
225 | snprintf(buffer, 30, "%s: %d", | 225 | snprintf(buffer, 30, "%s: %d", |
226 | values[show].what, values[show].num); | 226 | values[show].what, values[show].num); |
227 | lcd_putsxy(0, 56, buffer, 0); | 227 | lcd_putsxy(0, 56, buffer); |
228 | timeout--; | 228 | timeout--; |
229 | } | 229 | } |
230 | for(i=0, yy=y, xx=x; | 230 | for(i=0, yy=y, xx=x; |
@@ -241,13 +241,13 @@ static void loopit(void) | |||
241 | } | 241 | } |
242 | 242 | ||
243 | 243 | ||
244 | Menu bounce(void) | 244 | bool bounce(void) |
245 | { | 245 | { |
246 | int w, h; | 246 | int w, h; |
247 | char *off = "[Off] to stop"; | 247 | char *off = "[Off] to stop"; |
248 | int len = strlen(SS_TITLE); | 248 | int len = strlen(SS_TITLE); |
249 | 249 | ||
250 | lcd_getfontsize(SS_TITLE_FONT, &w, &h); | 250 | lcd_getstringsize(SS_TITLE,&w, &h); |
251 | 251 | ||
252 | /* Get horizontel centering for text */ | 252 | /* Get horizontel centering for text */ |
253 | len *= w; | 253 | len *= w; |
@@ -262,10 +262,10 @@ Menu bounce(void) | |||
262 | h /= 2; | 262 | h /= 2; |
263 | 263 | ||
264 | lcd_clear_display(); | 264 | lcd_clear_display(); |
265 | lcd_putsxy(LCD_WIDTH/2-len, (LCD_HEIGHT/2)-h, SS_TITLE, SS_TITLE_FONT); | 265 | lcd_putsxy(LCD_WIDTH/2-len, (LCD_HEIGHT/2)-h, SS_TITLE); |
266 | 266 | ||
267 | len = strlen(off); | 267 | len = 1; |
268 | lcd_getfontsize(0, &w, &h); | 268 | lcd_getstringsize(off, &w, &h); |
269 | 269 | ||
270 | /* Get horizontel centering for text */ | 270 | /* Get horizontel centering for text */ |
271 | len *= w; | 271 | len *= w; |
@@ -279,13 +279,13 @@ Menu bounce(void) | |||
279 | else | 279 | else |
280 | h /= 2; | 280 | h /= 2; |
281 | 281 | ||
282 | lcd_putsxy(LCD_WIDTH/2-len, LCD_HEIGHT-(2*h), off,0); | 282 | lcd_putsxy(LCD_WIDTH/2-len, LCD_HEIGHT-(2*h), off); |
283 | 283 | ||
284 | lcd_update(); | 284 | lcd_update(); |
285 | sleep(HZ); | 285 | sleep(HZ); |
286 | loopit(); | 286 | loopit(); |
287 | 287 | ||
288 | return MENU_OK; | 288 | return false; |
289 | } | 289 | } |
290 | 290 | ||
291 | #endif | 291 | #endif |
diff --git a/apps/recorder/icons.c b/apps/recorder/icons.c index 76169fe0ee..6414a17418 100644 --- a/apps/recorder/icons.c +++ b/apps/recorder/icons.c | |||
@@ -235,10 +235,12 @@ void statusbar_icon_volume(int percent) | |||
235 | /* display volume lever numerical? */ | 235 | /* display volume lever numerical? */ |
236 | if (TIME_BEFORE(current_tick,switch_tick)) { | 236 | if (TIME_BEFORE(current_tick,switch_tick)) { |
237 | snprintf(buffer, sizeof(buffer), "%2d", percent); | 237 | snprintf(buffer, sizeof(buffer), "%2d", percent); |
238 | lcd_getstringsize(buffer, FONT_SYSFIXED, &width, &height); | 238 | lcd_setfont(FONT_SYSFIXED); |
239 | lcd_getstringsize(buffer, &width, &height); | ||
239 | if (height <= STATUSBAR_HEIGHT) | 240 | if (height <= STATUSBAR_HEIGHT) |
240 | lcd_putsxy(ICON_VOLUME_X_POS + ICON_VOLUME_WIDTH / 2 - | 241 | lcd_putsxy(ICON_VOLUME_X_POS + ICON_VOLUME_WIDTH / 2 - |
241 | width/2, STATUSBAR_Y_POS, buffer, FONT_SYSFIXED); | 242 | width/2, STATUSBAR_Y_POS, buffer); |
243 | lcd_setfont(FONT_UI); | ||
242 | } | 244 | } |
243 | else { /* display volume bar */ | 245 | else { /* display volume bar */ |
244 | volume = volume * 14 / 100; | 246 | volume = volume * 14 / 100; |
@@ -246,7 +248,8 @@ void statusbar_icon_volume(int percent) | |||
246 | if(i%2 == 0) | 248 | if(i%2 == 0) |
247 | step++; | 249 | step++; |
248 | for(j=1; j <= step; j++) | 250 | for(j=1; j <= step; j++) |
249 | lcd_drawpixel(ICON_VOLUME_X_POS + i, STATUSBAR_Y_POS + 7 - j); | 251 | lcd_drawpixel(ICON_VOLUME_X_POS + i, |
252 | STATUSBAR_Y_POS + 7 - j); | ||
250 | } | 253 | } |
251 | } | 254 | } |
252 | } | 255 | } |
@@ -307,8 +310,10 @@ void statusbar_time(int hour, int minute) | |||
307 | strncpy(buffer, "--:--", sizeof buffer); | 310 | strncpy(buffer, "--:--", sizeof buffer); |
308 | } | 311 | } |
309 | 312 | ||
310 | lcd_getstringsize(buffer, FONT_SYSFIXED, &width, &height); | 313 | lcd_setfont(FONT_SYSFIXED); |
314 | lcd_getstringsize(buffer, &width, &height); | ||
311 | if (height <= STATUSBAR_HEIGHT) | 315 | if (height <= STATUSBAR_HEIGHT) |
312 | lcd_putsxy(TIME_X_END - width, STATUSBAR_Y_POS, buffer, FONT_SYSFIXED); | 316 | lcd_putsxy(TIME_X_END - width, STATUSBAR_Y_POS, buffer); |
317 | lcd_setfont(FONT_UI); | ||
313 | } | 318 | } |
314 | #endif | 319 | #endif |
diff --git a/apps/recorder/oscillograph.c b/apps/recorder/oscillograph.c index c3b76c4626..25ae10f01b 100644 --- a/apps/recorder/oscillograph.c +++ b/apps/recorder/oscillograph.c | |||
@@ -45,7 +45,7 @@ static int drawMode = DRAW_MODE_FILLED; | |||
45 | * hardware scrolling of the display. The user can change | 45 | * hardware scrolling of the display. The user can change |
46 | * speed | 46 | * speed |
47 | */ | 47 | */ |
48 | Menu oscillograph(void) | 48 | bool oscillograph(void) |
49 | { | 49 | { |
50 | /* stores current volume value left */ | 50 | /* stores current volume value left */ |
51 | int left; | 51 | int left; |
@@ -184,7 +184,7 @@ Menu oscillograph(void) | |||
184 | if (draw) { | 184 | if (draw) { |
185 | char buf[16]; | 185 | char buf[16]; |
186 | snprintf(buf, sizeof buf, "Speed: %d", -speed); | 186 | snprintf(buf, sizeof buf, "Speed: %d", -speed); |
187 | lcd_putsxy(0, (y + LCD_HEIGHT - 8) % LCD_HEIGHT, buf, 0); | 187 | lcd_putsxy(0, (y + LCD_HEIGHT - 8) % LCD_HEIGHT, buf); |
188 | lcd_update_rect(0, (y + LCD_HEIGHT - 8) % LCD_HEIGHT, | 188 | lcd_update_rect(0, (y + LCD_HEIGHT - 8) % LCD_HEIGHT, |
189 | LCD_WIDTH, 8); | 189 | LCD_WIDTH, 8); |
190 | } | 190 | } |
@@ -197,5 +197,5 @@ Menu oscillograph(void) | |||
197 | lcd_update(); | 197 | lcd_update(); |
198 | 198 | ||
199 | /* standard return */ | 199 | /* standard return */ |
200 | return MENU_OK; | 200 | return false; |
201 | } | 201 | } |
diff --git a/apps/recorder/sokoban.c b/apps/recorder/sokoban.c index 3e5d447ae9..68961f775d 100644 --- a/apps/recorder/sokoban.c +++ b/apps/recorder/sokoban.c | |||
@@ -1846,14 +1846,14 @@ static void update_screen(void) { | |||
1846 | 1846 | ||
1847 | 1847 | ||
1848 | snprintf (s, sizeof(s), "%d", current_level+1); | 1848 | snprintf (s, sizeof(s), "%d", current_level+1); |
1849 | lcd_putsxy (86, 22, s, 0); | 1849 | lcd_putsxy (86, 22, s); |
1850 | snprintf (s, sizeof(s), "%d", moves); | 1850 | snprintf (s, sizeof(s), "%d", moves); |
1851 | lcd_putsxy (86, 54, s, 0); | 1851 | lcd_putsxy (86, 54, s); |
1852 | 1852 | ||
1853 | lcd_drawrect (80,0,32,32); | 1853 | lcd_drawrect (80,0,32,32); |
1854 | lcd_drawrect (80,32,32,64); | 1854 | lcd_drawrect (80,32,32,64); |
1855 | lcd_putsxy (81, 10, str(LANG_SOKOBAN_LEVEL), 0); | 1855 | lcd_putsxy (81, 10, str(LANG_SOKOBAN_LEVEL)); |
1856 | lcd_putsxy (81, 42, str(LANG_SOKOBAN_MOVE), 0); | 1856 | lcd_putsxy (81, 42, str(LANG_SOKOBAN_MOVE)); |
1857 | /* print out the screen */ | 1857 | /* print out the screen */ |
1858 | lcd_update(); | 1858 | lcd_update(); |
1859 | } | 1859 | } |
@@ -2197,7 +2197,7 @@ static bool sokoban_loop(void) | |||
2197 | if (current_level == NUM_LEVELS) { | 2197 | if (current_level == NUM_LEVELS) { |
2198 | for(ii=0; ii<30 ; ii++) { | 2198 | for(ii=0; ii<30 ; ii++) { |
2199 | lcd_clear_display(); | 2199 | lcd_clear_display(); |
2200 | lcd_putsxy(10, 20, str(LANG_SOKOBAN_WIN), 2); | 2200 | lcd_putsxy(10, 20, str(LANG_SOKOBAN_WIN)); |
2201 | lcd_update(); | 2201 | lcd_update(); |
2202 | lcd_invertrect(0,0,111,63); | 2202 | lcd_invertrect(0,0,111,63); |
2203 | lcd_update(); | 2203 | lcd_update(); |
@@ -2220,12 +2220,12 @@ bool sokoban(void) | |||
2220 | { | 2220 | { |
2221 | bool result; | 2221 | bool result; |
2222 | int w, h; | 2222 | int w, h; |
2223 | int len = strlen(SOKOBAN_TITLE); | 2223 | int len; |
2224 | 2224 | ||
2225 | lcd_getfontsize(SOKOBAN_TITLE_FONT, &w, &h); | 2225 | lcd_getstringsize(SOKOBAN_TITLE, &w, &h); |
2226 | 2226 | ||
2227 | /* Get horizontel centering for text */ | 2227 | /* Get horizontel centering for text */ |
2228 | len *= w; | 2228 | len = w; |
2229 | if (len%2 != 0) | 2229 | if (len%2 != 0) |
2230 | len = ((len+1)/2)+(w/2); | 2230 | len = ((len+1)/2)+(w/2); |
2231 | else | 2231 | else |
@@ -2237,18 +2237,17 @@ bool sokoban(void) | |||
2237 | h /= 2; | 2237 | h /= 2; |
2238 | 2238 | ||
2239 | lcd_clear_display(); | 2239 | lcd_clear_display(); |
2240 | lcd_putsxy(LCD_WIDTH/2-len, (LCD_HEIGHT/2)-h, SOKOBAN_TITLE, | 2240 | lcd_putsxy(LCD_WIDTH/2-len, (LCD_HEIGHT/2)-h, SOKOBAN_TITLE); |
2241 | SOKOBAN_TITLE_FONT); | ||
2242 | 2241 | ||
2243 | lcd_update(); | 2242 | lcd_update(); |
2244 | sleep(HZ*2); | 2243 | sleep(HZ*2); |
2245 | 2244 | ||
2246 | lcd_clear_display(); | 2245 | lcd_clear_display(); |
2247 | 2246 | ||
2248 | lcd_putsxy( 3,12, str(LANG_SOKOBAN_QUIT), 0); | 2247 | lcd_putsxy( 3,12, str(LANG_SOKOBAN_QUIT)); |
2249 | lcd_putsxy( 3,22, str(LANG_SOKOBAN_F1),0); | 2248 | lcd_putsxy( 3,22, str(LANG_SOKOBAN_F1)); |
2250 | lcd_putsxy( 3,32, str(LANG_SOKOBAN_F2),0); | 2249 | lcd_putsxy( 3,32, str(LANG_SOKOBAN_F2)); |
2251 | lcd_putsxy( 3,42, str(LANG_SOKOBAN_F3),0); | 2250 | lcd_putsxy( 3,42, str(LANG_SOKOBAN_F3)); |
2252 | 2251 | ||
2253 | lcd_update(); | 2252 | lcd_update(); |
2254 | sleep(HZ*2); | 2253 | sleep(HZ*2); |
diff --git a/apps/recorder/tetris.c b/apps/recorder/tetris.c index 5264b8e789..53012fd717 100644 --- a/apps/recorder/tetris.c +++ b/apps/recorder/tetris.c | |||
@@ -319,7 +319,7 @@ static void move_down(void) | |||
319 | } | 319 | } |
320 | 320 | ||
321 | snprintf (s, sizeof(s), "%d Rows - Level %d", lines, level); | 321 | snprintf (s, sizeof(s), "%d Rows - Level %d", lines, level); |
322 | lcd_putsxy (2, 42, s, 0); | 322 | lcd_putsxy (2, 42, s); |
323 | 323 | ||
324 | new_block(); | 324 | new_block(); |
325 | move_block(0,0,0); | 325 | move_block(0,0,0); |
@@ -371,7 +371,7 @@ static bool game_loop(void) | |||
371 | if(gameover()) | 371 | if(gameover()) |
372 | { | 372 | { |
373 | lcd_clearrect(0, 52, LCD_WIDTH, LCD_HEIGHT - 52); | 373 | lcd_clearrect(0, 52, LCD_WIDTH, LCD_HEIGHT - 52); |
374 | lcd_putsxy (2, 52, str(LANG_TETRIS_LOSE), 0); | 374 | lcd_putsxy (2, 52, str(LANG_TETRIS_LOSE)); |
375 | lcd_update(); | 375 | lcd_update(); |
376 | sleep(HZ * 3); | 376 | sleep(HZ * 3); |
377 | return false; | 377 | return false; |
@@ -403,7 +403,7 @@ bool tetris(void) | |||
403 | init_tetris(); | 403 | init_tetris(); |
404 | 404 | ||
405 | draw_frame(start_x, start_x + max_x - 1, start_y - 1, start_y + max_y); | 405 | draw_frame(start_x, start_x + max_x - 1, start_y - 1, start_y + max_y); |
406 | lcd_putsxy (2, 42, str(LANG_TETRIS_LEVEL), 0); | 406 | lcd_putsxy (2, 42, str(LANG_TETRIS_LEVEL)); |
407 | lcd_update(); | 407 | lcd_update(); |
408 | 408 | ||
409 | next_b = t_rand(blocks); | 409 | next_b = t_rand(blocks); |
diff --git a/apps/recorder/wormlet.c b/apps/recorder/wormlet.c index 0edd550966..5fb48aa48e 100644 --- a/apps/recorder/wormlet.c +++ b/apps/recorder/wormlet.c | |||
@@ -1213,8 +1213,8 @@ static void score_board(void) | |||
1213 | snprintf(buf2, sizeof(buf2), str(LANG_WORMLET_CRASHED)); | 1213 | snprintf(buf2, sizeof(buf2), str(LANG_WORMLET_CRASHED)); |
1214 | break; | 1214 | break; |
1215 | } | 1215 | } |
1216 | lcd_putsxy(FIELD_RECT_WIDTH + 3, y , buf, 0); | 1216 | lcd_putsxy(FIELD_RECT_WIDTH + 3, y , buf); |
1217 | lcd_putsxy(FIELD_RECT_WIDTH + 3, y+8, buf2, 0); | 1217 | lcd_putsxy(FIELD_RECT_WIDTH + 3, y+8, buf2); |
1218 | 1218 | ||
1219 | if (!worms[i].alive){ | 1219 | if (!worms[i].alive){ |
1220 | lcd_invertrect(FIELD_RECT_WIDTH + 2, y, | 1220 | lcd_invertrect(FIELD_RECT_WIDTH + 2, y, |
@@ -1224,9 +1224,9 @@ static void score_board(void) | |||
1224 | } | 1224 | } |
1225 | snprintf(buf , sizeof(buf), str(LANG_WORMLET_HIGHSCORE), highscore); | 1225 | snprintf(buf , sizeof(buf), str(LANG_WORMLET_HIGHSCORE), highscore); |
1226 | #ifndef DEBUG_WORMLET | 1226 | #ifndef DEBUG_WORMLET |
1227 | lcd_putsxy(FIELD_RECT_WIDTH + 3, LCD_HEIGHT - 8, buf, 0); | 1227 | lcd_putsxy(FIELD_RECT_WIDTH + 3, LCD_HEIGHT - 8, buf); |
1228 | #else | 1228 | #else |
1229 | lcd_putsxy(FIELD_RECT_WIDTH + 3, LCD_HEIGHT - 8, debugout, 0); | 1229 | lcd_putsxy(FIELD_RECT_WIDTH + 3, LCD_HEIGHT - 8, debugout); |
1230 | #endif | 1230 | #endif |
1231 | } | 1231 | } |
1232 | 1232 | ||
@@ -1451,7 +1451,7 @@ static void test_worm_food_collision(void) { | |||
1451 | collision_count++; | 1451 | collision_count++; |
1452 | } | 1452 | } |
1453 | snprintf(buf, sizeof buf, "collisions: %d", collision_count); | 1453 | snprintf(buf, sizeof buf, "collisions: %d", collision_count); |
1454 | lcd_putsxy(0, LCD_HEIGHT -8, buf, 0); | 1454 | lcd_putsxy(0, LCD_HEIGHT -8, buf); |
1455 | lcd_update(); | 1455 | lcd_update(); |
1456 | } | 1456 | } |
1457 | if (collision_count != FOOD_SIZE) { | 1457 | if (collision_count != FOOD_SIZE) { |
@@ -1470,7 +1470,7 @@ static void test_worm_food_collision(void) { | |||
1470 | collision_count ++; | 1470 | collision_count ++; |
1471 | } | 1471 | } |
1472 | snprintf(buf, sizeof buf, "collisions: %d", collision_count); | 1472 | snprintf(buf, sizeof buf, "collisions: %d", collision_count); |
1473 | lcd_putsxy(0, LCD_HEIGHT -8, buf, 0); | 1473 | lcd_putsxy(0, LCD_HEIGHT -8, buf); |
1474 | lcd_update(); | 1474 | lcd_update(); |
1475 | } | 1475 | } |
1476 | if (collision_count != FOOD_SIZE * 2) { | 1476 | if (collision_count != FOOD_SIZE * 2) { |
@@ -1518,7 +1518,7 @@ static void test_worm_argh_collision(void) { | |||
1518 | collision_count ++; | 1518 | collision_count ++; |
1519 | } | 1519 | } |
1520 | snprintf(buf, sizeof buf, "collisions: %d", collision_count); | 1520 | snprintf(buf, sizeof buf, "collisions: %d", collision_count); |
1521 | lcd_putsxy(0, LCD_HEIGHT -8, buf, 0); | 1521 | lcd_putsxy(0, LCD_HEIGHT -8, buf); |
1522 | lcd_update(); | 1522 | lcd_update(); |
1523 | } | 1523 | } |
1524 | if (collision_count != ARGH_SIZE * 2) { | 1524 | if (collision_count != ARGH_SIZE * 2) { |
@@ -1535,7 +1535,7 @@ static void test_worm_argh_collision(void) { | |||
1535 | collision_count ++; | 1535 | collision_count ++; |
1536 | } | 1536 | } |
1537 | snprintf(buf, sizeof buf, "collisions: %d", collision_count); | 1537 | snprintf(buf, sizeof buf, "collisions: %d", collision_count); |
1538 | lcd_putsxy(0, LCD_HEIGHT -8, buf, 0); | 1538 | lcd_putsxy(0, LCD_HEIGHT -8, buf); |
1539 | lcd_update(); | 1539 | lcd_update(); |
1540 | } | 1540 | } |
1541 | if (collision_count != ARGH_SIZE * 4) { | 1541 | if (collision_count != ARGH_SIZE * 4) { |
@@ -1562,7 +1562,7 @@ static int testline_in_rect(void) { | |||
1562 | lcd_drawrect(rx, ry, rw, rh); | 1562 | lcd_drawrect(rx, ry, rw, rh); |
1563 | lcd_drawline(x1, y1, x2, y2); | 1563 | lcd_drawline(x1, y1, x2, y2); |
1564 | lcd_update(); | 1564 | lcd_update(); |
1565 | lcd_putsxy(0, 0, "failed 1", 0); | 1565 | lcd_putsxy(0, 0, "failed 1"); |
1566 | button_get(true); | 1566 | button_get(true); |
1567 | testfailed = 1; | 1567 | testfailed = 1; |
1568 | } | 1568 | } |
@@ -1573,7 +1573,7 @@ static int testline_in_rect(void) { | |||
1573 | !line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh)) { | 1573 | !line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh)) { |
1574 | lcd_drawrect(rx, ry, rw, rh); | 1574 | lcd_drawrect(rx, ry, rw, rh); |
1575 | lcd_drawline(x1, y1, x2, y2); | 1575 | lcd_drawline(x1, y1, x2, y2); |
1576 | lcd_putsxy(0, 0, "failed 2", 0); | 1576 | lcd_putsxy(0, 0, "failed 2"); |
1577 | lcd_update(); | 1577 | lcd_update(); |
1578 | button_get(true); | 1578 | button_get(true); |
1579 | testfailed = 2; | 1579 | testfailed = 2; |
@@ -1585,7 +1585,7 @@ static int testline_in_rect(void) { | |||
1585 | !line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh)) { | 1585 | !line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh)) { |
1586 | lcd_drawrect(rx, ry, rw, rh); | 1586 | lcd_drawrect(rx, ry, rw, rh); |
1587 | lcd_drawline(x1, y1, x2, y2); | 1587 | lcd_drawline(x1, y1, x2, y2); |
1588 | lcd_putsxy(0, 0, "failed 3", 0); | 1588 | lcd_putsxy(0, 0, "failed 3"); |
1589 | lcd_update(); | 1589 | lcd_update(); |
1590 | button_get(true); | 1590 | button_get(true); |
1591 | testfailed = 3; | 1591 | testfailed = 3; |
@@ -1597,7 +1597,7 @@ static int testline_in_rect(void) { | |||
1597 | !line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh)) { | 1597 | !line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh)) { |
1598 | lcd_drawrect(rx, ry, rw, rh); | 1598 | lcd_drawrect(rx, ry, rw, rh); |
1599 | lcd_drawline(x1, y1, x2, y2); | 1599 | lcd_drawline(x1, y1, x2, y2); |
1600 | lcd_putsxy(0, 0, "failed 4", 0); | 1600 | lcd_putsxy(0, 0, "failed 4"); |
1601 | lcd_update(); | 1601 | lcd_update(); |
1602 | button_get(true); | 1602 | button_get(true); |
1603 | testfailed = 4; | 1603 | testfailed = 4; |
@@ -1609,7 +1609,7 @@ static int testline_in_rect(void) { | |||
1609 | line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh)) { | 1609 | line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh)) { |
1610 | lcd_drawrect(rx, ry, rw, rh); | 1610 | lcd_drawrect(rx, ry, rw, rh); |
1611 | lcd_drawline(x1, y1, x2, y2); | 1611 | lcd_drawline(x1, y1, x2, y2); |
1612 | lcd_putsxy(0, 0, "failed 5", 0); | 1612 | lcd_putsxy(0, 0, "failed 5"); |
1613 | lcd_update(); | 1613 | lcd_update(); |
1614 | button_get(true); | 1614 | button_get(true); |
1615 | testfailed = 5; | 1615 | testfailed = 5; |
@@ -1622,7 +1622,7 @@ static int testline_in_rect(void) { | |||
1622 | line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh)) { | 1622 | line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh)) { |
1623 | lcd_drawrect(rx, ry, rw, rh); | 1623 | lcd_drawrect(rx, ry, rw, rh); |
1624 | lcd_drawline(x1, y1, x2, y2); | 1624 | lcd_drawline(x1, y1, x2, y2); |
1625 | lcd_putsxy(0, 0, "failed 6", 0); | 1625 | lcd_putsxy(0, 0, "failed 6"); |
1626 | lcd_update(); | 1626 | lcd_update(); |
1627 | button_get(true); | 1627 | button_get(true); |
1628 | testfailed = 6; | 1628 | testfailed = 6; |
@@ -1637,7 +1637,7 @@ static int testline_in_rect(void) { | |||
1637 | !line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh)) { | 1637 | !line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh)) { |
1638 | lcd_drawrect(rx, ry, rw, rh); | 1638 | lcd_drawrect(rx, ry, rw, rh); |
1639 | lcd_drawline(x1, y1, x2, y2); | 1639 | lcd_drawline(x1, y1, x2, y2); |
1640 | lcd_putsxy(0, 0, "failed 7", 0); | 1640 | lcd_putsxy(0, 0, "failed 7"); |
1641 | lcd_update(); | 1641 | lcd_update(); |
1642 | button_get(true); | 1642 | button_get(true); |
1643 | testfailed = 7; | 1643 | testfailed = 7; |
@@ -1649,7 +1649,7 @@ static int testline_in_rect(void) { | |||
1649 | !line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh)) { | 1649 | !line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh)) { |
1650 | lcd_drawrect(rx, ry, rw, rh); | 1650 | lcd_drawrect(rx, ry, rw, rh); |
1651 | lcd_drawline(x1, y1, x2, y2); | 1651 | lcd_drawline(x1, y1, x2, y2); |
1652 | lcd_putsxy(0, 0, "failed 8", 0); | 1652 | lcd_putsxy(0, 0, "failed 8"); |
1653 | lcd_update(); | 1653 | lcd_update(); |
1654 | button_get(true); | 1654 | button_get(true); |
1655 | testfailed = 8; | 1655 | testfailed = 8; |
@@ -1661,7 +1661,7 @@ static int testline_in_rect(void) { | |||
1661 | !line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh)) { | 1661 | !line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh)) { |
1662 | lcd_drawrect(rx, ry, rw, rh); | 1662 | lcd_drawrect(rx, ry, rw, rh); |
1663 | lcd_drawline(x1, y1, x2, y2); | 1663 | lcd_drawline(x1, y1, x2, y2); |
1664 | lcd_putsxy(0, 0, "failed 9", 0); | 1664 | lcd_putsxy(0, 0, "failed 9"); |
1665 | lcd_update(); | 1665 | lcd_update(); |
1666 | button_get(true); | 1666 | button_get(true); |
1667 | testfailed = 9; | 1667 | testfailed = 9; |
@@ -1673,7 +1673,7 @@ static int testline_in_rect(void) { | |||
1673 | !line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh)) { | 1673 | !line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh)) { |
1674 | lcd_drawrect(rx, ry, rw, rh); | 1674 | lcd_drawrect(rx, ry, rw, rh); |
1675 | lcd_drawline(x1, y1, x2, y2); | 1675 | lcd_drawline(x1, y1, x2, y2); |
1676 | lcd_putsxy(0, 0, "failed 10", 0); | 1676 | lcd_putsxy(0, 0, "failed 10"); |
1677 | lcd_update(); | 1677 | lcd_update(); |
1678 | button_get(true); | 1678 | button_get(true); |
1679 | testfailed = 10; | 1679 | testfailed = 10; |
@@ -1685,7 +1685,7 @@ static int testline_in_rect(void) { | |||
1685 | line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh)) { | 1685 | line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh)) { |
1686 | lcd_drawrect(rx, ry, rw, rh); | 1686 | lcd_drawrect(rx, ry, rw, rh); |
1687 | lcd_drawline(x1, y1, x2, y2); | 1687 | lcd_drawline(x1, y1, x2, y2); |
1688 | lcd_putsxy(0, 0, "failed 11", 0); | 1688 | lcd_putsxy(0, 0, "failed 11"); |
1689 | lcd_update(); | 1689 | lcd_update(); |
1690 | button_get(true); | 1690 | button_get(true); |
1691 | testfailed = 11; | 1691 | testfailed = 11; |
@@ -1698,7 +1698,7 @@ static int testline_in_rect(void) { | |||
1698 | line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh)) { | 1698 | line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh)) { |
1699 | lcd_drawrect(rx, ry, rw, rh); | 1699 | lcd_drawrect(rx, ry, rw, rh); |
1700 | lcd_drawline(x1, y1, x2, y2); | 1700 | lcd_drawline(x1, y1, x2, y2); |
1701 | lcd_putsxy(0, 0, "failed 12", 0); | 1701 | lcd_putsxy(0, 0, "failed 12"); |
1702 | lcd_update(); | 1702 | lcd_update(); |
1703 | button_get(true); | 1703 | button_get(true); |
1704 | testfailed = 12; | 1704 | testfailed = 12; |
@@ -1715,10 +1715,10 @@ static int testline_in_rect(void) { | |||
1715 | x2 = 10; | 1715 | x2 = 10; |
1716 | y2 = 20; | 1716 | y2 = 20; |
1717 | if (!(line_in_rect(x1, y1, x2, y2, rx, ry, rw, rh) && | 1717 | if (!(line_in_rect(x1, y1, x2, y2, rx, ry, rw, rh) && |
1718 | line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh))) { | 1718 | line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh))) { |
1719 | lcd_drawrect(rx, ry, rw, rh); | 1719 | lcd_drawrect(rx, ry, rw, rh); |
1720 | lcd_drawline(x1, y1, x2, y2); | 1720 | lcd_drawline(x1, y1, x2, y2); |
1721 | lcd_putsxy(0, 0, "failed 13", 0); | 1721 | lcd_putsxy(0, 0, "failed 13"); |
1722 | lcd_update(); | 1722 | lcd_update(); |
1723 | button_get(true); | 1723 | button_get(true); |
1724 | testfailed = 13; | 1724 | testfailed = 13; |
@@ -1735,10 +1735,10 @@ static int testline_in_rect(void) { | |||
1735 | x2 = 10; | 1735 | x2 = 10; |
1736 | y2 = 19; | 1736 | y2 = 19; |
1737 | if (!(line_in_rect(x1, y1, x2, y2, rx, ry, rw, rh) && | 1737 | if (!(line_in_rect(x1, y1, x2, y2, rx, ry, rw, rh) && |
1738 | line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh))) { | 1738 | line_in_rect(x2, y2, x1, y1, rx, ry, rw, rh))) { |
1739 | lcd_drawline(x1, y1, x2, y2); | 1739 | lcd_drawline(x1, y1, x2, y2); |
1740 | lcd_invertrect(rx, ry, rw, rh); | 1740 | lcd_invertrect(rx, ry, rw, rh); |
1741 | lcd_putsxy(0, 0, "failed 14", 0); | 1741 | lcd_putsxy(0, 0, "failed 14"); |
1742 | lcd_update(); | 1742 | lcd_update(); |
1743 | button_get(true); | 1743 | button_get(true); |
1744 | testfailed = 14; | 1744 | testfailed = 14; |
@@ -1780,7 +1780,7 @@ static int test_specific_worm_collision(void) { | |||
1780 | } | 1780 | } |
1781 | lcd_invertpixel(x + FIELD_RECT_X, y + FIELD_RECT_Y); | 1781 | lcd_invertpixel(x + FIELD_RECT_X, y + FIELD_RECT_Y); |
1782 | snprintf(buf, sizeof buf, "collisions %d", collisions); | 1782 | snprintf(buf, sizeof buf, "collisions %d", collisions); |
1783 | lcd_putsxy(0, LCD_HEIGHT - 8, buf, 0); | 1783 | lcd_putsxy(0, LCD_HEIGHT - 8, buf); |
1784 | lcd_update(); | 1784 | lcd_update(); |
1785 | } | 1785 | } |
1786 | } | 1786 | } |
@@ -1837,7 +1837,7 @@ static void test_make_argh(void){ | |||
1837 | } | 1837 | } |
1838 | 1838 | ||
1839 | snprintf(buf, sizeof buf, "(%d;%d) fail%d try%d", x, y, failures, tries); | 1839 | snprintf(buf, sizeof buf, "(%d;%d) fail%d try%d", x, y, failures, tries); |
1840 | lcd_putsxy(0, LCD_HEIGHT - 8, buf, 0); | 1840 | lcd_putsxy(0, LCD_HEIGHT - 8, buf); |
1841 | lcd_update(); | 1841 | lcd_update(); |
1842 | lcd_invertrect(x + FIELD_RECT_X, y+ FIELD_RECT_Y, ARGH_SIZE, ARGH_SIZE); | 1842 | lcd_invertrect(x + FIELD_RECT_X, y+ FIELD_RECT_Y, ARGH_SIZE, ARGH_SIZE); |
1843 | lcd_update(); | 1843 | lcd_update(); |
@@ -1875,7 +1875,7 @@ static void test_worm_argh_collision_in_moves(void) { | |||
1875 | hit_count ++; | 1875 | hit_count ++; |
1876 | } | 1876 | } |
1877 | snprintf(buf, sizeof buf, "in 5 moves hits: %d", hit_count); | 1877 | snprintf(buf, sizeof buf, "in 5 moves hits: %d", hit_count); |
1878 | lcd_putsxy(0, LCD_HEIGHT - 8, buf, 0); | 1878 | lcd_putsxy(0, LCD_HEIGHT - 8, buf); |
1879 | lcd_update(); | 1879 | lcd_update(); |
1880 | } | 1880 | } |
1881 | if (hit_count != ARGH_SIZE + 5) { | 1881 | if (hit_count != ARGH_SIZE + 5) { |