summaryrefslogtreecommitdiff
path: root/apps/plugins/rockblox.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/rockblox.c')
-rw-r--r--apps/plugins/rockblox.c33
1 files changed, 3 insertions, 30 deletions
diff --git a/apps/plugins/rockblox.c b/apps/plugins/rockblox.c
index c7968c3e20..31c626e267 100644
--- a/apps/plugins/rockblox.c
+++ b/apps/plugins/rockblox.c
@@ -532,8 +532,6 @@
532 532
533#define BOARD_WIDTH 10 533#define BOARD_WIDTH 10
534 534
535#ifdef HAVE_LCD_BITMAP
536
537#define BOARD_HEIGHT 20 535#define BOARD_HEIGHT 20
538 536
539#if (LCD_WIDTH == 640) && (LCD_HEIGHT == 480) 537#if (LCD_WIDTH == 640) && (LCD_HEIGHT == 480)
@@ -757,6 +755,9 @@
757#define LEVEL_X 58 755#define LEVEL_X 58
758#define LINES_Y 62 756#define LINES_Y 62
759#define LINES_X 58 757#define LINES_X 58
758
759#else
760#error "lcd screen size not defined!"
760#endif 761#endif
761 762
762#ifndef LEVEL_X 763#ifndef LEVEL_X
@@ -769,10 +770,6 @@
769 770
770extern const fb_data rockblox_background[]; 771extern const fb_data rockblox_background[];
771 772
772#else
773#error "lcd screen size not defined!"
774#endif
775
776#ifndef HIGHSCORE_SPACE 773#ifndef HIGHSCORE_SPACE
777#define HIGHSCORE_SPACE " " 774#define HIGHSCORE_SPACE " "
778#endif 775#endif
@@ -974,7 +971,6 @@ static void init_board (void)
974/* show the score, level and lines */ 971/* show the score, level and lines */
975static void show_details (void) 972static void show_details (void)
976{ 973{
977#ifdef HAVE_LCD_BITMAP
978#if LCD_DEPTH >= 2 974#if LCD_DEPTH >= 2
979 rb->lcd_set_foreground (LCD_BLACK); 975 rb->lcd_set_foreground (LCD_BLACK);
980 rb->lcd_set_background (LCD_WHITE); 976 rb->lcd_set_background (LCD_WHITE);
@@ -982,7 +978,6 @@ static void show_details (void)
982 rb->lcd_putsxyf (LABEL_X, SCORE_Y, "%d", rockblox_status.score); 978 rb->lcd_putsxyf (LABEL_X, SCORE_Y, "%d", rockblox_status.score);
983 rb->lcd_putsxyf (LEVEL_X, LEVEL_Y, "%d", rockblox_status.level); 979 rb->lcd_putsxyf (LEVEL_X, LEVEL_Y, "%d", rockblox_status.level);
984 rb->lcd_putsxyf (LINES_X, LINES_Y, "%d", rockblox_status.lines); 980 rb->lcd_putsxyf (LINES_X, LINES_Y, "%d", rockblox_status.lines);
985#endif
986} 981}
987 982
988#ifdef HIGH_SCORE_Y 983#ifdef HIGH_SCORE_Y
@@ -1050,9 +1045,7 @@ static void init_rockblox (bool resume)
1050 tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, 1045 tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
1051 tm->tm_hour, tm->tm_min, tm->tm_sec); 1046 tm->tm_hour, tm->tm_min, tm->tm_sec);
1052 1047
1053#ifdef HAVE_LCD_BITMAP
1054 rb->lcd_bitmap (rockblox_background, 0, 0, LCD_WIDTH, LCD_HEIGHT); 1048 rb->lcd_bitmap (rockblox_background, 0, 0, LCD_WIDTH, LCD_HEIGHT);
1055#endif
1056 if (!resume) 1049 if (!resume)
1057 { 1050 {
1058 rockblox_status.level = 1; 1051 rockblox_status.level = 1;
@@ -1149,7 +1142,6 @@ static void refresh_board (void)
1149 for (j = 0; j < BOARD_HEIGHT; j++) { 1142 for (j = 0; j < BOARD_HEIGHT; j++) {
1150 block = rockblox_status.board[j][i]; 1143 block = rockblox_status.board[j][i];
1151 if (block != EMPTY_BLOCK) { 1144 if (block != EMPTY_BLOCK) {
1152#ifdef HAVE_LCD_BITMAP
1153#if LCD_DEPTH >= 2 1145#if LCD_DEPTH >= 2
1154 /* middle drawing */ 1146 /* middle drawing */
1155 rb->lcd_set_foreground (figures[block].color[1]); 1147 rb->lcd_set_foreground (figures[block].color[1]);
@@ -1177,7 +1169,6 @@ static void refresh_board (void)
1177 rb->lcd_hline (BOARD_X + i * BLOCK_WIDTH + 1, 1169 rb->lcd_hline (BOARD_X + i * BLOCK_WIDTH + 1,
1178 BOARD_X + (i + 1) * BLOCK_WIDTH - 1, 1170 BOARD_X + (i + 1) * BLOCK_WIDTH - 1,
1179 BOARD_Y + (j + 1) * BLOCK_HEIGHT - 1); 1171 BOARD_Y + (j + 1) * BLOCK_HEIGHT - 1);
1180#endif
1181 } 1172 }
1182 } 1173 }
1183 1174
@@ -1194,7 +1185,6 @@ static void refresh_board (void)
1194 + rockblox_status.cx; 1185 + rockblox_status.cx;
1195 y = getRelativeY (rockblox_status.cf, i, rockblox_status.co) 1186 y = getRelativeY (rockblox_status.cf, i, rockblox_status.co)
1196 + ghost_y; 1187 + ghost_y;
1197#ifdef HAVE_LCD_BITMAP
1198#if LCD_DEPTH >= 2 1188#if LCD_DEPTH >= 2
1199 /* middle drawing */ 1189 /* middle drawing */
1200 rb->lcd_set_foreground (ghost_colors[rockblox_status.cf][0]); 1190 rb->lcd_set_foreground (ghost_colors[rockblox_status.cf][0]);
@@ -1221,7 +1211,6 @@ static void refresh_board (void)
1221 rb->lcd_hline (BOARD_X + x * BLOCK_WIDTH + 1, 1211 rb->lcd_hline (BOARD_X + x * BLOCK_WIDTH + 1,
1222 BOARD_X + (x + 1) * BLOCK_WIDTH - 1, 1212 BOARD_X + (x + 1) * BLOCK_WIDTH - 1,
1223 BOARD_Y + (y + 1) * BLOCK_HEIGHT - 1); 1213 BOARD_Y + (y + 1) * BLOCK_HEIGHT - 1);
1224#endif
1225 } 1214 }
1226 1215
1227 /* draw current piece */ 1216 /* draw current piece */
@@ -1231,7 +1220,6 @@ static void refresh_board (void)
1231 + rockblox_status.cx; 1220 + rockblox_status.cx;
1232 y = getRelativeY (rockblox_status.cf, i, rockblox_status.co) 1221 y = getRelativeY (rockblox_status.cf, i, rockblox_status.co)
1233 + rockblox_status.cy; 1222 + rockblox_status.cy;
1234#ifdef HAVE_LCD_BITMAP
1235#if LCD_DEPTH >= 2 1223#if LCD_DEPTH >= 2
1236 /* middle drawing */ 1224 /* middle drawing */
1237 rb->lcd_set_foreground (figures[rockblox_status.cf].color[1]); 1225 rb->lcd_set_foreground (figures[rockblox_status.cf].color[1]);
@@ -1258,7 +1246,6 @@ static void refresh_board (void)
1258 rb->lcd_hline (BOARD_X + x * BLOCK_WIDTH + 1, 1246 rb->lcd_hline (BOARD_X + x * BLOCK_WIDTH + 1,
1259 BOARD_X + (x + 1) * BLOCK_WIDTH - 1, 1247 BOARD_X + (x + 1) * BLOCK_WIDTH - 1,
1260 BOARD_Y + (y + 1) * BLOCK_HEIGHT - 1); 1248 BOARD_Y + (y + 1) * BLOCK_HEIGHT - 1);
1261#endif
1262 } 1249 }
1263 1250
1264 mylcd_update (); 1251 mylcd_update ();
@@ -1301,7 +1288,6 @@ static void draw_next_block (void)
1301 for (i = 0; i < 4; i++) { 1288 for (i = 0; i < 4; i++) {
1302 rx = getRelativeX (rockblox_status.nf, i, 0) + 2; 1289 rx = getRelativeX (rockblox_status.nf, i, 0) + 2;
1303 ry = getRelativeY (rockblox_status.nf, i, 0) + 2; 1290 ry = getRelativeY (rockblox_status.nf, i, 0) + 2;
1304#ifdef HAVE_LCD_BITMAP
1305#if LCD_DEPTH >= 2 1291#if LCD_DEPTH >= 2
1306 rb->lcd_set_foreground (figures[rockblox_status.nf].color[1]); /* middle drawing */ 1292 rb->lcd_set_foreground (figures[rockblox_status.nf].color[1]); /* middle drawing */
1307#endif 1293#endif
@@ -1326,7 +1312,6 @@ static void draw_next_block (void)
1326 rb->lcd_hline (PREVIEW_X + rx * BLOCK_WIDTH + 1, 1312 rb->lcd_hline (PREVIEW_X + rx * BLOCK_WIDTH + 1,
1327 PREVIEW_X + (rx + 1) * BLOCK_WIDTH - 1, 1313 PREVIEW_X + (rx + 1) * BLOCK_WIDTH - 1,
1328 PREVIEW_Y + (ry + 1) * BLOCK_HEIGHT - 1); 1314 PREVIEW_Y + (ry + 1) * BLOCK_HEIGHT - 1);
1329#endif
1330 } 1315 }
1331 1316
1332} 1317}
@@ -1428,18 +1413,14 @@ static bool rockblox_help(void)
1428 LAST_STYLE_ITEM 1413 LAST_STYLE_ITEM
1429 }; 1414 };
1430 1415
1431#ifdef HAVE_LCD_BITMAP
1432 rb->lcd_setfont(FONT_UI); 1416 rb->lcd_setfont(FONT_UI);
1433#endif
1434#ifdef HAVE_LCD_COLOR 1417#ifdef HAVE_LCD_COLOR
1435 rb->lcd_set_background(LCD_BLACK); 1418 rb->lcd_set_background(LCD_BLACK);
1436 rb->lcd_set_foreground(LCD_WHITE); 1419 rb->lcd_set_foreground(LCD_WHITE);
1437#endif 1420#endif
1438 if (display_text(ARRAYLEN(help_text), help_text, formation, NULL, true)) 1421 if (display_text(ARRAYLEN(help_text), help_text, formation, NULL, true))
1439 return true; 1422 return true;
1440#ifdef HAVE_LCD_BITMAP
1441 rb->lcd_setfont(FONT_SYSFIXED); 1423 rb->lcd_setfont(FONT_SYSFIXED);
1442#endif
1443 1424
1444 return false; 1425 return false;
1445} 1426}
@@ -1699,15 +1680,7 @@ enum plugin_status plugin_start (const void *parameter)
1699 rb->lcd_set_backdrop(NULL); 1680 rb->lcd_set_backdrop(NULL);
1700#endif 1681#endif
1701 1682
1702#ifdef HAVE_LCD_BITMAP
1703 rb->lcd_setfont (FONT_SYSFIXED); 1683 rb->lcd_setfont (FONT_SYSFIXED);
1704#else
1705 if (!pgfx_init(4, 2))
1706 {
1707 rb->splash(HZ*2, "Old LCD :(");
1708 return PLUGIN_OK;
1709 }
1710#endif
1711 1684
1712 /* Turn off backlight timeout */ 1685 /* Turn off backlight timeout */
1713 backlight_ignore_timeout(); 1686 backlight_ignore_timeout();