summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/plugins/mosaique.c37
1 files changed, 23 insertions, 14 deletions
diff --git a/apps/plugins/mosaique.c b/apps/plugins/mosaique.c
index 08cbaef0bd..b951fdc8b3 100644
--- a/apps/plugins/mosaique.c
+++ b/apps/plugins/mosaique.c
@@ -22,13 +22,22 @@
22PLUGIN_HEADER 22PLUGIN_HEADER
23 23
24#ifdef HAVE_LCD_BITMAP 24#ifdef HAVE_LCD_BITMAP
25#define LARGE ((LCD_WIDTH - 2) / 2)
26#define HAUT ((LCD_HEIGHT - 2) / 2)
27#define MYLCD(fn) rb->lcd_ ## fn 25#define MYLCD(fn) rb->lcd_ ## fn
26#define GFX_X (LCD_WIDTH/2-1)
27#define GFX_Y (LCD_HEIGHT/2-1)
28#if LCD_WIDTH != LCD_HEIGHT
29#define GFX_WIDTH GFX_X
30#define GFX_HEIGHT GFX_Y
31#else
32#define GFX_WIDTH GFX_X
33#define GFX_HEIGHT (4*GFX_Y/5)
34#endif
28#else 35#else
29#define LARGE 9
30#define HAUT 6
31#define MYLCD(fn) pgfx_ ## fn 36#define MYLCD(fn) pgfx_ ## fn
37#define GFX_X 9
38#define GFX_Y 6
39#define GFX_WIDTH 9
40#define GFX_HEIGHT 6
32#endif 41#endif
33 42
34/* variable button definitions */ 43/* variable button definitions */
@@ -107,9 +116,9 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
107 while (1) { 116 while (1) {
108 117
109 x+=sx; 118 x+=sx;
110 if (x>LARGE) 119 if (x>GFX_WIDTH)
111 { 120 {
112 x = 2*LARGE-x; 121 x = 2*GFX_WIDTH-x;
113 sx=-sx; 122 sx=-sx;
114 } 123 }
115 124
@@ -120,9 +129,9 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
120 } 129 }
121 130
122 y+=sy; 131 y+=sy;
123 if (y>HAUT) 132 if (y>GFX_HEIGHT)
124 { 133 {
125 y = 2*HAUT-y; 134 y = 2*GFX_HEIGHT-y;
126 sy=-sy; 135 sy=-sy;
127 } 136 }
128 137
@@ -132,10 +141,10 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
132 sy = -sy; 141 sy = -sy;
133 } 142 }
134 143
135 MYLCD(fillrect)(LARGE-x, HAUT-y, 2*x+1, 1); 144 MYLCD(fillrect)(GFX_X-x, GFX_Y-y, 2*x+1, 1);
136 MYLCD(fillrect)(LARGE-x, HAUT+y, 2*x+1, 1); 145 MYLCD(fillrect)(GFX_X-x, GFX_Y+y, 2*x+1, 1);
137 MYLCD(fillrect)(LARGE-x, HAUT-y+1, 1, 2*y-1); 146 MYLCD(fillrect)(GFX_X-x, GFX_Y-y+1, 1, 2*y-1);
138 MYLCD(fillrect)(LARGE+x, HAUT-y+1, 1, 2*y-1); 147 MYLCD(fillrect)(GFX_X+x, GFX_Y-y+1, 1, 2*y-1);
139 MYLCD(update)(); 148 MYLCD(update)();
140 149
141 rb->sleep(HZ/timer); 150 rb->sleep(HZ/timer);
@@ -161,8 +170,8 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
161 170
162 case MOSAIQUE_RESTART: 171 case MOSAIQUE_RESTART:
163 172
164 sx = rb->rand() % (HAUT/2) + 1; 173 sx = rb->rand() % (GFX_HEIGHT/2) + 1;
165 sy = rb->rand() % (HAUT/2) + 1; 174 sy = rb->rand() % (GFX_HEIGHT/2) + 1;
166 x=0; 175 x=0;
167 y=0; 176 y=0;
168 MYLCD(clear_display)(); 177 MYLCD(clear_display)();