From d5fd94d6936e4d08368e03b91ee3e2150b8271b2 Mon Sep 17 00:00:00 2001 From: Mats Lidell Date: Fri, 11 Oct 2002 11:12:00 +0000 Subject: Player simulator stuff for patterns added. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2580 a1c6a512-1295-4272-9138-f99709370657 --- uisimulator/common/stubs.c | 50 +++++++++++++++++++++++++++++++++++++++------- 1 file changed, 43 insertions(+), 7 deletions(-) (limited to 'uisimulator') diff --git a/uisimulator/common/stubs.c b/uisimulator/common/stubs.c index dee86b078f..11c1b827d4 100644 --- a/uisimulator/common/stubs.c +++ b/uisimulator/common/stubs.c @@ -24,6 +24,9 @@ #include "button.h" #include "menu.h" +#include "string.h" +#include "lcd.h" + void backlight_on(void) { /* we could do something better here! */ @@ -106,18 +109,51 @@ bool simulate_usb(void) return false; } -void lcd_define_pattern (int which,char *pattern,int length) +static char patterns[8][7]; + +void lcd_define_pattern(int which, char *pattern, int length) { - (void)which; - (void)pattern; - (void)length; + int i, j; + int pat = which / 8; + char icon[8]; + memset(icon, 0, sizeof icon); + + DEBUGF("Defining pattern %d\n", pat); + for (j = 0; j <= 5; j++) { + for (i = 0; i < length; i++) { + if ((pattern[i])&(1<<(j))) + icon[j] |= (1<<(i)); + } + } + for (i = 0; i <= 5; i++) + { + patterns[pat][i] = icon[i]; + } } +char* get_lcd_pattern(int which) +{ + DEBUGF("Get pattern %d\n", which); + return patterns[which]; +} + +extern void lcd_puts(int x, int y, unsigned char *str); + void lcd_putc(int x, int y, unsigned char ch) { - (void)x; - (void)y; - (void)ch; + static char str[2] = "x"; + if (ch <= 8) + { + char* bm = get_lcd_pattern(ch); + lcd_bitmap(bm, x * 6, (y * 8) + 8, 6, 8, true); + return; + } + if (ch == 137) { + /* Have no good font yet. Simulate the cursor character. */ + ch = '>'; + } + str[0] = ch; + lcd_puts(x, y, str); } void lcd_set_contrast( int x ) -- cgit v1.2.3