diff options
Diffstat (limited to 'apps/plugins')
-rw-r--r-- | apps/plugins/bounce.c | 13 | ||||
-rw-r--r-- | apps/plugins/cube.c | 16 | ||||
-rw-r--r-- | apps/plugins/lib/gray.h | 10 | ||||
-rw-r--r-- | apps/plugins/lib/gray_parm.c | 10 | ||||
-rw-r--r-- | apps/plugins/minesweeper.c | 14 | ||||
-rw-r--r-- | apps/plugins/sokoban.c | 6 | ||||
-rw-r--r-- | apps/plugins/solitaire.c | 8 | ||||
-rw-r--r-- | apps/plugins/sudoku.c | 10 |
8 files changed, 31 insertions, 56 deletions
diff --git a/apps/plugins/bounce.c b/apps/plugins/bounce.c index 3ff3a8d5f6..1bf8b3b34d 100644 --- a/apps/plugins/bounce.c +++ b/apps/plugins/bounce.c | |||
@@ -282,17 +282,14 @@ static void addclock(void) | |||
282 | #define DRAW_WIDTH (LCD_WIDTH + LETTER_WIDTH*2) | 282 | #define DRAW_WIDTH (LCD_WIDTH + LETTER_WIDTH*2) |
283 | 283 | ||
284 | #if LCD_DEPTH > 1 | 284 | #if LCD_DEPTH > 1 |
285 | #ifdef HAVE_LCD_COLOR | 285 | static const unsigned face_colors[] = |
286 | static const struct rgb face_colors[] = | ||
287 | { | 286 | { |
288 | LCD_BLACK, {0, 0, LCD_MAX_BLUE}, {LCD_MAX_RED, 0, 0} | 287 | #ifdef HAVE_LCD_COLOR |
289 | }; | 288 | LCD_BLACK, LCD_RGBPACK(0, 0, 255), LCD_RGBPACK(255, 0, 0) |
290 | #else | 289 | #else |
291 | static const int face_colors[] = | 290 | LCD_BLACK, LCD_LIGHTGRAY, LCD_DARKGRAY |
292 | { | ||
293 | 0, 2*LCD_MAX_LEVEL/3, LCD_MAX_LEVEL/3 | ||
294 | }; | ||
295 | #endif | 291 | #endif |
292 | }; | ||
296 | #endif | 293 | #endif |
297 | 294 | ||
298 | static int scrollit(void) | 295 | static int scrollit(void) |
diff --git a/apps/plugins/cube.c b/apps/plugins/cube.c index 2360269aba..dc5b5706f4 100644 --- a/apps/plugins/cube.c +++ b/apps/plugins/cube.c | |||
@@ -152,18 +152,16 @@ static const struct face faces[6] = | |||
152 | }; | 152 | }; |
153 | 153 | ||
154 | #if LCD_DEPTH > 1 | 154 | #if LCD_DEPTH > 1 |
155 | #ifdef HAVE_LCD_COLOR | 155 | static const unsigned face_colors[6] = |
156 | static const struct rgb face_colors[6] = | ||
157 | { | 156 | { |
158 | {LCD_MAX_RED, 0, 0}, {LCD_MAX_RED, 0, 0}, {0, LCD_MAX_GREEN, 0}, | 157 | #ifdef HAVE_LCD_COLOR |
159 | {0, LCD_MAX_GREEN, 0}, {0, 0, LCD_MAX_BLUE}, {0, 0, LCD_MAX_BLUE} | 158 | LCD_RGBPACK(255, 0, 0), LCD_RGBPACK(255, 0, 0), LCD_RGBPACK(0, 255, 0), |
160 | }; | 159 | LCD_RGBPACK(0, 255, 0), LCD_RGBPACK(0, 0, 255), LCD_RGBPACK(0, 0, 255) |
161 | #else | 160 | #else |
162 | static const int face_colors[6] = | 161 | LCD_LIGHTGRAY, LCD_LIGHTGRAY, LCD_DARKGRAY, |
163 | { | 162 | LCD_DARKGRAY, LCD_BLACK, LCD_BLACK |
164 | 2*LCD_MAX_LEVEL/3, 2*LCD_MAX_LEVEL/3, LCD_MAX_LEVEL/3, LCD_MAX_LEVEL/3, 0, 0 | ||
165 | }; | ||
166 | #endif | 163 | #endif |
164 | }; | ||
167 | #endif | 165 | #endif |
168 | 166 | ||
169 | enum { | 167 | enum { |
diff --git a/apps/plugins/lib/gray.h b/apps/plugins/lib/gray.h index dadac9298f..f82cf389c3 100644 --- a/apps/plugins/lib/gray.h +++ b/apps/plugins/lib/gray.h | |||
@@ -51,11 +51,11 @@ void gray_update_rect(int x, int y, int width, int height); | |||
51 | void gray_set_position(int x, int by); | 51 | void gray_set_position(int x, int by); |
52 | void gray_set_drawmode(int mode); | 52 | void gray_set_drawmode(int mode); |
53 | int gray_get_drawmode(void); | 53 | int gray_get_drawmode(void); |
54 | void gray_set_foreground(int brightness); | 54 | void gray_set_foreground(unsigned brightness); |
55 | int gray_get_foreground(void); | 55 | unsigned gray_get_foreground(void); |
56 | void gray_set_background(int brightness); | 56 | void gray_set_background(unsigned brightness); |
57 | int gray_get_background(void); | 57 | unsigned gray_get_background(void); |
58 | void gray_set_drawinfo(int mode, int fg_brightness, int bg_brightness); | 58 | void gray_set_drawinfo(int mode, unsigned fg_brightness, unsigned bg_brightness); |
59 | void gray_setfont(int newfont); | 59 | void gray_setfont(int newfont); |
60 | int gray_getstringsize(const unsigned char *str, int *w, int *h); | 60 | int gray_getstringsize(const unsigned char *str, int *w, int *h); |
61 | 61 | ||
diff --git a/apps/plugins/lib/gray_parm.c b/apps/plugins/lib/gray_parm.c index a8c238a4eb..c4ee92f9cc 100644 --- a/apps/plugins/lib/gray_parm.c +++ b/apps/plugins/lib/gray_parm.c | |||
@@ -53,7 +53,7 @@ int gray_get_drawmode(void) | |||
53 | } | 53 | } |
54 | 54 | ||
55 | /* Set the foreground shade for subsequent drawing operations */ | 55 | /* Set the foreground shade for subsequent drawing operations */ |
56 | void gray_set_foreground(int brightness) | 56 | void gray_set_foreground(unsigned brightness) |
57 | { | 57 | { |
58 | unsigned data = MULU16(_gray_info.depth, brightness & 0xFF) + 127; | 58 | unsigned data = MULU16(_gray_info.depth, brightness & 0xFF) + 127; |
59 | 59 | ||
@@ -61,14 +61,14 @@ void gray_set_foreground(int brightness) | |||
61 | } | 61 | } |
62 | 62 | ||
63 | /* Return the current foreground shade */ | 63 | /* Return the current foreground shade */ |
64 | int gray_get_foreground(void) | 64 | unsigned gray_get_foreground(void) |
65 | { | 65 | { |
66 | return (_gray_info.fg_brightness * 255 + (_gray_info.depth >> 1)) | 66 | return (_gray_info.fg_brightness * 255 + (_gray_info.depth >> 1)) |
67 | / _gray_info.depth; | 67 | / _gray_info.depth; |
68 | } | 68 | } |
69 | 69 | ||
70 | /* Set the background shade for subsequent drawing operations */ | 70 | /* Set the background shade for subsequent drawing operations */ |
71 | void gray_set_background(int brightness) | 71 | void gray_set_background(unsigned brightness) |
72 | { | 72 | { |
73 | unsigned data = MULU16(_gray_info.depth, brightness & 0xFF) + 127; | 73 | unsigned data = MULU16(_gray_info.depth, brightness & 0xFF) + 127; |
74 | 74 | ||
@@ -76,14 +76,14 @@ void gray_set_background(int brightness) | |||
76 | } | 76 | } |
77 | 77 | ||
78 | /* Return the current background shade */ | 78 | /* Return the current background shade */ |
79 | int gray_get_background(void) | 79 | unsigned gray_get_background(void) |
80 | { | 80 | { |
81 | return (_gray_info.bg_brightness * 255 + (_gray_info.depth >> 1)) | 81 | return (_gray_info.bg_brightness * 255 + (_gray_info.depth >> 1)) |
82 | / _gray_info.depth; | 82 | / _gray_info.depth; |
83 | } | 83 | } |
84 | 84 | ||
85 | /* Set draw mode, foreground and background shades at once */ | 85 | /* Set draw mode, foreground and background shades at once */ |
86 | void gray_set_drawinfo(int mode, int fg_brightness, int bg_brightness) | 86 | void gray_set_drawinfo(int mode, unsigned fg_brightness, unsigned bg_brightness) |
87 | { | 87 | { |
88 | gray_set_drawmode(mode); | 88 | gray_set_drawmode(mode); |
89 | gray_set_foreground(fg_brightness); | 89 | gray_set_foreground(fg_brightness); |
diff --git a/apps/plugins/minesweeper.c b/apps/plugins/minesweeper.c index 097c1b0c43..4af467b516 100644 --- a/apps/plugins/minesweeper.c +++ b/apps/plugins/minesweeper.c | |||
@@ -67,16 +67,6 @@ use F3 to see how many mines are left (supposing all your flags are correct) | |||
67 | 67 | ||
68 | #endif | 68 | #endif |
69 | 69 | ||
70 | #if LCD_DEPTH > 1 | ||
71 | #if HAVE_LCD_COLOR | ||
72 | #define LIGHT_GRAY ((struct rgb){2*LCD_MAX_RED/3, 2*LCD_MAX_GREEN/3, 2*LCD_MAX_BLUE/3}) | ||
73 | #define DARK_GRAY ((struct rgb){LCD_MAX_RED/3, LCD_MAX_GREEN/3, LCD_MAX_BLUE/3}) | ||
74 | #else | ||
75 | #define LIGHT_GRAY (2*LCD_MAX_LEVEL/3) | ||
76 | #define DARK_GRAY (LCD_MAX_LEVEL/3) | ||
77 | #endif | ||
78 | #endif | ||
79 | |||
80 | /* here is a global api struct pointer. while not strictly necessary, | 70 | /* here is a global api struct pointer. while not strictly necessary, |
81 | it's nice not to have to pass the api pointer in all function calls | 71 | it's nice not to have to pass the api pointer in all function calls |
82 | in the plugin */ | 72 | in the plugin */ |
@@ -385,7 +375,7 @@ int minesweeper(void) | |||
385 | for(i=0;i<height;i++){ | 375 | for(i=0;i<height;i++){ |
386 | for(j=0;j<width;j++){ | 376 | for(j=0;j<width;j++){ |
387 | #if LCD_DEPTH > 1 | 377 | #if LCD_DEPTH > 1 |
388 | rb->lcd_set_foreground(DARK_GRAY); | 378 | rb->lcd_set_foreground(LCD_DARKGRAY); |
389 | rb->lcd_drawrect(j*8,i*8,8,8); | 379 | rb->lcd_drawrect(j*8,i*8,8,8); |
390 | rb->lcd_set_foreground(LCD_BLACK); | 380 | rb->lcd_set_foreground(LCD_BLACK); |
391 | #else | 381 | #else |
@@ -404,7 +394,7 @@ int minesweeper(void) | |||
404 | rb->lcd_drawline(j*8+2,i*8+5,j*8+5,i*8+2); | 394 | rb->lcd_drawline(j*8+2,i*8+5,j*8+5,i*8+2); |
405 | } else { | 395 | } else { |
406 | #if LCD_DEPTH > 1 | 396 | #if LCD_DEPTH > 1 |
407 | rb->lcd_set_foreground(LIGHT_GRAY); | 397 | rb->lcd_set_foreground(LCD_LIGHTGRAY); |
408 | rb->lcd_fillrect(j*8+1,i*8+1,6,6); | 398 | rb->lcd_fillrect(j*8+1,i*8+1,6,6); |
409 | rb->lcd_set_foreground(LCD_BLACK); | 399 | rb->lcd_set_foreground(LCD_BLACK); |
410 | #else | 400 | #else |
diff --git a/apps/plugins/sokoban.c b/apps/plugins/sokoban.c index 70f616d406..a341cf5416 100644 --- a/apps/plugins/sokoban.c +++ b/apps/plugins/sokoban.c | |||
@@ -59,10 +59,10 @@ | |||
59 | #endif | 59 | #endif |
60 | 60 | ||
61 | #if LCD_DEPTH > 1 | 61 | #if LCD_DEPTH > 1 |
62 | #if HAVE_LCD_COLOR | 62 | #ifdef HAVE_LCD_COLOR |
63 | #define MEDIUM_GRAY ((struct rgb){LCD_MAX_RED/2, LCD_MAX_GREEN/2, LCD_MAX_BLUE/2}) | 63 | #define MEDIUM_GRAY LCD_RGBPACK(127, 127, 127) |
64 | #else | 64 | #else |
65 | #define MEDIUM_GRAY (LCD_MAX_LEVEL/2) | 65 | #define MEDIUM_GRAY LCD_BRIGHTNESS(127) |
66 | #endif | 66 | #endif |
67 | #endif | 67 | #endif |
68 | 68 | ||
diff --git a/apps/plugins/solitaire.c b/apps/plugins/solitaire.c index b2af0828e2..30405a582f 100644 --- a/apps/plugins/solitaire.c +++ b/apps/plugins/solitaire.c | |||
@@ -135,13 +135,13 @@ static struct plugin_api* rb; | |||
135 | #endif | 135 | #endif |
136 | 136 | ||
137 | #if LCD_DEPTH>1 | 137 | #if LCD_DEPTH>1 |
138 | static const unsigned colors[4] = { | ||
138 | #ifdef HAVE_LCD_COLOR | 139 | #ifdef HAVE_LCD_COLOR |
139 | static const unsigned struct rgb colors[4] = { | 140 | LCD_BLACK, LCD_RGBPACK(255, 0, 0), LCD_BLACK, LCD_RGBPACK(255, 0, 0) |
140 | { 0, 0, 0 }, { LCD_MAX_RED, 0, 0 }, { 0, 0, 0 }, { LCD_MAX_RED, 0, 0 } | ||
141 | }; | ||
142 | #else | 141 | #else |
143 | static const int colors[4] = { LCD_BLACK, LCD_MAX_LEVEL/2, LCD_BLACK, LCD_MAX_LEVEL/2 }; | 142 | LCD_BLACK, LCD_BRIGHTNESS(127), LCD_BLACK, LCD_BRIGHTNESS(127) |
144 | #endif | 143 | #endif |
144 | }; | ||
145 | #endif | 145 | #endif |
146 | 146 | ||
147 | static const unsigned char suits[4][8] = { | 147 | static const unsigned char suits[4][8] = { |
diff --git a/apps/plugins/sudoku.c b/apps/plugins/sudoku.c index 526416d11e..bab53bbad4 100644 --- a/apps/plugins/sudoku.c +++ b/apps/plugins/sudoku.c | |||
@@ -362,16 +362,6 @@ static unsigned char num_inverse[10][8]= { | |||
362 | #error SUDOKU: Unsupported LCD size | 362 | #error SUDOKU: Unsupported LCD size |
363 | #endif | 363 | #endif |
364 | 364 | ||
365 | #if LCD_DEPTH > 1 | ||
366 | #if HAVE_LCD_COLOR | ||
367 | #define LIGHT_GRAY ((struct rgb){2*LCD_MAX_RED/3, 2*LCD_MAX_GREEN/3, 2*LCD_MAX_BLUE/3}) | ||
368 | #define DARK_GRAY ((struct rgb){LCD_MAX_RED/3, LCD_MAX_GREEN/3, LCD_MAX_BLUE/3}) | ||
369 | #else | ||
370 | #define LIGHT_GRAY (2*LCD_MAX_LEVEL/3) | ||
371 | #define DARK_GRAY (LCD_MAX_LEVEL/3) | ||
372 | #endif | ||
373 | #endif | ||
374 | |||
375 | /* here is a global api struct pointer. while not strictly necessary, | 365 | /* here is a global api struct pointer. while not strictly necessary, |
376 | it's nice not to have to pass the api pointer in all function calls | 366 | it's nice not to have to pass the api pointer in all function calls |
377 | in the plugin */ | 367 | in the plugin */ |