diff options
Diffstat (limited to 'apps/plugins/mosaique.c')
-rw-r--r-- | apps/plugins/mosaique.c | 44 |
1 files changed, 15 insertions, 29 deletions
diff --git a/apps/plugins/mosaique.c b/apps/plugins/mosaique.c index 87ff3a4fdc..75bd155338 100644 --- a/apps/plugins/mosaique.c +++ b/apps/plugins/mosaique.c | |||
@@ -22,9 +22,11 @@ | |||
22 | #ifdef HAVE_LCD_BITMAP | 22 | #ifdef HAVE_LCD_BITMAP |
23 | #define LARGE ((LCD_WIDTH - 2) / 2) | 23 | #define LARGE ((LCD_WIDTH - 2) / 2) |
24 | #define HAUT ((LCD_HEIGHT - 2) / 2) | 24 | #define HAUT ((LCD_HEIGHT - 2) / 2) |
25 | #define MYLCD(fn) rb->lcd_ ## fn | ||
25 | #else | 26 | #else |
26 | #define LARGE 9 | 27 | #define LARGE 9 |
27 | #define HAUT 6 | 28 | #define HAUT 6 |
29 | #define MYLCD(fn) pgfx_ ## fn | ||
28 | #endif | 30 | #endif |
29 | 31 | ||
30 | /* variable button definitions */ | 32 | /* variable button definitions */ |
@@ -62,18 +64,16 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
62 | TEST_PLUGIN_API(api); | 64 | TEST_PLUGIN_API(api); |
63 | (void)parameter; | 65 | (void)parameter; |
64 | 66 | ||
65 | #ifdef HAVE_LCD_BITMAP | 67 | #ifdef HAVE_LCD_CHARCELLS |
66 | rb->lcd_clear_display(); | ||
67 | rb->lcd_set_drawmode(DRMODE_COMPLEMENT); | ||
68 | #else | ||
69 | if (!pgfx_init(rb, 4, 2)) | 68 | if (!pgfx_init(rb, 4, 2)) |
70 | { | 69 | { |
71 | rb->splash(HZ*2, true, "Old LCD :("); | 70 | rb->splash(HZ*2, true, "Old LCD :("); |
72 | return PLUGIN_OK; | 71 | return PLUGIN_OK; |
73 | } | 72 | } |
74 | pgfx_display(3, 0); | 73 | pgfx_display(3, 0); |
75 | pgfx_clear_display(); | ||
76 | #endif | 74 | #endif |
75 | MYLCD(clear_display)(); | ||
76 | MYLCD(set_drawmode)(DRMODE_COMPLEMENT); | ||
77 | while (1) { | 77 | while (1) { |
78 | 78 | ||
79 | x+=sx; | 79 | x+=sx; |
@@ -102,19 +102,11 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
102 | sy = -sy; | 102 | sy = -sy; |
103 | } | 103 | } |
104 | 104 | ||
105 | #ifdef HAVE_LCD_BITMAP | 105 | MYLCD(fillrect)(LARGE-x, HAUT-y, 2*x+1, 1); |
106 | rb->lcd_fillrect(LARGE-x, HAUT-y, 2*x+1, 1); | 106 | MYLCD(fillrect)(LARGE-x, HAUT+y, 2*x+1, 1); |
107 | rb->lcd_fillrect(LARGE-x, HAUT+y, 2*x+1, 1); | 107 | MYLCD(fillrect)(LARGE-x, HAUT-y+1, 1, 2*y-1); |
108 | rb->lcd_fillrect(LARGE-x, HAUT-y+1, 1, 2*y-1); | 108 | MYLCD(fillrect)(LARGE+x, HAUT-y+1, 1, 2*y-1); |
109 | rb->lcd_fillrect(LARGE+x, HAUT-y+1, 1, 2*y-1); | 109 | MYLCD(update)(); |
110 | rb->lcd_update(); | ||
111 | #else | ||
112 | pgfx_invertrect(LARGE-x, HAUT-y, 2*x+1, 1); | ||
113 | pgfx_invertrect(LARGE-x, HAUT+y, 2*x+1, 1); | ||
114 | pgfx_invertrect(LARGE-x, HAUT-y+1, 1, 2*y-1); | ||
115 | pgfx_invertrect(LARGE+x, HAUT-y+1, 1, 2*y-1); | ||
116 | pgfx_update(); | ||
117 | #endif | ||
118 | 110 | ||
119 | rb->sleep(HZ/timer); | 111 | rb->sleep(HZ/timer); |
120 | 112 | ||
@@ -122,9 +114,8 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
122 | switch (button) | 114 | switch (button) |
123 | { | 115 | { |
124 | case MOSAIQUE_QUIT: | 116 | case MOSAIQUE_QUIT: |
125 | #ifdef HAVE_LCD_BITMAP | 117 | MYLCD(set_drawmode)(DRMODE_SOLID); |
126 | rb->lcd_set_drawmode(DRMODE_SOLID); | 118 | #ifdef HAVE_LCD_CHARCELLS |
127 | #else | ||
128 | pgfx_release(); | 119 | pgfx_release(); |
129 | #endif | 120 | #endif |
130 | return PLUGIN_OK; | 121 | return PLUGIN_OK; |
@@ -141,20 +132,15 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
141 | sy = rb->rand() % (HAUT/2) + 1; | 132 | sy = rb->rand() % (HAUT/2) + 1; |
142 | x=0; | 133 | x=0; |
143 | y=0; | 134 | y=0; |
144 | #ifdef HAVE_LCD_BITMAP | 135 | MYLCD(clear_display)(); |
145 | rb->lcd_clear_display(); | ||
146 | #else | ||
147 | pgfx_clear_display(); | ||
148 | #endif | ||
149 | break; | 136 | break; |
150 | 137 | ||
151 | 138 | ||
152 | default: | 139 | default: |
153 | if (rb->default_event_handler(button) == SYS_USB_CONNECTED) | 140 | if (rb->default_event_handler(button) == SYS_USB_CONNECTED) |
154 | { | 141 | { |
155 | #ifdef HAVE_LCD_BITMAP | 142 | MYLCD(set_drawmode)(DRMODE_SOLID); |
156 | rb->lcd_set_drawmode(DRMODE_SOLID); | 143 | #ifdef HAVE_LCD_CHARCELLS |
157 | #else | ||
158 | pgfx_release(); | 144 | pgfx_release(); |
159 | #endif | 145 | #endif |
160 | return PLUGIN_USB_CONNECTED; | 146 | return PLUGIN_USB_CONNECTED; |