summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2002-03-26 14:27:03 +0000
committerDaniel Stenberg <daniel@haxx.se>2002-03-26 14:27:03 +0000
commita1fd255d04e1835b2c8cc77ea414ecddea55d8e6 (patch)
tree434151e5e9477147cf23440937190dd2541e1c6d
parente4469775794e43c6bb0c6cb00e7fa8f4d9fd788e (diff)
downloadrockbox-a1fd255d04e1835b2c8cc77ea414ecddea55d8e6.tar.gz
rockbox-a1fd255d04e1835b2c8cc77ea414ecddea55d8e6.zip
updates
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--uisimulator/lcd-x11.c6
-rw-r--r--uisimulator/lcd-x11.h22
-rw-r--r--uisimulator/lcd.c23
-rw-r--r--uisimulator/lcd.h2
-rw-r--r--uisimulator/screenhack.c2
-rw-r--r--uisimulator/uibasic.c26
6 files changed, 71 insertions, 10 deletions
diff --git a/uisimulator/lcd-x11.c b/uisimulator/lcd-x11.c
index 7655765137..ccde5935cd 100644
--- a/uisimulator/lcd-x11.c
+++ b/uisimulator/lcd-x11.c
@@ -37,6 +37,7 @@
37 */ 37 */
38 38
39#include "lcd.h" 39#include "lcd.h"
40#include "lcd-x11.h"
40 41
41extern unsigned char display[LCD_WIDTH/8][LCD_HEIGHT]; 42extern unsigned char display[LCD_WIDTH/8][LCD_HEIGHT];
42 43
@@ -53,8 +54,8 @@ void lcd_update (void)
53 /* one or more bits/pixels are set */ 54 /* one or more bits/pixels are set */
54 for(bit=0; bit<8; bit++) { 55 for(bit=0; bit<8; bit++) {
55 if(display[y/8][x]&(1<<bit)) { 56 if(display[y/8][x]&(1<<bit)) {
56 points[p].x = x; 57 points[p].x = x + MARGIN_X;
57 points[p].y = y+bit; 58 points[p].y = y+bit + MARGIN_Y;
58 p++; /* increase the point counter */ 59 p++; /* increase the point counter */
59 } 60 }
60 } 61 }
@@ -63,4 +64,5 @@ void lcd_update (void)
63 } 64 }
64 } 65 }
65 drawdots(&points[0], p); 66 drawdots(&points[0], p);
67 fprintf(stderr, "lcd_update: Draws %d pixels\n", p);
66} 68}
diff --git a/uisimulator/lcd-x11.h b/uisimulator/lcd-x11.h
new file mode 100644
index 0000000000..6671addbf3
--- /dev/null
+++ b/uisimulator/lcd-x11.h
@@ -0,0 +1,22 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2002 by Daniel Stenberg <daniel@haxx.se>
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
20#define MARGIN_X 3
21#define MARGIN_Y 3
22
diff --git a/uisimulator/lcd.c b/uisimulator/lcd.c
index 8607477d82..4909b5cc49 100644
--- a/uisimulator/lcd.c
+++ b/uisimulator/lcd.c
@@ -22,6 +22,9 @@
22 */ 22 */
23 23
24#include "lcd.h" 24#include "lcd.h"
25#ifdef LCD_DEBUG
26#include <stdio.h>
27#endif
25 28
26#define DISP_X LCD_WIDTH /* Display width in pixels */ 29#define DISP_X LCD_WIDTH /* Display width in pixels */
27#define DISP_Y LCD_HEIGHT /* Display height in pixels */ 30#define DISP_Y LCD_HEIGHT /* Display height in pixels */
@@ -40,7 +43,7 @@
40#define ASCII_MIN 0x20 /* First char in table */ 43#define ASCII_MIN 0x20 /* First char in table */
41#define ASCII_MAX 0x7f /* Last char in table */ 44#define ASCII_MAX 0x7f /* Last char in table */
42 45
43static const unsigned char char_gen[ASCII_MAX-ASCII_MIN+1][CHAR_X-1] = 46static const unsigned char lcd_font_data[ASCII_MAX-ASCII_MIN+1][CHAR_X-1] =
44{ 47{
45 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x2f */ 48 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x2f */
46 0x00, 0x00, 0x4f, 0x00, 0x00, 49 0x00, 0x00, 0x4f, 0x00, 0x00,
@@ -154,8 +157,8 @@ static const unsigned char char_gen[ASCII_MAX-ASCII_MIN+1][CHAR_X-1] =
154 */ 157 */
155unsigned char display[LCD_HEIGHT/8][LCD_WIDTH]; 158unsigned char display[LCD_HEIGHT/8][LCD_WIDTH];
156 159
157static unsigned char lcd_y; /* Current pixel row */ 160static int lcd_y; /* Current pixel row */
158static unsigned char lcd_x; /* Current pixel column */ 161static int lcd_x; /* Current pixel column */
159 162
160/* 163/*
161 * Set current x,y position 164 * Set current x,y position
@@ -165,7 +168,15 @@ void lcd_position(int x, int y)
165 if (x >= 0 && x < DISP_X && y >= 0 && y < DISP_Y) { 168 if (x >= 0 && x < DISP_X && y >= 0 && y < DISP_Y) {
166 lcd_x = x; 169 lcd_x = x;
167 lcd_y = y; 170 lcd_y = y;
171#ifdef LCD_DEBUG
172 fprintf(stderr, "lcd_position: set to %d, %d\n", x, y);
173#endif
168 } 174 }
175#ifdef LCD_DEBUG
176 else
177 fprintf(stderr, "lcd_position: not set\n");
178#endif
179
169} 180}
170 181
171/* 182/*
@@ -202,7 +213,7 @@ void lcd_char (int ch, char invert)
202 213
203 /* Write each char column */ 214 /* Write each char column */
204 for (col = 0; col < CHAR_X-1; col++) { 215 for (col = 0; col < CHAR_X-1; col++) {
205 unsigned long data = (char_gen[ch-ASCII_MIN][col] << shift) ^ invert; 216 unsigned long data = (lcd_font_data[ch-ASCII_MIN][col] << shift) ^ invert;
206 dp[0][col] = (dp[0][col] & mask) | data; 217 dp[0][col] = (dp[0][col] & mask) | data;
207 if (lcd_y < DISP_Y-8) 218 if (lcd_y < DISP_Y-8)
208 dp[1][col] = (dp[1][col] & (mask >> 8)) | (data >> 8); 219 dp[1][col] = (dp[1][col] & (mask >> 8)) | (data >> 8);
@@ -221,6 +232,10 @@ void lcd_string(const char *text, char invert)
221{ 232{
222 int ch; 233 int ch;
223 234
235#ifdef LCD_DEBUG
236 fprintf(stderr, "lcd_string: output %s at %d, %d\n",
237 text, lcd_x, lcd_y);
238#endif
224 while ((ch = *text++) != '\0') { 239 while ((ch = *text++) != '\0') {
225 if (lcd_y > DISP_Y-CHAR_Y) { 240 if (lcd_y > DISP_Y-CHAR_Y) {
226 /* Scroll (8 pixels) */ 241 /* Scroll (8 pixels) */
diff --git a/uisimulator/lcd.h b/uisimulator/lcd.h
index 0a099cb8c7..963e70c341 100644
--- a/uisimulator/lcd.h
+++ b/uisimulator/lcd.h
@@ -24,3 +24,5 @@
24#define LCD_WIDTH 112 /* Display width in pixels */ 24#define LCD_WIDTH 112 /* Display width in pixels */
25#define LCD_HEIGHT 64 /* Display height in pixels */ 25#define LCD_HEIGHT 64 /* Display height in pixels */
26 26
27#define LCD_DEBUG 1
28
diff --git a/uisimulator/screenhack.c b/uisimulator/screenhack.c
index 4e3c9c9146..f234a9711b 100644
--- a/uisimulator/screenhack.c
+++ b/uisimulator/screenhack.c
@@ -83,7 +83,7 @@ static XrmOptionDescRec default_options [] = {
83 83
84static char *default_defaults[] = { 84static char *default_defaults[] = {
85 ".root: false", 85 ".root: false",
86 "*geometry: 100x200", /* this should be .geometry, but nooooo... */ 86 "*geometry: 200x100", /* this should be .geometry, but nooooo... */
87 "*mono: false", 87 "*mono: false",
88 "*installColormap: false", 88 "*installColormap: false",
89 "*visualID: default", 89 "*visualID: default",
diff --git a/uisimulator/uibasic.c b/uisimulator/uibasic.c
index 2d9f33fb7d..c6c9c7d236 100644
--- a/uisimulator/uibasic.c
+++ b/uisimulator/uibasic.c
@@ -33,6 +33,9 @@
33 33
34#include "version.h" 34#include "version.h"
35 35
36#include "lcd.h"
37#include "lcd-x11.h"
38
36#define MAX(x,y) ((x)>(y)?(x):(y)) 39#define MAX(x,y) ((x)>(y)?(x):(y))
37#define MIN(x,y) ((x)<(y)?(x):(y)) 40#define MIN(x,y) ((x)<(y)?(x):(y))
38 41
@@ -78,7 +81,7 @@ void Logf(char *fmt, ...)
78 t = localtime(&now); 81 t = localtime(&now);
79 log = fopen(LOGFILE, "a"); 82 log = fopen(LOGFILE, "a");
80 if(log) { 83 if(log) {
81 fprintf(log, "%02d.%02d.%02d ", 84 fprintf(log, "%02d:%02d:%02d ",
82 t->tm_hour, t->tm_min, t->tm_sec); 85 t->tm_hour, t->tm_min, t->tm_sec);
83 vfprintf(log, fmt, args); 86 vfprintf(log, fmt, args);
84 fprintf(log, "\n"); 87 fprintf(log, "\n");
@@ -86,7 +89,7 @@ void Logf(char *fmt, ...)
86 fclose(log); 89 fclose(log);
87 } 90 }
88 91
89 fprintf(stderr, "%02d.%02d.%02d ", 92 fprintf(stderr, "%02d:%02d:%02d ",
90 t->tm_hour, t->tm_min, t->tm_sec); 93 t->tm_hour, t->tm_min, t->tm_sec);
91 vfprintf(stderr, fmt, args); 94 vfprintf(stderr, fmt, args);
92 fprintf(stderr, "\n"); 95 fprintf(stderr, "\n");
@@ -221,7 +224,14 @@ screenhack (Display *the_dpy, Window the_window)
221 224
222 Logf("Rockbox will kill ya!"); 225 Logf("Rockbox will kill ya!");
223 226
224 lcd_string( PROGNAME, 0); 227 lcd_position(1, 1);
228 lcd_string( "RockBoxx", 0);
229
230 lcd_position(8, 16);
231 lcd_string( "R", 0);
232
233 lcd_position(8, 24);
234 lcd_string( "2", 0);
225 235
226 while (1) { 236 while (1) {
227 /* deal with input here */ 237 /* deal with input here */
@@ -237,6 +247,16 @@ void screen_redraw()
237 247
238 lcd_update(); 248 lcd_update();
239 249
250#define X1 0
251#define Y1 0
252#define X2 (LCD_WIDTH + MARGIN_X*2)
253#define Y2 (LCD_HEIGHT + MARGIN_Y*2)
254
255 drawline(1, X1, Y1, X2, Y1);
256 drawline(1, X2, Y1, X2, Y2);
257 drawline(1, X1, Y2, X2, Y2);
258 drawline(1, X1, Y1, X1, Y2);
259
240#if 0 260#if 0
241 /* does nothing "real" yet */ 261 /* does nothing "real" yet */
242 /* drawtext(1, 20, 20, PROGNAME);*/ 262 /* drawtext(1, 20, 20, PROGNAME);*/