summaryrefslogtreecommitdiff
path: root/uisimulator/app.c
diff options
context:
space:
mode:
Diffstat (limited to 'uisimulator/app.c')
-rw-r--r--uisimulator/app.c74
1 files changed, 74 insertions, 0 deletions
diff --git a/uisimulator/app.c b/uisimulator/app.c
new file mode 100644
index 0000000000..8f51f98f80
--- /dev/null
+++ b/uisimulator/app.c
@@ -0,0 +1,74 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 1999 Mattis Wadman (nappe@sudac.org)
11 *
12 * Heavily modified for embedded use by Björn Stenberg (bjorn@haxx.se)
13 *
14 * All files in this archive are subject to the GNU General Public License.
15 * See the file COPYING in the source tree root for full license agreement.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22#include "types.h"
23#include "lcd.h"
24#define HAVE_RECORDER_KEYPAD
25#include "button.h"
26
27#ifdef SIMULATOR
28#include <stdio.h>
29#include <unistd.h>
30#endif
31
32#define LINE_HEIGHT 8
33
34#define MAX_LINE 3 /* the last index with info, starting on 0 */
35
36void app_main(void)
37{
38 lcd_puts(0, 0, "-Rockabox", 0);
39 lcd_puts(6, 8, "Boxrock", 0);
40 lcd_puts(6, 16, "Robkoxx", 0);
41 lcd_puts(6, 24, "Tetris", 0);
42 lcd_puts(8, 38, "Rockbox!", 2);
43 int cursor = 0;
44 int key;
45
46 while(1) {
47 key = button_get();
48
49 switch(key) {
50 case BUTTON_UP:
51 if(cursor) {
52 lcd_puts(0, cursor, " ", 0);
53 cursor-= LINE_HEIGHT;
54 lcd_puts(0, cursor, "-", 0);
55 }
56 break;
57 case BUTTON_DOWN:
58 if(cursor<(MAX_LINE*LINE_HEIGHT)) {
59 lcd_puts(0, cursor, " ", 0);
60 cursor+=LINE_HEIGHT;
61 lcd_puts(0, cursor, "-", 0);
62 }
63 break;
64 case BUTTON_RIGHT:
65 if(cursor == (MAX_LINE * LINE_HEIGHT)) {
66 lcd_clearrect(0, 0, LCD_WIDTH, LCD_HEIGHT);
67 tetris();
68 }
69 break;
70 }
71 lcd_update();
72 Logf("key %x cursor at %d\n", key, cursor);
73 }
74}