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
This commit is contained in:
parent
ebc68a9442
commit
c1543511b3
3 changed files with 51 additions and 7 deletions
|
@ -43,7 +43,7 @@ CFLAGS = $(DEBUG) $(DEFINES) $(INCLUDES)
|
|||
#SRCS = $(wildcard *.c)
|
||||
|
||||
SRCS = screenhack.c uibasic.c resources.c visual.c lcd.c lcd-x11.c \
|
||||
button-x11.c chartables.c tetris.c
|
||||
button-x11.c chartables.c tetris.c app.c
|
||||
|
||||
OBJS := $(SRCS:c=o)
|
||||
|
||||
|
|
|
@ -42,13 +42,18 @@ extern unsigned char display[LCD_WIDTH][LCD_HEIGHT/8];
|
|||
extern void screen_resized(int width, int height);
|
||||
extern Display *dpy;
|
||||
|
||||
unsigned char display_copy[LCD_WIDTH][LCD_HEIGHT/8];
|
||||
|
||||
void lcd_update (void)
|
||||
{
|
||||
int x, y;
|
||||
int p=0;
|
||||
int bit;
|
||||
XPoint points[LCD_WIDTH * LCD_HEIGHT];
|
||||
int cp=0;
|
||||
XPoint clearpoints[LCD_WIDTH * LCD_HEIGHT];
|
||||
|
||||
#if 0
|
||||
screen_resized(LCD_WIDTH, LCD_HEIGHT);
|
||||
|
||||
for(y=0; y<LCD_HEIGHT; y+=8) {
|
||||
|
@ -65,7 +70,40 @@ void lcd_update (void)
|
|||
}
|
||||
}
|
||||
}
|
||||
drawdots(&points[0], p);
|
||||
fprintf(stderr, "lcd_update: Draws %d pixels\n", p);
|
||||
#else
|
||||
for(y=0; y<LCD_HEIGHT; y+=8) {
|
||||
for(x=0; x<LCD_WIDTH; x++) {
|
||||
if(display[x][y/8] || display_copy[x][y/8]) {
|
||||
/* one or more bits/pixels are changed */
|
||||
unsigned char diff =
|
||||
display[x][y/8] ^ display_copy[x][y/8];
|
||||
|
||||
for(bit=0; bit<8; bit++) {
|
||||
if(display[x][y/8]&(1<<bit)) {
|
||||
/* set a dot */
|
||||
points[p].x = x + MARGIN_X;
|
||||
points[p].y = y+bit + MARGIN_Y;
|
||||
p++; /* increase the point counter */
|
||||
}
|
||||
else if(diff &(1<<bit)) {
|
||||
/* clear a dot */
|
||||
clearpoints[cp].x = x + MARGIN_X;
|
||||
clearpoints[cp].y = y+bit + MARGIN_Y;
|
||||
cp++; /* increase the point counter */
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* copy a huge block */
|
||||
memcpy(display_copy, display, sizeof(display));
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
drawdots(1, &points[0], p);
|
||||
drawdots(0, &clearpoints[0], cp);
|
||||
fprintf(stderr, "lcd_update: Draws %d pixels, clears %d pixels\n", p, cp);
|
||||
XSync(dpy,False);
|
||||
}
|
||||
|
|
|
@ -177,10 +177,16 @@ void drawdot(int color, int x, int y)
|
|||
XDrawPoint(dpy, window, draw_gc, x, y);
|
||||
}
|
||||
|
||||
void drawdots(XPoint *points, int count)
|
||||
void drawdots(int color, XPoint *points, int count)
|
||||
{
|
||||
XSetForeground(dpy, draw_gc,
|
||||
get_pixel_resource("foreground", "Foreground", dpy, cmap));
|
||||
if (color==0) {
|
||||
XSetForeground(dpy, draw_gc,
|
||||
get_pixel_resource("background", "Background", dpy, cmap));
|
||||
}
|
||||
else
|
||||
XSetForeground(dpy, draw_gc,
|
||||
get_pixel_resource("foreground", "Foreground", dpy, cmap));
|
||||
|
||||
|
||||
XDrawPoints(dpy, window, draw_gc, points, count, CoordModeOrigin);
|
||||
}
|
||||
|
@ -223,7 +229,7 @@ screenhack (Display *the_dpy, Window the_window)
|
|||
|
||||
Logf("Rockbox will kill ya!");
|
||||
|
||||
tetris();
|
||||
app_main();
|
||||
}
|
||||
|
||||
void screen_redraw()
|
||||
|
|
Loading…
Reference in a new issue