diff options
| author | Daniel Stenberg <daniel@haxx.se> | 2002-04-28 00:11:50 +0000 |
|---|---|---|
| committer | Daniel Stenberg <daniel@haxx.se> | 2002-04-28 00:11:50 +0000 |
| commit | 8776e03825f3e790b6c170de8666823099d839f2 (patch) | |
| tree | 14b07b6f634168ec0a74486ebedcbf9185b9fb32 | |
| parent | bd07316bcb0cdf1198a7f3eab63d61198fcdcba1 (diff) | |
| download | rockbox-8776e03825f3e790b6c170de8666823099d839f2.zip rockbox-8776e03825f3e790b6c170de8666823099d839f2.tar.gz rockbox-8776e03825f3e790b6c170de8666823099d839f2.tar.bz2 rockbox-8776e03825f3e790b6c170de8666823099d839f2.tar.xz | |
pressing OFF in tetris now gets you back to the main menu
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@287 a1c6a512-1295-4272-9138-f99709370657
| -rw-r--r-- | uisimulator/app.c | 18 | ||||
| -rw-r--r-- | uisimulator/tetris.c | 8 |
2 files changed, 19 insertions, 7 deletions
diff --git a/uisimulator/app.c b/uisimulator/app.c index d3e1b8e..9df7863 100644 --- a/uisimulator/app.c +++ b/uisimulator/app.c @@ -33,16 +33,26 @@ #define MAX_LINE 3 /* the last index with info, starting on 0 */ -void app_main(void) +/* global cursor */ +int cursor = 0; + +void menu_init(void) { - lcd_puts(0, 0, "-Rockabox", 0); + lcd_puts(6, 0, "Rockabox", 0); lcd_puts(6, 8, "Boxrock", 0); lcd_puts(6, 16, "Robkoxx", 0); lcd_puts(6, 24, "Tetris", 0); lcd_puts(8, 38, "Rockbox!", 2); - int cursor = 0; + + lcd_puts(0, cursor, "-", 0); +} + +void app_main(void) +{ int key; + menu_init(); + while(1) { key = button_get(); @@ -65,6 +75,8 @@ void app_main(void) if(cursor == (MAX_LINE * LINE_HEIGHT)) { lcd_clearrect(0, 0, LCD_WIDTH, LCD_HEIGHT); tetris(); + lcd_clearrect(0, 0, LCD_WIDTH, LCD_HEIGHT); + menu_init(); } break; } diff --git a/uisimulator/tetris.c b/uisimulator/tetris.c index d49cbec..e18474a 100644 --- a/uisimulator/tetris.c +++ b/uisimulator/tetris.c @@ -253,20 +253,19 @@ void game_loop(void) /* while(count*20 < level_speeds[level]) */ { b = button_get(); + if ( b & BUTTON_OFF ) + return; /* get out of here */ + if ( b & BUTTON_LEFT ) { - printf("Left\n"); move_block(-1,0,0); } if ( b & BUTTON_RIGHT ) { - printf("Right\n"); move_block(1,0,0); } if ( b & BUTTON_UP ) { - printf("Up\n"); move_block(0,0,1); } if ( b & BUTTON_DOWN ) { - printf("Down\n"); move_down(); } count++; @@ -279,6 +278,7 @@ void game_loop(void) void tetris(void) { draw_frame(start_x-1,start_x+max_x,start_y-1,start_y+max_y); + lcd_puts(10, 32, "Tetris!", 2); lcd_update(); next_b = rand(blocks); |