diff options
| author | Daniel Stenberg <daniel@haxx.se> | 2002-03-26 14:27:03 +0000 |
|---|---|---|
| committer | Daniel Stenberg <daniel@haxx.se> | 2002-03-26 14:27:03 +0000 |
| commit | a1fd255d04e1835b2c8cc77ea414ecddea55d8e6 (patch) | |
| tree | 434151e5e9477147cf23440937190dd2541e1c6d /uisimulator | |
| parent | e4469775794e43c6bb0c6cb00e7fa8f4d9fd788e (diff) | |
| download | rockbox-a1fd255d04e1835b2c8cc77ea414ecddea55d8e6.zip rockbox-a1fd255d04e1835b2c8cc77ea414ecddea55d8e6.tar.gz rockbox-a1fd255d04e1835b2c8cc77ea414ecddea55d8e6.tar.bz2 rockbox-a1fd255d04e1835b2c8cc77ea414ecddea55d8e6.tar.xz | |
updates
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'uisimulator')
| -rw-r--r-- | uisimulator/lcd-x11.c | 6 | ||||
| -rw-r--r-- | uisimulator/lcd-x11.h | 22 | ||||
| -rw-r--r-- | uisimulator/lcd.c | 23 | ||||
| -rw-r--r-- | uisimulator/lcd.h | 2 | ||||
| -rw-r--r-- | uisimulator/screenhack.c | 2 | ||||
| -rw-r--r-- | uisimulator/uibasic.c | 26 |
6 files changed, 71 insertions, 10 deletions
diff --git a/uisimulator/lcd-x11.c b/uisimulator/lcd-x11.c index 7655765..ccde593 100644 --- a/uisimulator/lcd-x11.c +++ b/uisimulator/lcd-x11.c @@ -37,6 +37,7 @@ */ #include "lcd.h" +#include "lcd-x11.h" extern unsigned char display[LCD_WIDTH/8][LCD_HEIGHT]; @@ -53,8 +54,8 @@ void lcd_update (void) /* one or more bits/pixels are set */ for(bit=0; bit<8; bit++) { if(display[y/8][x]&(1<<bit)) { - points[p].x = x; - points[p].y = y+bit; + points[p].x = x + MARGIN_X; + points[p].y = y+bit + MARGIN_Y; p++; /* increase the point counter */ } } @@ -63,4 +64,5 @@ void lcd_update (void) } } drawdots(&points[0], p); + fprintf(stderr, "lcd_update: Draws %d pixels\n", p); } diff --git a/uisimulator/lcd-x11.h b/uisimulator/lcd-x11.h new file mode 100644 index 0000000..6671add --- /dev/null +++ b/uisimulator/lcd-x11.h @@ -0,0 +1,22 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2002 by Daniel Stenberg <daniel@haxx.se> + * + * All files in this archive are subject to the GNU General Public License. + * See the file COPYING in the source tree root for full license agreement. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#define MARGIN_X 3 +#define MARGIN_Y 3 + diff --git a/uisimulator/lcd.c b/uisimulator/lcd.c index 8607477..4909b5c 100644 --- a/uisimulator/lcd.c +++ b/uisimulator/lcd.c @@ -22,6 +22,9 @@ */ #include "lcd.h" +#ifdef LCD_DEBUG +#include <stdio.h> +#endif #define DISP_X LCD_WIDTH /* Display width in pixels */ #define DISP_Y LCD_HEIGHT /* Display height in pixels */ @@ -40,7 +43,7 @@ #define ASCII_MIN 0x20 /* First char in table */ #define ASCII_MAX 0x7f /* Last char in table */ -static const unsigned char char_gen[ASCII_MAX-ASCII_MIN+1][CHAR_X-1] = +static const unsigned char lcd_font_data[ASCII_MAX-ASCII_MIN+1][CHAR_X-1] = { 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x2f */ 0x00, 0x00, 0x4f, 0x00, 0x00, @@ -154,8 +157,8 @@ static const unsigned char char_gen[ASCII_MAX-ASCII_MIN+1][CHAR_X-1] = */ unsigned char display[LCD_HEIGHT/8][LCD_WIDTH]; -static unsigned char lcd_y; /* Current pixel row */ -static unsigned char lcd_x; /* Current pixel column */ +static int lcd_y; /* Current pixel row */ +static int lcd_x; /* Current pixel column */ /* * Set current x,y position @@ -165,7 +168,15 @@ void lcd_position(int x, int y) if (x >= 0 && x < DISP_X && y >= 0 && y < DISP_Y) { lcd_x = x; lcd_y = y; +#ifdef LCD_DEBUG + fprintf(stderr, "lcd_position: set to %d, %d\n", x, y); +#endif } +#ifdef LCD_DEBUG + else + fprintf(stderr, "lcd_position: not set\n"); +#endif + } /* @@ -202,7 +213,7 @@ void lcd_char (int ch, char invert) /* Write each char column */ for (col = 0; col < CHAR_X-1; col++) { - unsigned long data = (char_gen[ch-ASCII_MIN][col] << shift) ^ invert; + unsigned long data = (lcd_font_data[ch-ASCII_MIN][col] << shift) ^ invert; dp[0][col] = (dp[0][col] & mask) | data; if (lcd_y < DISP_Y-8) dp[1][col] = (dp[1][col] & (mask >> 8)) | (data >> 8); @@ -221,6 +232,10 @@ void lcd_string(const char *text, char invert) { int ch; +#ifdef LCD_DEBUG + fprintf(stderr, "lcd_string: output %s at %d, %d\n", + text, lcd_x, lcd_y); +#endif while ((ch = *text++) != '\0') { if (lcd_y > DISP_Y-CHAR_Y) { /* Scroll (8 pixels) */ diff --git a/uisimulator/lcd.h b/uisimulator/lcd.h index 0a099cb..963e70c 100644 --- a/uisimulator/lcd.h +++ b/uisimulator/lcd.h @@ -24,3 +24,5 @@ #define LCD_WIDTH 112 /* Display width in pixels */ #define LCD_HEIGHT 64 /* Display height in pixels */ +#define LCD_DEBUG 1 + diff --git a/uisimulator/screenhack.c b/uisimulator/screenhack.c index 4e3c9c9..f234a97 100644 --- a/uisimulator/screenhack.c +++ b/uisimulator/screenhack.c @@ -83,7 +83,7 @@ static XrmOptionDescRec default_options [] = { static char *default_defaults[] = { ".root: false", - "*geometry: 100x200", /* this should be .geometry, but nooooo... */ + "*geometry: 200x100", /* this should be .geometry, but nooooo... */ "*mono: false", "*installColormap: false", "*visualID: default", diff --git a/uisimulator/uibasic.c b/uisimulator/uibasic.c index 2d9f33f..c6c9c7d 100644 --- a/uisimulator/uibasic.c +++ b/uisimulator/uibasic.c @@ -33,6 +33,9 @@ #include "version.h" +#include "lcd.h" +#include "lcd-x11.h" + #define MAX(x,y) ((x)>(y)?(x):(y)) #define MIN(x,y) ((x)<(y)?(x):(y)) @@ -78,7 +81,7 @@ void Logf(char *fmt, ...) t = localtime(&now); log = fopen(LOGFILE, "a"); if(log) { - fprintf(log, "%02d.%02d.%02d ", + fprintf(log, "%02d:%02d:%02d ", t->tm_hour, t->tm_min, t->tm_sec); vfprintf(log, fmt, args); fprintf(log, "\n"); @@ -86,7 +89,7 @@ void Logf(char *fmt, ...) fclose(log); } - fprintf(stderr, "%02d.%02d.%02d ", + fprintf(stderr, "%02d:%02d:%02d ", t->tm_hour, t->tm_min, t->tm_sec); vfprintf(stderr, fmt, args); fprintf(stderr, "\n"); @@ -221,7 +224,14 @@ screenhack (Display *the_dpy, Window the_window) Logf("Rockbox will kill ya!"); - lcd_string( PROGNAME, 0); + lcd_position(1, 1); + lcd_string( "RockBoxx", 0); + + lcd_position(8, 16); + lcd_string( "R", 0); + + lcd_position(8, 24); + lcd_string( "2", 0); while (1) { /* deal with input here */ @@ -237,6 +247,16 @@ void screen_redraw() lcd_update(); +#define X1 0 +#define Y1 0 +#define X2 (LCD_WIDTH + MARGIN_X*2) +#define Y2 (LCD_HEIGHT + MARGIN_Y*2) + + drawline(1, X1, Y1, X2, Y1); + drawline(1, X2, Y1, X2, Y2); + drawline(1, X1, Y2, X2, Y2); + drawline(1, X1, Y1, X1, Y2); + #if 0 /* does nothing "real" yet */ /* drawtext(1, 20, 20, PROGNAME);*/ |