diff options
author | Rafaël Carré <funman@videolan.org> | 2013-02-18 08:22:04 +0100 |
---|---|---|
committer | Rafaël Carré <funman@videolan.org> | 2013-02-18 08:22:27 +0100 |
commit | fda2ce63f01825798bcd2980807ab7c306d32cc5 (patch) | |
tree | 8517eab569abc1e26fc39dde45a892fc005ea6c2 | |
parent | 66acb3996dcb1d22c7ddcc22a1d2d5d7281c2d9e (diff) | |
download | rockbox-fda2ce63f01825798bcd2980807ab7c306d32cc5.tar.gz rockbox-fda2ce63f01825798bcd2980807ab7c306d32cc5.zip |
blackjack: adapt to narrow clip zip screen
Change-Id: I5d45d202bc63c7cf36cfb97c98579e83a4720fbf
-rw-r--r-- | apps/plugins/blackjack.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/apps/plugins/blackjack.c b/apps/plugins/blackjack.c index 37ba083580..db78cb54bc 100644 --- a/apps/plugins/blackjack.c +++ b/apps/plugins/blackjack.c | |||
@@ -636,7 +636,7 @@ static void blackjack_drawtable(struct game_context* bj) { | |||
636 | unsigned int w, h, y_loc; | 636 | unsigned int w, h, y_loc; |
637 | char str[10]; | 637 | char str[10]; |
638 | 638 | ||
639 | #if LCD_HEIGHT <= 64 | 639 | #if LCD_HEIGHT <= 64 || LCD_WIDTH <= 96 |
640 | rb->lcd_getstringsize("Bet", &w, &h); | 640 | rb->lcd_getstringsize("Bet", &w, &h); |
641 | rb->lcd_putsxy(LCD_WIDTH - w, 2*h + 1, "Bet"); | 641 | rb->lcd_putsxy(LCD_WIDTH - w, 2*h + 1, "Bet"); |
642 | rb->snprintf(str, 9, "$%d", bj->current_bet); | 642 | rb->snprintf(str, 9, "$%d", bj->current_bet); |
@@ -808,7 +808,7 @@ static void update_total(struct game_context* bj) { | |||
808 | unsigned int w, h; | 808 | unsigned int w, h; |
809 | rb->snprintf(total, 3, "%d", bj->player_total); | 809 | rb->snprintf(total, 3, "%d", bj->player_total); |
810 | rb->lcd_getstringsize(total, &w, &h); | 810 | rb->lcd_getstringsize(total, &w, &h); |
811 | #if LCD_HEIGHT > 64 | 811 | #if LCD_HEIGHT > 64 && LCD_WIDTH > 96 |
812 | h *= 2; | 812 | h *= 2; |
813 | #endif | 813 | #endif |
814 | rb->lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 + h, total); | 814 | rb->lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 + h, total); |
@@ -918,7 +918,7 @@ static void finish_game(struct game_context* bj) { | |||
918 | } | 918 | } |
919 | rb->lcd_getstringsize(str, &w, &h); | 919 | rb->lcd_getstringsize(str, &w, &h); |
920 | 920 | ||
921 | #if LCD_HEIGHT <= 64 | 921 | #if LCD_HEIGHT <= 64 || LCD_WIDTH <= 96 |
922 | rb->lcd_set_drawmode(DRMODE_BG+DRMODE_INVERSEVID); | 922 | rb->lcd_set_drawmode(DRMODE_BG+DRMODE_INVERSEVID); |
923 | rb->lcd_fillrect(0, LCD_HEIGHT/2, LCD_WIDTH, LCD_HEIGHT/2); | 923 | rb->lcd_fillrect(0, LCD_HEIGHT/2, LCD_WIDTH, LCD_HEIGHT/2); |
924 | rb->lcd_set_drawmode(DRMODE_SOLID); | 924 | rb->lcd_set_drawmode(DRMODE_SOLID); |
@@ -987,7 +987,7 @@ static unsigned int blackjack_get_yes_no(char message[20]) { | |||
987 | rb->lcd_getstringsize(message_yes, &w, &h); | 987 | rb->lcd_getstringsize(message_yes, &w, &h); |
988 | const char *stg[] = {message_yes, message_no}; | 988 | const char *stg[] = {message_yes, message_no}; |
989 | 989 | ||
990 | #if LCD_HEIGHT <= 64 | 990 | #if LCD_HEIGHT <= 64 || LCD_WIDTH <= 96 |
991 | b = 2*h+1; | 991 | b = 2*h+1; |
992 | #else | 992 | #else |
993 | b = h-1; | 993 | b = h-1; |
@@ -1035,7 +1035,8 @@ static unsigned int blackjack_get_yes_no(char message[20]) { | |||
1035 | /***************************************************************************** | 1035 | /***************************************************************************** |
1036 | * blackjack_get_amount() gets an amount from the player to be used | 1036 | * blackjack_get_amount() gets an amount from the player to be used |
1037 | ******************************************************************************/ | 1037 | ******************************************************************************/ |
1038 | static signed int blackjack_get_amount(char message[20], signed int lower_limit, | 1038 | static signed int blackjack_get_amount(const char message[20], |
1039 | signed int lower_limit, | ||
1039 | signed int upper_limit, | 1040 | signed int upper_limit, |
1040 | signed int start) { | 1041 | signed int start) { |
1041 | int button; | 1042 | int button; |
@@ -1057,7 +1058,7 @@ static signed int blackjack_get_amount(char message[20], signed int lower_limit, | |||
1057 | rb->lcd_set_foreground(LCD_BLACK); | 1058 | rb->lcd_set_foreground(LCD_BLACK); |
1058 | #endif | 1059 | #endif |
1059 | 1060 | ||
1060 | #if LCD_HEIGHT <= 64 | 1061 | #if LCD_HEIGHT <= 64 || LCD_WIDTH <= 96 |
1061 | rb->lcd_clear_display(); | 1062 | rb->lcd_clear_display(); |
1062 | rb->lcd_puts(0, 1, message); | 1063 | rb->lcd_puts(0, 1, message); |
1063 | rb->lcd_putsf(0, 2, "$%d", amount); | 1064 | rb->lcd_putsf(0, 2, "$%d", amount); |
@@ -1155,7 +1156,7 @@ static signed int blackjack_get_amount(char message[20], signed int lower_limit, | |||
1155 | } | 1156 | } |
1156 | 1157 | ||
1157 | if(changed) { | 1158 | if(changed) { |
1158 | #if LCD_HEIGHT <= 64 | 1159 | #if LCD_HEIGHT <= 64 || LCD_WIDTH <= 96 |
1159 | rb->lcd_putsf(0, 2, "$%d", amount); | 1160 | rb->lcd_putsf(0, 2, "$%d", amount); |
1160 | rb->lcd_update(); | 1161 | rb->lcd_update(); |
1161 | #else | 1162 | #else |
@@ -1181,7 +1182,12 @@ static signed int blackjack_get_amount(char message[20], signed int lower_limit, | |||
1181 | * blackjack_get_bet() gets the player's bet. | 1182 | * blackjack_get_bet() gets the player's bet. |
1182 | ******************************************************************************/ | 1183 | ******************************************************************************/ |
1183 | static void blackjack_get_bet(struct game_context* bj) { | 1184 | static void blackjack_get_bet(struct game_context* bj) { |
1184 | bj->current_bet = blackjack_get_amount("Please enter a bet", 10, | 1185 | #if LCD_WIDTH <= 96 |
1186 | static const char msg[] = "Enter a bet"; | ||
1187 | #else | ||
1188 | static const char msg[] = "Please enter a bet"; | ||
1189 | #endif | ||
1190 | bj->current_bet = blackjack_get_amount(msg, 10, | ||
1185 | bj->player_money, bj->current_bet); | 1191 | bj->player_money, bj->current_bet); |
1186 | } | 1192 | } |
1187 | 1193 | ||