summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2005-02-28 07:12:37 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2005-02-28 07:12:37 +0000
commit4766863bda7c808065275ae46aaa2782e7b39963 (patch)
tree77d579fd5b8b9d324eff1b7780fec3f51f04386f
parentc90781b6e6048e1b67cac6ddd4f422937ed1abb6 (diff)
downloadrockbox-4766863bda7c808065275ae46aaa2782e7b39963.tar.gz
rockbox-4766863bda7c808065275ae46aaa2782e7b39963.zip
Sokoban adapted to the iRiver H1xx display by Michiel van der Kolk
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6077 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/plugins/sokoban.c40
-rw-r--r--docs/CREDITS1
2 files changed, 19 insertions, 22 deletions
diff --git a/apps/plugins/sokoban.c b/apps/plugins/sokoban.c
index 1011c85c80..20a370f306 100644
--- a/apps/plugins/sokoban.c
+++ b/apps/plugins/sokoban.c
@@ -384,15 +384,20 @@ static int load_level(void)
384 384
385 return 0; 385 return 0;
386} 386}
387#define STAT_WIDTH (LCD_WIDTH-(COLS * magnify))
387 388
388static void update_screen(void) 389static void update_screen(void)
389{ 390{
390 short b = 0, c = 0; 391 short b = 0, c = 0,x,y;
391 short rows = 0, cols = 0; 392 short rows = 0, cols = 0;
392 char s[25]; 393 char s[25];
393 394
395#if CONFIG_KEYPAD == IRIVER_H100_PAD
396 short magnify = 6;
397#else
394 short magnify = 4; 398 short magnify = 4;
395 399#endif
400
396 /* load the board to the screen */ 401 /* load the board to the screen */
397 for (rows=0 ; rows < ROWS ; rows++) { 402 for (rows=0 ; rows < ROWS ; rows++) {
398 for (cols = 0 ; cols < COLS ; cols++) { 403 for (cols = 0 ; cols < COLS ; cols++) {
@@ -401,23 +406,14 @@ static void update_screen(void)
401 406
402 switch(current_info.board[rows][cols]) { 407 switch(current_info.board[rows][cols]) {
403 case 'X': /* black space */ 408 case 'X': /* black space */
404 rb->lcd_drawrect(c, b, magnify, magnify);
405 rb->lcd_drawrect(c+1, b+1, 2, 2);
406 break; 409 break;
407 410
408 case '#': /* this is a wall */ 411 case '#': /* this is a wall */
409 rb->lcd_drawpixel(c, b); 412 rb->lcd_fillrect(c, b, magnify, magnify);
410 rb->lcd_drawpixel(c+2, b);
411 rb->lcd_drawpixel(c+1, b+1);
412 rb->lcd_drawpixel(c+3, b+1);
413 rb->lcd_drawpixel(c, b+2);
414 rb->lcd_drawpixel(c+2, b+2);
415 rb->lcd_drawpixel(c+1, b+3);
416 rb->lcd_drawpixel(c+3, b+3);
417 break; 413 break;
418 414
419 case '.': /* this is a home location */ 415 case '.': /* this is a home location */
420 rb->lcd_drawrect(c+1, b+1, 2, 2); 416 rb->lcd_drawrect(c+(magnify/2)-1, b+(magnify/2)-1, magnify/2, magnify/2);
421 break; 417 break;
422 418
423 case '$': /* this is a box */ 419 case '$': /* this is a box */
@@ -434,8 +430,8 @@ static void update_screen(void)
434 break; 430 break;
435 431
436 case '%': /* this is a box on a home spot */ 432 case '%': /* this is a box on a home spot */
437 rb->lcd_drawrect(c, b, magnify, magnify); 433 rb->lcd_drawrect(c, b, magnify, magnify);
438 rb->lcd_drawrect(c+1, b+1, 2, 2); 434 rb->lcd_drawrect(c+(magnify/2)-1, b+(magnify/2)-1, magnify/2, magnify/2);
439 break; 435 break;
440 } 436 }
441 } 437 }
@@ -443,14 +439,14 @@ static void update_screen(void)
443 439
444 440
445 rb->snprintf(s, sizeof(s), "%d", current_info.level.level); 441 rb->snprintf(s, sizeof(s), "%d", current_info.level.level);
446 rb->lcd_putsxy(86, 22, s); 442 rb->lcd_putsxy(LCD_WIDTH-STAT_WIDTH+4, 22, s);
447 rb->snprintf(s, sizeof(s), "%d", current_info.level.moves); 443 rb->snprintf(s, sizeof(s), "%d", current_info.level.moves);
448 rb->lcd_putsxy(86, 54, s); 444 rb->lcd_putsxy(LCD_WIDTH-STAT_WIDTH+4, 54, s);
449 445
450 rb->lcd_drawrect(80,0,32,32); 446 rb->lcd_drawrect(LCD_WIDTH-STAT_WIDTH,0,STAT_WIDTH,32);
451 rb->lcd_drawrect(80,32,32,64); 447 rb->lcd_drawrect(LCD_WIDTH-STAT_WIDTH,32,STAT_WIDTH,LCD_HEIGHT-32);
452 rb->lcd_putsxy(81, 10, "Level"); 448 rb->lcd_putsxy(LCD_WIDTH-STAT_WIDTH+1, 10, "Level");
453 rb->lcd_putsxy(81, 42, "Moves"); 449 rb->lcd_putsxy(LCD_WIDTH-STAT_WIDTH+1, 42, "Moves");
454 450
455 /* print out the screen */ 451 /* print out the screen */
456 rb->lcd_update(); 452 rb->lcd_update();
diff --git a/docs/CREDITS b/docs/CREDITS
index 2fb408d758..f6adc66b96 100644
--- a/docs/CREDITS
+++ b/docs/CREDITS
@@ -100,3 +100,4 @@ Jonas Häggqvist
100Thom Johansen 100Thom Johansen
101Rinat Zakirov 101Rinat Zakirov
102Manuel Dejonghe 102Manuel Dejonghe
103Michiel van der Kolk