diff options
Diffstat (limited to 'apps/plugins/mosaique.c')
-rw-r--r-- | apps/plugins/mosaique.c | 65 |
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 @@ | |||
23 | #define LARGE 55 | 23 | #define LARGE 55 |
24 | #define HAUT 31 | 24 | #define HAUT 31 |
25 | 25 | ||
26 | /* variable button definitions */ | ||
27 | #if CONFIG_KEYPAD == RECORDER_PAD | ||
28 | #define MOSAIQUE_QUIT BUTTON_OFF | ||
29 | #define MOSAIQUE_SPEED BUTTON_F1 | ||
30 | #define MOSAIQUE_RESTART BUTTON_PLAY | ||
31 | |||
32 | #elif CONFIG_KEYPAD == ONDIO_PAD | ||
33 | #define MOSAIQUE_QUIT BUTTON_OFF | ||
34 | #define MOSAIQUE_SPEED BUTTON_LEFT | ||
35 | #define MOSAIQUE_SPEED2 BUTTON_RIGHT | ||
36 | #define MOSAIQUE_RESTART BUTTON_MENU | ||
37 | |||
38 | #endif | ||
26 | 39 | ||
27 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 40 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) |
28 | { | 41 | { |
@@ -74,32 +87,36 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
74 | rb->sleep(HZ/timer); | 87 | rb->sleep(HZ/timer); |
75 | 88 | ||
76 | button = rb->button_get(false); | 89 | button = rb->button_get(false); |
77 | if ( button == BUTTON_OFF) | 90 | switch (button) |
78 | { | ||
79 | return false; | ||
80 | } | ||
81 | |||
82 | if ( button == BUTTON_F1 ) | ||
83 | { | ||
84 | timer = timer+5; | ||
85 | if (timer>20) | ||
86 | timer=5; | ||
87 | } | ||
88 | |||
89 | if ( button == BUTTON_PLAY ) | ||
90 | { | 91 | { |
91 | sx = rb->rand()%20+1; | 92 | case MOSAIQUE_QUIT: |
92 | sy = rb->rand()%20+1; | 93 | |
93 | x=0; | 94 | return PLUGIN_OK; |
94 | y=0; | 95 | |
95 | rb->lcd_clear_display(); | 96 | case MOSAIQUE_SPEED: |
96 | } | 97 | #ifdef MOSAIQUE_SPEED2 |
97 | 98 | case MOSAIQUE_SPEED2: | |
98 | if ( button == SYS_USB_CONNECTED) { | 99 | #endif |
99 | rb->usb_screen(); | 100 | timer = timer+5; |
100 | return 0; | 101 | if (timer>20) |
101 | } | 102 | timer=5; |
103 | break; | ||
104 | |||
105 | case MOSAIQUE_RESTART: | ||
102 | 106 | ||
107 | sx = rb->rand()%20+1; | ||
108 | sy = rb->rand()%20+1; | ||
109 | x=0; | ||
110 | y=0; | ||
111 | rb->lcd_clear_display(); | ||
112 | break; | ||
113 | |||
114 | |||
115 | default: | ||
116 | if (rb->default_event_handler(button) == SYS_USB_CONNECTED) | ||
117 | return PLUGIN_USB_CONNECTED; | ||
118 | break; | ||
119 | } | ||
103 | } | 120 | } |
104 | } | 121 | } |
105 | 122 | ||