diff options
author | Jens Arnold <amiconn@rockbox.org> | 2006-10-16 00:40:40 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2006-10-16 00:40:40 +0000 |
commit | 50d275dc373826335aca3373dfa51957ec8e2ba7 (patch) | |
tree | a89d72da65c12b49f1c98d6f961a0d8499c0a57f /apps/plugins/flipit.c | |
parent | 634f1d6b591ca4f8779f19bc3df54eb632c44db6 (diff) | |
download | rockbox-50d275dc373826335aca3373dfa51957ec8e2ba7.tar.gz rockbox-50d275dc373826335aca3373dfa51957ec8e2ba7.zip |
FlipIt: Ported to archos Player :-)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11231 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/flipit.c')
-rw-r--r-- | apps/plugins/flipit.c | 231 |
1 files changed, 169 insertions, 62 deletions
diff --git a/apps/plugins/flipit.c b/apps/plugins/flipit.c index 0b9878856c..0ee10265af 100644 --- a/apps/plugins/flipit.c +++ b/apps/plugins/flipit.c | |||
@@ -17,48 +17,57 @@ | |||
17 | * | 17 | * |
18 | ****************************************************************************/ | 18 | ****************************************************************************/ |
19 | #include "plugin.h" | 19 | #include "plugin.h" |
20 | #ifdef HAVE_LCD_BITMAP | ||
21 | 20 | ||
22 | PLUGIN_HEADER | 21 | PLUGIN_HEADER |
23 | 22 | ||
24 | /* variable button definitions */ | 23 | /* variable button definitions */ |
25 | #if CONFIG_KEYPAD == RECORDER_PAD | 24 | #if CONFIG_KEYPAD == RECORDER_PAD |
26 | #define FLIPIT_UP BUTTON_UP | 25 | #define FLIPIT_UP BUTTON_UP |
27 | #define FLIPIT_DOWN BUTTON_DOWN | 26 | #define FLIPIT_DOWN BUTTON_DOWN |
28 | #define FLIPIT_QUIT BUTTON_OFF | 27 | #define FLIPIT_QUIT BUTTON_OFF |
29 | #define FLIPIT_SHUFFLE BUTTON_F1 | 28 | #define FLIPIT_SHUFFLE BUTTON_F1 |
30 | #define FLIPIT_SOLVE BUTTON_F2 | 29 | #define FLIPIT_SOLVE BUTTON_F2 |
31 | #define FLIPIT_STEP_BY_STEP BUTTON_F3 | 30 | #define FLIPIT_STEP_BY_STEP BUTTON_F3 |
32 | #define FLIPIT_TOGGLE BUTTON_PLAY | 31 | #define FLIPIT_TOGGLE BUTTON_PLAY |
32 | |||
33 | #elif CONFIG_KEYPAD == PLAYER_PAD | ||
34 | #define FLIPIT_UP_PRE BUTTON_ON | ||
35 | #define FLIPIT_UP (BUTTON_ON | BUTTON_REL) | ||
36 | #define FLIPIT_DOWN BUTTON_MENU | ||
37 | #define FLIPIT_QUIT BUTTON_STOP | ||
38 | #define FLIPIT_SHUFFLE (BUTTON_ON | BUTTON_LEFT) | ||
39 | #define FLIPIT_SOLVE (BUTTON_ON | BUTTON_RIGHT) | ||
40 | #define FLIPIT_STEP_BY_STEP (BUTTON_ON | BUTTON_PLAY) | ||
41 | #define FLIPIT_TOGGLE BUTTON_PLAY | ||
33 | 42 | ||
34 | #elif CONFIG_KEYPAD == ONDIO_PAD | 43 | #elif CONFIG_KEYPAD == ONDIO_PAD |
35 | #define FLIPIT_UP BUTTON_UP | 44 | #define FLIPIT_UP BUTTON_UP |
36 | #define FLIPIT_DOWN BUTTON_DOWN | 45 | #define FLIPIT_DOWN BUTTON_DOWN |
37 | #define FLIPIT_QUIT BUTTON_OFF | 46 | #define FLIPIT_QUIT BUTTON_OFF |
38 | #define FLIPIT_SHUFFLE (BUTTON_MENU | BUTTON_LEFT) | 47 | #define FLIPIT_SHUFFLE (BUTTON_MENU | BUTTON_LEFT) |
39 | #define FLIPIT_SOLVE (BUTTON_MENU | BUTTON_UP) | 48 | #define FLIPIT_SOLVE (BUTTON_MENU | BUTTON_UP) |
40 | #define FLIPIT_STEP_BY_STEP (BUTTON_MENU | BUTTON_RIGHT) | 49 | #define FLIPIT_STEP_BY_STEP (BUTTON_MENU | BUTTON_RIGHT) |
41 | #define FLIPIT_TOGGLE_PRE BUTTON_MENU | 50 | #define FLIPIT_TOGGLE_PRE BUTTON_MENU |
42 | #define FLIPIT_TOGGLE (BUTTON_MENU | BUTTON_REL) | 51 | #define FLIPIT_TOGGLE (BUTTON_MENU | BUTTON_REL) |
43 | 52 | ||
44 | #elif (CONFIG_KEYPAD == IRIVER_H100_PAD) || \ | 53 | #elif (CONFIG_KEYPAD == IRIVER_H100_PAD) || \ |
45 | (CONFIG_KEYPAD == IRIVER_H300_PAD) | 54 | (CONFIG_KEYPAD == IRIVER_H300_PAD) |
46 | #define FLIPIT_UP BUTTON_UP | 55 | #define FLIPIT_UP BUTTON_UP |
47 | #define FLIPIT_DOWN BUTTON_DOWN | 56 | #define FLIPIT_DOWN BUTTON_DOWN |
48 | #define FLIPIT_QUIT BUTTON_OFF | 57 | #define FLIPIT_QUIT BUTTON_OFF |
49 | #define FLIPIT_SHUFFLE BUTTON_MODE | 58 | #define FLIPIT_SHUFFLE BUTTON_MODE |
50 | #define FLIPIT_SOLVE BUTTON_ON | 59 | #define FLIPIT_SOLVE BUTTON_ON |
51 | #define FLIPIT_STEP_BY_STEP BUTTON_REC | 60 | #define FLIPIT_STEP_BY_STEP BUTTON_REC |
52 | #define FLIPIT_TOGGLE_PRE BUTTON_SELECT | 61 | #define FLIPIT_TOGGLE_PRE BUTTON_SELECT |
53 | #define FLIPIT_TOGGLE (BUTTON_SELECT | BUTTON_REL) | 62 | #define FLIPIT_TOGGLE (BUTTON_SELECT | BUTTON_REL) |
54 | 63 | ||
55 | #define FLIPIT_RC_QUIT BUTTON_RC_STOP | 64 | #define FLIPIT_RC_QUIT BUTTON_RC_STOP |
56 | 65 | ||
57 | #elif (CONFIG_KEYPAD == IPOD_4G_PAD) || \ | 66 | #elif (CONFIG_KEYPAD == IPOD_4G_PAD) || \ |
58 | (CONFIG_KEYPAD == IPOD_3G_PAD) | 67 | (CONFIG_KEYPAD == IPOD_3G_PAD) |
59 | 68 | ||
60 | #define FLIPIT_UP BUTTON_MENU | 69 | #define FLIPIT_UP BUTTON_MENU |
61 | #define FLIPIT_DOWN BUTTON_PLAY | 70 | #define FLIPIT_DOWN BUTTON_PLAY |
62 | #define FLIPIT_QUIT (BUTTON_SELECT | BUTTON_MENU) | 71 | #define FLIPIT_QUIT (BUTTON_SELECT | BUTTON_MENU) |
63 | #define FLIPIT_SHUFFLE (BUTTON_SELECT | BUTTON_LEFT) | 72 | #define FLIPIT_SHUFFLE (BUTTON_SELECT | BUTTON_LEFT) |
64 | #define FLIPIT_SOLVE (BUTTON_SELECT | BUTTON_PLAY) | 73 | #define FLIPIT_SOLVE (BUTTON_SELECT | BUTTON_PLAY) |
@@ -68,36 +77,36 @@ PLUGIN_HEADER | |||
68 | 77 | ||
69 | #elif (CONFIG_KEYPAD == IAUDIO_X5_PAD) | 78 | #elif (CONFIG_KEYPAD == IAUDIO_X5_PAD) |
70 | 79 | ||
71 | #define FLIPIT_UP BUTTON_UP | 80 | #define FLIPIT_UP BUTTON_UP |
72 | #define FLIPIT_DOWN BUTTON_DOWN | 81 | #define FLIPIT_DOWN BUTTON_DOWN |
73 | #define FLIPIT_QUIT BUTTON_POWER | 82 | #define FLIPIT_QUIT BUTTON_POWER |
74 | #define FLIPIT_SHUFFLE (BUTTON_PLAY | BUTTON_LEFT) | 83 | #define FLIPIT_SHUFFLE (BUTTON_PLAY | BUTTON_LEFT) |
75 | #define FLIPIT_SOLVE (BUTTON_PLAY | BUTTON_RIGHT) | 84 | #define FLIPIT_SOLVE (BUTTON_PLAY | BUTTON_RIGHT) |
76 | #define FLIPIT_STEP_BY_STEP (BUTTON_PLAY | BUTTON_UP) | 85 | #define FLIPIT_STEP_BY_STEP (BUTTON_PLAY | BUTTON_UP) |
77 | #define FLIPIT_TOGGLE_PRE BUTTON_SELECT | 86 | #define FLIPIT_TOGGLE_PRE BUTTON_SELECT |
78 | #define FLIPIT_TOGGLE (BUTTON_SELECT | BUTTON_REL) | 87 | #define FLIPIT_TOGGLE (BUTTON_SELECT | BUTTON_REL) |
79 | 88 | ||
80 | #elif (CONFIG_KEYPAD == GIGABEAT_PAD) | 89 | #elif (CONFIG_KEYPAD == GIGABEAT_PAD) |
81 | 90 | ||
82 | #define FLIPIT_UP BUTTON_UP | 91 | #define FLIPIT_UP BUTTON_UP |
83 | #define FLIPIT_DOWN BUTTON_DOWN | 92 | #define FLIPIT_DOWN BUTTON_DOWN |
84 | #define FLIPIT_QUIT BUTTON_A | 93 | #define FLIPIT_QUIT BUTTON_A |
85 | #define FLIPIT_SHUFFLE (BUTTON_POWER | BUTTON_LEFT) | 94 | #define FLIPIT_SHUFFLE (BUTTON_POWER | BUTTON_LEFT) |
86 | #define FLIPIT_SOLVE (BUTTON_POWER | BUTTON_RIGHT) | 95 | #define FLIPIT_SOLVE (BUTTON_POWER | BUTTON_RIGHT) |
87 | #define FLIPIT_STEP_BY_STEP (BUTTON_POWER | BUTTON_UP) | 96 | #define FLIPIT_STEP_BY_STEP (BUTTON_POWER | BUTTON_UP) |
88 | #define FLIPIT_TOGGLE_PRE BUTTON_MENU | 97 | #define FLIPIT_TOGGLE_PRE BUTTON_MENU |
89 | #define FLIPIT_TOGGLE (BUTTON_MENU | BUTTON_REL) | 98 | #define FLIPIT_TOGGLE (BUTTON_MENU | BUTTON_REL) |
90 | 99 | ||
91 | #elif (CONFIG_KEYPAD == IRIVER_H10_PAD) | 100 | #elif (CONFIG_KEYPAD == IRIVER_H10_PAD) |
92 | 101 | ||
93 | #define FLIPIT_UP BUTTON_SCROLL_UP | 102 | #define FLIPIT_UP BUTTON_SCROLL_UP |
94 | #define FLIPIT_DOWN BUTTON_SCROLL_DOWN | 103 | #define FLIPIT_DOWN BUTTON_SCROLL_DOWN |
95 | #define FLIPIT_QUIT BUTTON_POWER | 104 | #define FLIPIT_QUIT BUTTON_POWER |
96 | #define FLIPIT_SHUFFLE (BUTTON_PLAY | BUTTON_LEFT) | 105 | #define FLIPIT_SHUFFLE (BUTTON_PLAY | BUTTON_LEFT) |
97 | #define FLIPIT_SOLVE (BUTTON_PLAY | BUTTON_RIGHT) | 106 | #define FLIPIT_SOLVE (BUTTON_PLAY | BUTTON_RIGHT) |
98 | #define FLIPIT_STEP_BY_STEP (BUTTON_PLAY | BUTTON_SCROLL_UP) | 107 | #define FLIPIT_STEP_BY_STEP (BUTTON_PLAY | BUTTON_SCROLL_UP) |
99 | #define FLIPIT_TOGGLE_PRE BUTTON_REW | 108 | #define FLIPIT_TOGGLE_PRE BUTTON_REW |
100 | #define FLIPIT_TOGGLE (BUTTON_REW | BUTTON_REL) | 109 | #define FLIPIT_TOGGLE (BUTTON_REW | BUTTON_REL) |
101 | 110 | ||
102 | #endif | 111 | #endif |
103 | 112 | ||
@@ -106,6 +115,8 @@ static int spots[20]; | |||
106 | static int toggle[20]; | 115 | static int toggle[20]; |
107 | static int cursor_pos, moves; | 116 | static int cursor_pos, moves; |
108 | 117 | ||
118 | #ifdef HAVE_LCD_BITMAP | ||
119 | |||
109 | #include "flipit_cursor.h" | 120 | #include "flipit_cursor.h" |
110 | #include "flipit_tokens.h" | 121 | #include "flipit_tokens.h" |
111 | 122 | ||
@@ -146,12 +157,6 @@ static void draw_cursor(void) | |||
146 | #endif | 157 | #endif |
147 | } | 158 | } |
148 | 159 | ||
149 | /* clear the cursor where it is */ | ||
150 | static inline void clear_cursor(void) | ||
151 | { | ||
152 | draw_spot( cursor_pos ); | ||
153 | } | ||
154 | |||
155 | /* draw the info panel ... duh */ | 160 | /* draw the info panel ... duh */ |
156 | static void draw_info_panel(void) | 161 | static void draw_info_panel(void) |
157 | { | 162 | { |
@@ -169,6 +174,86 @@ static void draw_info_panel(void) | |||
169 | GRID_TOP + 4*(TK_HEIGHT+TK_SPACE) + 2, s ); | 174 | GRID_TOP + 4*(TK_HEIGHT+TK_SPACE) + 2, s ); |
170 | } | 175 | } |
171 | 176 | ||
177 | #else /* HAVE_LCD_CHARCELLS */ | ||
178 | |||
179 | static const unsigned char tk_pat[4][7] = { | ||
180 | { 0x0e, 0x11, 0x0e, 0x00, 0x0e, 0x11, 0x0e }, /* white - white */ | ||
181 | { 0x0e, 0x11, 0x0e, 0x00, 0x0e, 0x1f, 0x0e }, /* white - black */ | ||
182 | { 0x0e, 0x1f, 0x0e, 0x00, 0x0e, 0x11, 0x0e }, /* black - white */ | ||
183 | { 0x0e, 0x1f, 0x0e, 0x00, 0x0e, 0x1f, 0x0e } /* black - black */ | ||
184 | }; | ||
185 | |||
186 | static unsigned char cur_pat[7]; | ||
187 | static unsigned char gfx_chars[5]; | ||
188 | |||
189 | static void release_gfx(void) | ||
190 | { | ||
191 | int i; | ||
192 | |||
193 | for (i = 0; i < 5; i++) | ||
194 | if (gfx_chars[i]) | ||
195 | rb->lcd_unlock_pattern(gfx_chars[i]); | ||
196 | } | ||
197 | |||
198 | static bool init_gfx(void) | ||
199 | { | ||
200 | int i; | ||
201 | |||
202 | for (i = 0; i < 5; i++) { | ||
203 | if ((gfx_chars[i] = rb->lcd_get_locked_pattern()) == 0) { | ||
204 | release_gfx(); | ||
205 | return false; | ||
206 | } | ||
207 | } | ||
208 | for (i = 0; i < 4; i++) | ||
209 | rb->lcd_define_pattern(gfx_chars[i], tk_pat[i]); | ||
210 | return true; | ||
211 | } | ||
212 | |||
213 | /* draw a spot at the coordinates (x,y), range of p is 0-19 */ | ||
214 | static void draw_spot(int p) | ||
215 | { | ||
216 | if ((p/5) & 1) | ||
217 | p -= 5; | ||
218 | |||
219 | rb->lcd_putc (p%5, p/10, gfx_chars[2*spots[p]+spots[p+5]]); | ||
220 | } | ||
221 | |||
222 | /* draw the cursor at the current cursor position */ | ||
223 | static void draw_cursor(void) | ||
224 | { | ||
225 | if ((cursor_pos/5) & 1) { | ||
226 | rb->memcpy( cur_pat, tk_pat[2*spots[cursor_pos-5]+spots[cursor_pos]], 7 ); | ||
227 | cur_pat[4] ^= 0x15; | ||
228 | cur_pat[6] ^= 0x11; | ||
229 | } | ||
230 | else { | ||
231 | rb->memcpy( cur_pat, tk_pat[2*spots[cursor_pos]+spots[cursor_pos+5]], 7 ); | ||
232 | cur_pat[0] ^= 0x15; | ||
233 | cur_pat[2] ^= 0x11; | ||
234 | } | ||
235 | rb->lcd_define_pattern(gfx_chars[4], cur_pat); | ||
236 | rb->lcd_putc( cursor_pos%5, cursor_pos/10, gfx_chars[4] ); | ||
237 | } | ||
238 | |||
239 | /* draw the info panel ... duh */ | ||
240 | static void draw_info_panel(void) | ||
241 | { | ||
242 | char s[16]; | ||
243 | |||
244 | rb->lcd_puts( 6, 0, "Flips" ); | ||
245 | rb->snprintf( s, sizeof(s), "%d", moves ); | ||
246 | rb->lcd_puts( 6, 1, s ); | ||
247 | } | ||
248 | |||
249 | #endif /* LCD */ | ||
250 | |||
251 | /* clear the cursor where it is */ | ||
252 | static inline void clear_cursor(void) | ||
253 | { | ||
254 | draw_spot( cursor_pos ); | ||
255 | } | ||
256 | |||
172 | /* check if the puzzle is finished */ | 257 | /* check if the puzzle is finished */ |
173 | static bool flipit_finished(void) | 258 | static bool flipit_finished(void) |
174 | { | 259 | { |
@@ -219,21 +304,25 @@ static void move_cursor(int x, int y) | |||
219 | + ( ( y + 4 + cursor_pos/5 )%4 )*5; | 304 | + ( ( y + 4 + cursor_pos/5 )%4 )*5; |
220 | draw_cursor(); | 305 | draw_cursor(); |
221 | } | 306 | } |
307 | #ifdef HAVE_LCD_BITMAP | ||
222 | rb->lcd_update(); | 308 | rb->lcd_update(); |
309 | #endif | ||
223 | } | 310 | } |
224 | 311 | ||
225 | /* initialize the board */ | 312 | /* initialize the board */ |
226 | static void flipit_init(void) | 313 | static void flipit_init(void) |
227 | { | 314 | { |
228 | int i; | 315 | int i; |
316 | |||
229 | rb->lcd_clear_display(); | 317 | rb->lcd_clear_display(); |
230 | moves = 0; | ||
231 | for (i=0; i<20; i++) { | 318 | for (i=0; i<20; i++) { |
232 | spots[i]=1; | 319 | spots[i]=1; |
233 | toggle[i]=1; | 320 | toggle[i]=1; |
234 | draw_spot(i); | 321 | draw_spot(i); |
235 | } | 322 | } |
323 | #ifdef HAVE_LCD_BITMAP | ||
236 | rb->lcd_update(); | 324 | rb->lcd_update(); |
325 | #endif | ||
237 | for (i=0; i<20; i++) { | 326 | for (i=0; i<20; i++) { |
238 | cursor_pos = (rb->rand() % 20); | 327 | cursor_pos = (rb->rand() % 20); |
239 | flipit_toggle(); | 328 | flipit_toggle(); |
@@ -243,7 +332,9 @@ static void flipit_init(void) | |||
243 | draw_cursor(); | 332 | draw_cursor(); |
244 | moves = 0; | 333 | moves = 0; |
245 | draw_info_panel(); | 334 | draw_info_panel(); |
335 | #ifdef HAVE_LCD_BITMAP | ||
246 | rb->lcd_update(); | 336 | rb->lcd_update(); |
337 | #endif | ||
247 | } | 338 | } |
248 | 339 | ||
249 | /* the main game loop */ | 340 | /* the main game loop */ |
@@ -278,7 +369,9 @@ static bool flipit_loop(void) | |||
278 | cursor_pos = i; | 369 | cursor_pos = i; |
279 | flipit_toggle(); | 370 | flipit_toggle(); |
280 | draw_cursor(); | 371 | draw_cursor(); |
372 | #ifdef HAVE_LCD_BITMAP | ||
281 | rb->lcd_update(); | 373 | rb->lcd_update(); |
374 | #endif | ||
282 | rb->sleep(HZ*2/3); | 375 | rb->sleep(HZ*2/3); |
283 | } | 376 | } |
284 | } | 377 | } |
@@ -292,7 +385,9 @@ static bool flipit_loop(void) | |||
292 | cursor_pos = i; | 385 | cursor_pos = i; |
293 | flipit_toggle(); | 386 | flipit_toggle(); |
294 | draw_cursor(); | 387 | draw_cursor(); |
388 | #ifdef HAVE_LCD_BITMAP | ||
295 | rb->lcd_update(); | 389 | rb->lcd_update(); |
390 | #endif | ||
296 | break; | 391 | break; |
297 | } | 392 | } |
298 | } | 393 | } |
@@ -307,7 +402,9 @@ static bool flipit_loop(void) | |||
307 | if (!flipit_finished()) { | 402 | if (!flipit_finished()) { |
308 | flipit_toggle(); | 403 | flipit_toggle(); |
309 | draw_cursor(); | 404 | draw_cursor(); |
405 | #ifdef HAVE_LCD_BITMAP | ||
310 | rb->lcd_update(); | 406 | rb->lcd_update(); |
407 | #endif | ||
311 | } | 408 | } |
312 | break; | 409 | break; |
313 | 410 | ||
@@ -320,6 +417,10 @@ static bool flipit_loop(void) | |||
320 | break; | 417 | break; |
321 | 418 | ||
322 | case FLIPIT_UP: | 419 | case FLIPIT_UP: |
420 | #ifdef FLIPIT_UP_PRE | ||
421 | if (lastbutton != FLIPIT_UP_PRE) | ||
422 | break; | ||
423 | #endif | ||
323 | move_cursor(0, -1); | 424 | move_cursor(0, -1); |
324 | break; | 425 | break; |
325 | 426 | ||
@@ -340,7 +441,10 @@ static bool flipit_loop(void) | |||
340 | /* called function from outside */ | 441 | /* called function from outside */ |
341 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 442 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) |
342 | { | 443 | { |
343 | int w, h, i; | 444 | int i, rc; |
445 | #ifdef HAVE_LCD_BITMAP | ||
446 | int w, h; | ||
447 | #endif | ||
344 | 448 | ||
345 | (void)parameter; | 449 | (void)parameter; |
346 | rb = api; | 450 | rb = api; |
@@ -349,15 +453,9 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
349 | rb->lcd_set_background(LCD_WHITE); | 453 | rb->lcd_set_background(LCD_WHITE); |
350 | #endif | 454 | #endif |
351 | 455 | ||
352 | /* print title */ | 456 | rb->splash(HZ, true, "FlipIt!"); |
353 | rb->lcd_getstringsize("FlipIt!", &w, &h); | ||
354 | w = (w+1)/2; | ||
355 | h = (h+1)/2; | ||
356 | rb->lcd_clear_display(); | ||
357 | rb->lcd_putsxy(LCD_WIDTH/2-w, (LCD_HEIGHT/2)-h, "FlipIt!"); | ||
358 | rb->lcd_update(); | ||
359 | rb->sleep(HZ); | ||
360 | 457 | ||
458 | #ifdef HAVE_LCD_BITMAP | ||
361 | /* print instructions */ | 459 | /* print instructions */ |
362 | rb->lcd_clear_display(); | 460 | rb->lcd_clear_display(); |
363 | rb->lcd_setfont(FONT_SYSFIXED); | 461 | rb->lcd_setfont(FONT_SYSFIXED); |
@@ -388,6 +486,10 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
388 | rb->lcd_putsxy(2, 48, "[S-RIGHT] step by step"); | 486 | rb->lcd_putsxy(2, 48, "[S-RIGHT] step by step"); |
389 | #endif | 487 | #endif |
390 | rb->lcd_update(); | 488 | rb->lcd_update(); |
489 | #else /* HAVE_LCD_CHARCELLS */ | ||
490 | if (!init_gfx()) | ||
491 | return PLUGIN_ERROR; | ||
492 | #endif | ||
391 | rb->button_get_w_tmo(HZ*3); | 493 | rb->button_get_w_tmo(HZ*3); |
392 | 494 | ||
393 | rb->lcd_clear_display(); | 495 | rb->lcd_clear_display(); |
@@ -396,10 +498,15 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
396 | spots[i]=1; | 498 | spots[i]=1; |
397 | draw_spot(i); | 499 | draw_spot(i); |
398 | } | 500 | } |
501 | #ifdef HAVE_LCD_BITMAP | ||
399 | rb->lcd_update(); | 502 | rb->lcd_update(); |
503 | #endif | ||
400 | rb->sleep(HZ*3/2); | 504 | rb->sleep(HZ*3/2); |
401 | rb->srand(*rb->current_tick); | 505 | rb->srand(*rb->current_tick); |
402 | 506 | ||
403 | return flipit_loop(); | 507 | rc = flipit_loop(); |
404 | } | 508 | #ifdef HAVE_LCD_CHARCELLS |
509 | release_gfx(); | ||
405 | #endif | 510 | #endif |
511 | return rc; | ||
512 | } | ||