summaryrefslogtreecommitdiffstats
path: root/apps/plugins/blackjack.c
diff options
context:
space:
mode:
authorRafaël Carré <funman@videolan.org>2013-02-18 08:22:04 +0100
committerRafaël Carré <funman@videolan.org>2013-02-18 08:22:27 +0100
commitfda2ce63f01825798bcd2980807ab7c306d32cc5 (patch)
tree8517eab569abc1e26fc39dde45a892fc005ea6c2 /apps/plugins/blackjack.c
parent66acb3996dcb1d22c7ddcc22a1d2d5d7281c2d9e (diff)
downloadrockbox-fda2ce63f01825798bcd2980807ab7c306d32cc5.tar.gz
rockbox-fda2ce63f01825798bcd2980807ab7c306d32cc5.tar.bz2
rockbox-fda2ce63f01825798bcd2980807ab7c306d32cc5.zip
blackjack: adapt to narrow clip zip screen
Change-Id: I5d45d202bc63c7cf36cfb97c98579e83a4720fbf
Diffstat (limited to 'apps/plugins/blackjack.c')
-rw-r--r--apps/plugins/blackjack.c22
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) {
unsigned int w, h, y_loc;
char str[10];
-#if LCD_HEIGHT <= 64
+#if LCD_HEIGHT <= 64 || LCD_WIDTH <= 96
rb->lcd_getstringsize("Bet", &w, &h);
rb->lcd_putsxy(LCD_WIDTH - w, 2*h + 1, "Bet");
rb->snprintf(str, 9, "$%d", bj->current_bet);
@@ -808,7 +808,7 @@ static void update_total(struct game_context* bj) {
unsigned int w, h;
rb->snprintf(total, 3, "%d", bj->player_total);
rb->lcd_getstringsize(total, &w, &h);
-#if LCD_HEIGHT > 64
+#if LCD_HEIGHT > 64 && LCD_WIDTH > 96
h *= 2;
#endif
rb->lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 + h, total);
@@ -918,7 +918,7 @@ static void finish_game(struct game_context* bj) {
}
rb->lcd_getstringsize(str, &w, &h);
-#if LCD_HEIGHT <= 64
+#if LCD_HEIGHT <= 64 || LCD_WIDTH <= 96
rb->lcd_set_drawmode(DRMODE_BG+DRMODE_INVERSEVID);
rb->lcd_fillrect(0, LCD_HEIGHT/2, LCD_WIDTH, LCD_HEIGHT/2);
rb->lcd_set_drawmode(DRMODE_SOLID);
@@ -987,7 +987,7 @@ static unsigned int blackjack_get_yes_no(char message[20]) {
rb->lcd_getstringsize(message_yes, &w, &h);
const char *stg[] = {message_yes, message_no};
-#if LCD_HEIGHT <= 64
+#if LCD_HEIGHT <= 64 || LCD_WIDTH <= 96
b = 2*h+1;
#else
b = h-1;
@@ -1035,7 +1035,8 @@ static unsigned int blackjack_get_yes_no(char message[20]) {
/*****************************************************************************
* blackjack_get_amount() gets an amount from the player to be used
******************************************************************************/
-static signed int blackjack_get_amount(char message[20], signed int lower_limit,
+static signed int blackjack_get_amount(const char message[20],
+ signed int lower_limit,
signed int upper_limit,
signed int start) {
int button;
@@ -1057,7 +1058,7 @@ static signed int blackjack_get_amount(char message[20], signed int lower_limit,
rb->lcd_set_foreground(LCD_BLACK);
#endif
-#if LCD_HEIGHT <= 64
+#if LCD_HEIGHT <= 64 || LCD_WIDTH <= 96
rb->lcd_clear_display();
rb->lcd_puts(0, 1, message);
rb->lcd_putsf(0, 2, "$%d", amount);
@@ -1155,7 +1156,7 @@ static signed int blackjack_get_amount(char message[20], signed int lower_limit,
}
if(changed) {
-#if LCD_HEIGHT <= 64
+#if LCD_HEIGHT <= 64 || LCD_WIDTH <= 96
rb->lcd_putsf(0, 2, "$%d", amount);
rb->lcd_update();
#else
@@ -1181,7 +1182,12 @@ static signed int blackjack_get_amount(char message[20], signed int lower_limit,
* blackjack_get_bet() gets the player's bet.
******************************************************************************/
static void blackjack_get_bet(struct game_context* bj) {
- bj->current_bet = blackjack_get_amount("Please enter a bet", 10,
+#if LCD_WIDTH <= 96
+ static const char msg[] = "Enter a bet";
+#else
+ static const char msg[] = "Please enter a bet";
+#endif
+ bj->current_bet = blackjack_get_amount(msg, 10,
bj->player_money, bj->current_bet);
}