blackjack: adapt to narrow clip zip screen

Change-Id: I5d45d202bc63c7cf36cfb97c98579e83a4720fbf
This commit is contained in:
Rafaël Carré 2013-02-18 08:22:04 +01:00
parent 66acb3996d
commit fda2ce63f0
1 changed files with 14 additions and 8 deletions

View File

@ -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);
}