1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2002 Itai Shaked
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 **************************************************************************/
22 #include "lib/playergfx.h"
23 #include "lib/mylcd.h"
24 #include "lib/pluginlib_actions.h"
27 #ifdef HAVE_LCD_BITMAP
28 #define GFX_X (LCD_WIDTH/2-1)
29 #define GFX_Y (LCD_HEIGHT/2-1)
30 #if LCD_WIDTH != LCD_HEIGHT
31 #define GFX_WIDTH GFX_X
32 #define GFX_HEIGHT GFX_Y
34 #define GFX_WIDTH GFX_X
35 #define GFX_HEIGHT (4*GFX_Y/5)
44 /* this set the context to use with PLA */
45 static const struct button_mapping
*plugin_contexts
[] = { pla_main_ctx
};
47 #define MOSAIQUE_QUIT PLA_EXIT
48 #define MOSAIQUE_QUIT2 PLA_CANCEL
49 #define MOSAIQUE_SPEED PLA_UP
50 #define MOSAIQUE_RESTART PLA_SELECT
52 enum plugin_status
plugin_start(const void* parameter
)
62 #ifdef HAVE_LCD_CHARCELLS
65 rb
->splash(HZ
*2, "Old LCD :(");
70 mylcd_clear_display();
71 mylcd_set_drawmode(DRMODE_COMPLEMENT
);
100 mylcd_fillrect(GFX_X
-x
, GFX_Y
-y
, 2*x
+1, 1);
101 mylcd_fillrect(GFX_X
-x
, GFX_Y
+y
, 2*x
+1, 1);
102 mylcd_fillrect(GFX_X
-x
, GFX_Y
-y
+1, 1, 2*y
-1);
103 mylcd_fillrect(GFX_X
+x
, GFX_Y
-y
+1, 1, 2*y
-1);
108 /*We get button from PLA this way */
109 button
= pluginlib_getaction(TIMEOUT_NOBLOCK
, plugin_contexts
,
110 ARRAYLEN(plugin_contexts
));
114 #ifdef MOSAIQUE_RC_QUIT
115 case MOSAIQUE_RC_QUIT
:
119 mylcd_set_drawmode(DRMODE_SOLID
);
120 #ifdef HAVE_LCD_CHARCELLS
131 case MOSAIQUE_RESTART
:
133 sx
= rb
->rand() % (GFX_HEIGHT
/2) + 1;
134 sy
= rb
->rand() % (GFX_HEIGHT
/2) + 1;
137 mylcd_clear_display();
142 if (rb
->default_event_handler(button
) == SYS_USB_CONNECTED
)
144 mylcd_set_drawmode(DRMODE_SOLID
);
145 #ifdef HAVE_LCD_CHARCELLS
148 return PLUGIN_USB_CONNECTED
;