summaryrefslogtreecommitdiffstats
path: root/apps/plugins/mosaique.c
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2004-10-18 21:45:00 +0000
committerJens Arnold <amiconn@rockbox.org>2004-10-18 21:45:00 +0000
commite35a658ded457698aca2401b699e743a3011cfce (patch)
treecb89b7785ef2c72f7a293fe165a4d3b76e38227f /apps/plugins/mosaique.c
parentd24766675db5faddb67810ca67b37491d49c2313 (diff)
downloadrockbox-e35a658ded457698aca2401b699e743a3011cfce.tar.gz
rockbox-e35a658ded457698aca2401b699e743a3011cfce.tar.bz2
rockbox-e35a658ded457698aca2401b699e743a3011cfce.zip
Plugin rework 2: (all) Compile-time keyboard configuration, for Ondio adaption. (all) Now using the default event handler, standard placement is now in switch() default case. (minesweeper,pong,snake,snake2) added USB handling. (mandelbrot,mosaique) Fixed return value. (minesweeper) fast moving with button repeat. (oscillograph) Fixed cleanup in USB case.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5304 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/mosaique.c')
-rw-r--r--apps/plugins/mosaique.c65
1 files changed, 41 insertions, 24 deletions
diff --git a/apps/plugins/mosaique.c b/apps/plugins/mosaique.c
index ed4ad560c1..09c56c3bc3 100644
--- a/apps/plugins/mosaique.c
+++ b/apps/plugins/mosaique.c
@@ -23,6 +23,19 @@
#define LARGE 55
#define HAUT 31
+/* variable button definitions */
+#if CONFIG_KEYPAD == RECORDER_PAD
+#define MOSAIQUE_QUIT BUTTON_OFF
+#define MOSAIQUE_SPEED BUTTON_F1
+#define MOSAIQUE_RESTART BUTTON_PLAY
+
+#elif CONFIG_KEYPAD == ONDIO_PAD
+#define MOSAIQUE_QUIT BUTTON_OFF
+#define MOSAIQUE_SPEED BUTTON_LEFT
+#define MOSAIQUE_SPEED2 BUTTON_RIGHT
+#define MOSAIQUE_RESTART BUTTON_MENU
+
+#endif
enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
{
@@ -74,32 +87,36 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
rb->sleep(HZ/timer);
button = rb->button_get(false);
- if ( button == BUTTON_OFF)
- {
- return false;
- }
-
- if ( button == BUTTON_F1 )
- {
- timer = timer+5;
- if (timer>20)
- timer=5;
- }
-
- if ( button == BUTTON_PLAY )
+ switch (button)
{
- sx = rb->rand()%20+1;
- sy = rb->rand()%20+1;
- x=0;
- y=0;
- rb->lcd_clear_display();
- }
-
- if ( button == SYS_USB_CONNECTED) {
- rb->usb_screen();
- return 0;
- }
+ case MOSAIQUE_QUIT:
+
+ return PLUGIN_OK;
+
+ case MOSAIQUE_SPEED:
+#ifdef MOSAIQUE_SPEED2
+ case MOSAIQUE_SPEED2:
+#endif
+ timer = timer+5;
+ if (timer>20)
+ timer=5;
+ break;
+
+ case MOSAIQUE_RESTART:
+ sx = rb->rand()%20+1;
+ sy = rb->rand()%20+1;
+ x=0;
+ y=0;
+ rb->lcd_clear_display();
+ break;
+
+
+ default:
+ if (rb->default_event_handler(button) == SYS_USB_CONNECTED)
+ return PLUGIN_USB_CONNECTED;
+ break;
+ }
}
}