BeRTOS
|
00001 00040 #warning FIXME: broken test! 00041 00042 #if 0 00043 00044 #include <drv/lcd_gfx.h> 00045 #include <gfx/gfx.h> 00046 00047 #include <emul/emul.h> 00048 00049 static void magic(struct Bitmap *bitmap, coord_t x, coord_t y) 00050 { 00051 static const coord_t coords[] = { 120, 34, 90, 90, 30, 90, 0, 34, 60, 0, 90, 90, 0, 34, 120, 34, 30, 90, 60, 0 }; 00052 unsigned int i; 00053 00054 gfx_moveTo(bitmap, coords[countof(coords)-2]/2 + x, coords[countof(coords)-1]/3 + y); 00055 for (i = 0; i < countof(coords); i += 2) 00056 gfx_lineTo(bitmap, coords[i]/2 + x, coords[i+1]/3 + y); 00057 } 00058 00059 int main(int argc, char *argv[]) 00060 { 00061 emul_init(&argc, argv); 00062 lcd_init(); 00063 00064 coord_t x = 0, y = LCD_WIDTH / 2; 00065 coord_t xdir = +1, ydir = -1; 00066 Bitmap *bm = &lcd_bitmap; 00067 00068 for(;;) 00069 { 00070 gfx_bitmapClear(bm); 00071 gfx_setClipRect(bm, 0, 0, bm->width, bm->height); 00072 gfx_rectDraw(bm, 10, 10, bm->width-10, bm->height-10); 00073 gfx_setClipRect(bm, 11, 11, bm->width-11, bm->height-11); 00074 magic(bm, x, y); 00075 00076 x += xdir; 00077 y += ydir; 00078 if (x >= bm->width) xdir = -1; 00079 if (x <= -50) xdir = +1; 00080 if (y >= bm->height) ydir = -1; 00081 if (y <= -50) ydir = +1; 00082 00083 lcd_blit_bitmap(bm); 00084 emul_idle(); 00085 usleep(10000); 00086 } 00087 00088 emul_cleanup(); 00089 return 0; 00090 } 00091 00092 #endif