/*#*
*#* $Log$
+ *#* Revision 1.7 2006/05/27 22:31:18 bernie
+ *#* Clean it up a bit more.
+ *#*
*#* Revision 1.6 2006/05/27 17:16:38 bernie
*#* Make demos a bit more interesting.
*#*
#include <icons/logo.h>
#include <cfg/macros.h>
+/**
+ * Draw a pentacle in the provided bitmap.
+ */
+void schedule(void)
+{
+ lcd_blitBitmap(&lcd_bitmap);
+ emul_idle();
+}
+
+/**
+ * Draw a pentacle in the provided bitmap.
+ */
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 };
gfx_lineTo(bitmap, coords[i]/2 + x, coords[i+1]/3 + y);
}
-Window root_win;
-
-void schedule(void)
-{
-// win_compose(&root_win);
- lcd_blitBitmap(&lcd_bitmap);
- emul_idle();
- usleep(10000);
-}
-
void hello_world(Bitmap *bm)
{
const Font *old_font = bm->font;
text_xprintf(bm, 1, 0, STYLEF_BOLD | TEXT_FILL | TEXT_CENTER,
"Hello, world!");
- for (int i = 0; i < 1000; ++i)
- {
- lcd_blitBitmap(bm);
- emul_idle();
- }
+ lcd_blitBitmap(bm);
+ timer_delay(1000);
/* Restore old font */
gfx_setFont(bm, old_font);
const coord_t small_left = 45, small_top = 30, small_width = 50, small_height = 30;
const coord_t large_left = -10, large_top = 10, large_width = 85, large_height = 41;
- Window small_win, large_win;
+ Window root_win, small_win, large_win;
Bitmap small_bm, large_bm;
uint8_t small_raster[RASTER_SIZE(small_width, small_height)];
uint8_t large_raster[RASTER_SIZE(large_width, large_height)];
for(;;)
{
- if (kbd_peek())
- break;
-
/* Background animation */
+ bm = root_win.bitmap;
gfx_bitmapClear(bm);
-/* gfx_setClipRect(bm, 0, 0, bm->width, bm->height);
- gfx_rectDraw(bm, 10, 10, bm->width-10, bm->height-10);
- gfx_setClipRect(bm, 11, 11, bm->width-11, bm->height-11);
-*/ magic(bm, x, y);
+// gfx_setClipRect(bm, 0, 0, bm->width, bm->height);
+// gfx_rectDraw(bm, 10, 10, bm->width-10, bm->height-10);
+// gfx_setClipRect(bm, 11, 11, bm->width-11, bm->height-11);
+ magic(bm, x, y);
x += xdir;
y += ydir;
if (x >= bm->width) xdir = -1;
win_raise(&large_win);
win_compose(&root_win);
- lcd_blitBitmap(root_win.bitmap);
- emul_idle();
- usleep(10000);
+
+ /* Also does LCD refresh, etc. */
+ if (kbd_peek())
+ break;
}
}
static struct MenuItem main_items[] =
{
- { (const_iptr_t)"Flying Win", 0, (MenuHook)win_demo, (iptr_t)&lcd_bitmap },
- { (const_iptr_t)"Settings", 0, (MenuHook)menu_handle, (iptr_t)&settings_menu },
- { (const_iptr_t)"Display", 0, (MenuHook)menu_handle, (iptr_t)&display_menu },
- { (const_iptr_t)"Setup", 0, (MenuHook)menu_handle, (iptr_t)&setup_menu },
+ { (const_iptr_t)"Win Fly", 0, (MenuHook)win_demo, (iptr_t)&lcd_bitmap },
+ { (const_iptr_t)"Bounce!", 0, (MenuHook)bouncing_logo,(iptr_t)&lcd_bitmap },
+ { (const_iptr_t)"Hello World", 0, (MenuHook)hello_world, (iptr_t)&lcd_bitmap },
+ { (const_iptr_t)"Settings", 0, (MenuHook)menu_handle, (iptr_t)&settings_menu },
+ { (const_iptr_t)"Display", 0, (MenuHook)menu_handle, (iptr_t)&display_menu },
+ { (const_iptr_t)"Setup", 0, (MenuHook)menu_handle, (iptr_t)&setup_menu },
{ (const_iptr_t)0, 0, NULL, (iptr_t)0 }
};
static struct Menu main_menu = { main_items, "Main Menu", MF_STICKY, &lcd_bitmap, 0 };
lcd_init();
proc_init();
- hello_world(&lcd_bitmap);
- bouncing_logo(&lcd_bitmap);
menu_handle(&main_menu);
emul_cleanup();