From 13d2ba0a36c45317f42abc2567e5e59effe4691b Mon Sep 17 00:00:00 2001 From: bernie Date: Tue, 17 Jan 2006 02:31:57 +0000 Subject: [PATCH] Test gfx with the usual pentagons. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@474 38d2e660-2303-0410-9eaa-f027e97ec537 --- drv/lcd_gfx_test.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/drv/lcd_gfx_test.c b/drv/lcd_gfx_test.c index 50b41c6c..d86c3936 100755 --- a/drv/lcd_gfx_test.c +++ b/drv/lcd_gfx_test.c @@ -14,6 +14,9 @@ /*#* *#* $Log$ + *#* Revision 1.2 2006/01/17 02:31:57 bernie + *#* Test gfx with the usual pentagons. + *#* *#* Revision 1.1 2006/01/16 03:51:35 bernie *#* Add LCD Qt emulator. *#* @@ -21,14 +24,44 @@ #include #include +#include + +static void magic(struct Bitmap *bitmap, coord_t x, coord_t y) +{ + 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 }; + unsigned int i; + + gfx_moveTo(bitmap, coords[countof(coords)-2]/2 + x, coords[countof(coords)-1]/3 + y); + for (i = 0; i < countof(coords); i += 2) + gfx_lineTo(bitmap, coords[i]/2 + x, coords[i+1]/3 + y); +} int main(int argc, char *argv[]) { emul_init(&argc, argv); lcd_init(); + coord_t x = 0, y = LCD_WIDTH / 2; + coord_t xdir = +1, ydir = -1; + for(;;) + { + gfx_bitmapClear(&lcd_bitmap); + gfx_rectDraw(&lcd_bitmap, 10, 10, LCD_WIDTH-10, LCD_HEIGHT-10); + gfx_setClipRect(&lcd_bitmap, 10, 10, LCD_WIDTH-10, LCD_HEIGHT-10); + magic(&lcd_bitmap, x, y); + + x += xdir; + y += ydir; + if (x >= LCD_WIDTH) xdir = -1; + if (x <= -50) xdir = +1; + if (y >= LCD_HEIGHT) ydir = -1; + if (y <= -50) ydir = +1; + + lcd_blit_bitmap(&lcd_bitmap); emul_idle(); + usleep(100); + } emul_cleanup(); return 0; -- 2.25.1