diff options
author | Jens Arnold <amiconn@rockbox.org> | 2004-10-17 00:54:09 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2004-10-17 00:54:09 +0000 |
commit | 79afbafa669bee52059d980ae887dfa06948c252 (patch) | |
tree | b359f4cb336fbd477ec990a37b86a73f8266e455 /apps/plugins/cube.c | |
parent | 7c2496d35a1046d6383a7df8a78a1e9ba5cf7607 (diff) | |
download | rockbox-79afbafa669bee52059d980ae887dfa06948c252.tar.gz rockbox-79afbafa669bee52059d980ae887dfa06948c252.zip |
Plugin rework 2: (most) Compile-time keyboard configuration, for Ondio adaption. (all) Now using the default event handler, standard placement is now in switch() default case. (calendar, chip8) Fixed usb handling.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5295 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/cube.c')
-rw-r--r-- | apps/plugins/cube.c | 58 |
1 files changed, 46 insertions, 12 deletions
diff --git a/apps/plugins/cube.c b/apps/plugins/cube.c index 17440ad496..b0c6daa656 100644 --- a/apps/plugins/cube.c +++ b/apps/plugins/cube.c | |||
@@ -24,6 +24,30 @@ | |||
24 | /* Loops that the values are displayed */ | 24 | /* Loops that the values are displayed */ |
25 | #define DISP_TIME 30 | 25 | #define DISP_TIME 30 |
26 | 26 | ||
27 | /* variable button definitions */ | ||
28 | #if CONFIG_KEYPAD == RECORDER_PAD | ||
29 | #define CUBE_QUIT (BUTTON_OFF | BUTTON_REL) | ||
30 | #define CUBE_X_INC BUTTON_RIGHT | ||
31 | #define CUBE_X_DEC BUTTON_LEFT | ||
32 | #define CUBE_Y_INC BUTTON_UP | ||
33 | #define CUBE_Y_DEC BUTTON_DOWN | ||
34 | #define CUBE_Z_INC BUTTON_F2 | ||
35 | #define CUBE_Z_DEC BUTTON_F1 | ||
36 | #define CUBE_HIGHSPEED BUTTON_PLAY | ||
37 | |||
38 | #elif CONFIG_KEYPAD == ONDIO_PAD | ||
39 | #define CUBE_QUIT (BUTTON_OFF | BUTTON_REL) | ||
40 | #define CUBE_X_INC BUTTON_RIGHT | ||
41 | #define CUBE_X_DEC BUTTON_LEFT | ||
42 | #define CUBE_Y_INC BUTTON_UP | ||
43 | #define CUBE_Y_DEC BUTTON_DOWN | ||
44 | #define CUBE_Z_INC (BUTTON_MENU | BUTTON_UP) | ||
45 | #define CUBE_Z_DEC (BUTTON_MENU | BUTTON_DOWN) | ||
46 | #define CUBE_HIGHSPEED_PRE BUTTON_MENU | ||
47 | #define CUBE_HIGHSPEED (BUTTON_MENU | BUTTON_REL) | ||
48 | |||
49 | #endif | ||
50 | |||
27 | struct point_3D { | 51 | struct point_3D { |
28 | long x, y, z; | 52 | long x, y, z; |
29 | }; | 53 | }; |
@@ -230,6 +254,8 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
230 | int t_disp=0; | 254 | int t_disp=0; |
231 | char buffer[30]; | 255 | char buffer[30]; |
232 | 256 | ||
257 | int button; | ||
258 | int lastbutton=0; | ||
233 | int xa=0; | 259 | int xa=0; |
234 | int ya=0; | 260 | int ya=0; |
235 | int za=0; | 261 | int za=0; |
@@ -282,56 +308,64 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
282 | if (za<0) | 308 | if (za<0) |
283 | za+=360; | 309 | za+=360; |
284 | 310 | ||
285 | switch(rb->button_get(false)) | 311 | button = rb->button_get(false); |
312 | switch(button) | ||
286 | { | 313 | { |
287 | case BUTTON_RIGHT: | 314 | case CUBE_X_INC: |
288 | xs+=1; | 315 | xs+=1; |
289 | if (xs>10) | 316 | if (xs>10) |
290 | xs=10; | 317 | xs=10; |
291 | t_disp=DISP_TIME; | 318 | t_disp=DISP_TIME; |
292 | break; | 319 | break; |
293 | case BUTTON_LEFT: | 320 | case CUBE_X_DEC: |
294 | xs-=1; | 321 | xs-=1; |
295 | if (xs<-10) | 322 | if (xs<-10) |
296 | xs=-10; | 323 | xs=-10; |
297 | t_disp=DISP_TIME; | 324 | t_disp=DISP_TIME; |
298 | break; | 325 | break; |
299 | case BUTTON_UP: | 326 | case CUBE_Y_INC: |
300 | ys+=1; | 327 | ys+=1; |
301 | if (ys>10) | 328 | if (ys>10) |
302 | ys=10; | 329 | ys=10; |
303 | t_disp=DISP_TIME; | 330 | t_disp=DISP_TIME; |
304 | break; | 331 | break; |
305 | case BUTTON_DOWN: | 332 | case CUBE_Y_DEC: |
306 | ys-=1; | 333 | ys-=1; |
307 | if (ys<-10) | 334 | if (ys<-10) |
308 | ys=-10; | 335 | ys=-10; |
309 | t_disp=DISP_TIME; | 336 | t_disp=DISP_TIME; |
310 | break; | 337 | break; |
311 | case BUTTON_F2: | 338 | case CUBE_Z_INC: |
312 | zs+=1; | 339 | zs+=1; |
313 | if (zs>10) | 340 | if (zs>10) |
314 | zs=10; | 341 | zs=10; |
315 | t_disp=DISP_TIME; | 342 | t_disp=DISP_TIME; |
316 | break; | 343 | break; |
317 | case BUTTON_F1: | 344 | case CUBE_Z_DEC: |
318 | zs-=1; | 345 | zs-=1; |
319 | if (zs<-10) | 346 | if (zs<-10) |
320 | zs=-10; | 347 | zs=-10; |
321 | t_disp=DISP_TIME; | 348 | t_disp=DISP_TIME; |
322 | break; | 349 | break; |
323 | case BUTTON_PLAY: | 350 | case CUBE_HIGHSPEED: |
351 | #ifdef CUBE_HIGHSPEED_PRE | ||
352 | if (lastbutton!=CUBE_HIGHSPEED_PRE) | ||
353 | break; | ||
354 | #endif | ||
324 | highspeed=!highspeed; | 355 | highspeed=!highspeed; |
325 | t_disp=DISP_TIME; | 356 | t_disp=DISP_TIME; |
326 | break; | 357 | break; |
327 | case BUTTON_OFF|BUTTON_REL: | 358 | case CUBE_QUIT: |
328 | exit=1; | 359 | exit=1; |
329 | break; | 360 | break; |
330 | 361 | ||
331 | case SYS_USB_CONNECTED: | 362 | default: |
332 | rb->usb_screen(); | 363 | if(rb->default_event_handler(button) == SYS_USB_CONNECTED) |
333 | return PLUGIN_USB_CONNECTED; | 364 | return PLUGIN_USB_CONNECTED; |
365 | break; | ||
334 | } | 366 | } |
367 | if (button!=BUTTON_NONE) | ||
368 | lastbutton=button; | ||
335 | } | 369 | } |
336 | 370 | ||
337 | return PLUGIN_OK; | 371 | return PLUGIN_OK; |