diff options
author | Daniel Stenberg <daniel@haxx.se> | 2002-04-27 23:41:41 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2002-04-27 23:41:41 +0000 |
commit | c1543511b342162b2b537485c6646186037d8845 (patch) | |
tree | d39dbce2583c366001b3fe96f7bde40b07716925 | |
parent | ebc68a9442f7ca838945068fe8f8ab7a5dcaffac (diff) | |
download | rockbox-c1543511b342162b2b537485c6646186037d8845.tar.gz rockbox-c1543511b342162b2b537485c6646186037d8845.zip |
runs the app now, improved the lcd simulation a bit
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@281 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | uisimulator/Makefile | 2 | ||||
-rw-r--r-- | uisimulator/lcd-x11.c | 42 | ||||
-rw-r--r-- | uisimulator/uibasic.c | 14 |
3 files changed, 51 insertions, 7 deletions
diff --git a/uisimulator/Makefile b/uisimulator/Makefile index a2212e0d46..27dad9f178 100644 --- a/uisimulator/Makefile +++ b/uisimulator/Makefile | |||
@@ -43,7 +43,7 @@ CFLAGS = $(DEBUG) $(DEFINES) $(INCLUDES) | |||
43 | #SRCS = $(wildcard *.c) | 43 | #SRCS = $(wildcard *.c) |
44 | 44 | ||
45 | SRCS = screenhack.c uibasic.c resources.c visual.c lcd.c lcd-x11.c \ | 45 | SRCS = screenhack.c uibasic.c resources.c visual.c lcd.c lcd-x11.c \ |
46 | button-x11.c chartables.c tetris.c | 46 | button-x11.c chartables.c tetris.c app.c |
47 | 47 | ||
48 | OBJS := $(SRCS:c=o) | 48 | OBJS := $(SRCS:c=o) |
49 | 49 | ||
diff --git a/uisimulator/lcd-x11.c b/uisimulator/lcd-x11.c index cd2b22b354..9659426f02 100644 --- a/uisimulator/lcd-x11.c +++ b/uisimulator/lcd-x11.c | |||
@@ -42,13 +42,18 @@ extern unsigned char display[LCD_WIDTH][LCD_HEIGHT/8]; | |||
42 | extern void screen_resized(int width, int height); | 42 | extern void screen_resized(int width, int height); |
43 | extern Display *dpy; | 43 | extern Display *dpy; |
44 | 44 | ||
45 | unsigned char display_copy[LCD_WIDTH][LCD_HEIGHT/8]; | ||
46 | |||
45 | void lcd_update (void) | 47 | void lcd_update (void) |
46 | { | 48 | { |
47 | int x, y; | 49 | int x, y; |
48 | int p=0; | 50 | int p=0; |
49 | int bit; | 51 | int bit; |
50 | XPoint points[LCD_WIDTH * LCD_HEIGHT]; | 52 | XPoint points[LCD_WIDTH * LCD_HEIGHT]; |
53 | int cp=0; | ||
54 | XPoint clearpoints[LCD_WIDTH * LCD_HEIGHT]; | ||
51 | 55 | ||
56 | #if 0 | ||
52 | screen_resized(LCD_WIDTH, LCD_HEIGHT); | 57 | screen_resized(LCD_WIDTH, LCD_HEIGHT); |
53 | 58 | ||
54 | for(y=0; y<LCD_HEIGHT; y+=8) { | 59 | for(y=0; y<LCD_HEIGHT; y+=8) { |
@@ -65,7 +70,40 @@ void lcd_update (void) | |||
65 | } | 70 | } |
66 | } | 71 | } |
67 | } | 72 | } |
68 | drawdots(&points[0], p); | 73 | #else |
69 | fprintf(stderr, "lcd_update: Draws %d pixels\n", p); | 74 | for(y=0; y<LCD_HEIGHT; y+=8) { |
75 | for(x=0; x<LCD_WIDTH; x++) { | ||
76 | if(display[x][y/8] || display_copy[x][y/8]) { | ||
77 | /* one or more bits/pixels are changed */ | ||
78 | unsigned char diff = | ||
79 | display[x][y/8] ^ display_copy[x][y/8]; | ||
80 | |||
81 | for(bit=0; bit<8; bit++) { | ||
82 | if(display[x][y/8]&(1<<bit)) { | ||
83 | /* set a dot */ | ||
84 | points[p].x = x + MARGIN_X; | ||
85 | points[p].y = y+bit + MARGIN_Y; | ||
86 | p++; /* increase the point counter */ | ||
87 | } | ||
88 | else if(diff &(1<<bit)) { | ||
89 | /* clear a dot */ | ||
90 | clearpoints[cp].x = x + MARGIN_X; | ||
91 | clearpoints[cp].y = y+bit + MARGIN_Y; | ||
92 | cp++; /* increase the point counter */ | ||
93 | } | ||
94 | } | ||
95 | } | ||
96 | } | ||
97 | } | ||
98 | |||
99 | /* copy a huge block */ | ||
100 | memcpy(display_copy, display, sizeof(display)); | ||
101 | |||
102 | #endif | ||
103 | |||
104 | |||
105 | drawdots(1, &points[0], p); | ||
106 | drawdots(0, &clearpoints[0], cp); | ||
107 | fprintf(stderr, "lcd_update: Draws %d pixels, clears %d pixels\n", p, cp); | ||
70 | XSync(dpy,False); | 108 | XSync(dpy,False); |
71 | } | 109 | } |
diff --git a/uisimulator/uibasic.c b/uisimulator/uibasic.c index f1bb42f202..85cfb7d911 100644 --- a/uisimulator/uibasic.c +++ b/uisimulator/uibasic.c | |||
@@ -177,10 +177,16 @@ void drawdot(int color, int x, int y) | |||
177 | XDrawPoint(dpy, window, draw_gc, x, y); | 177 | XDrawPoint(dpy, window, draw_gc, x, y); |
178 | } | 178 | } |
179 | 179 | ||
180 | void drawdots(XPoint *points, int count) | 180 | void drawdots(int color, XPoint *points, int count) |
181 | { | 181 | { |
182 | XSetForeground(dpy, draw_gc, | 182 | if (color==0) { |
183 | get_pixel_resource("foreground", "Foreground", dpy, cmap)); | 183 | XSetForeground(dpy, draw_gc, |
184 | get_pixel_resource("background", "Background", dpy, cmap)); | ||
185 | } | ||
186 | else | ||
187 | XSetForeground(dpy, draw_gc, | ||
188 | get_pixel_resource("foreground", "Foreground", dpy, cmap)); | ||
189 | |||
184 | 190 | ||
185 | XDrawPoints(dpy, window, draw_gc, points, count, CoordModeOrigin); | 191 | XDrawPoints(dpy, window, draw_gc, points, count, CoordModeOrigin); |
186 | } | 192 | } |
@@ -223,7 +229,7 @@ screenhack (Display *the_dpy, Window the_window) | |||
223 | 229 | ||
224 | Logf("Rockbox will kill ya!"); | 230 | Logf("Rockbox will kill ya!"); |
225 | 231 | ||
226 | tetris(); | 232 | app_main(); |
227 | } | 233 | } |
228 | 234 | ||
229 | void screen_redraw() | 235 | void screen_redraw() |