void jackpot_display_slot_machine(struct jackpot* game, struct screen* display) { char str[20]; int i; bool changes=false; #ifdef HAVE_LCD_CHARCELLS display->putchar(0, 0, '['); #else const struct picture* picture= &(jackpot_pictures[display->screen_type]); int pos_x=(display->getwidth()-NB_SLOTS*(picture->width+1))/2; int pos_y=(display->getheight()-(picture->slide_height))/2; #endif /* HAVE_LCD_CHARCELLS */ for(i=0;i<NB_SLOTS;i++) { #ifdef HAVE_LCD_CHARCELLS /* the only charcell lcd is 7 pixel high */ int state_y=(game->slot_state[i]*7)/PICTURE_ROTATION_STEPS; #else int state_y= (picture->slide_height*game->slot_state[i])/PICTURE_ROTATION_STEPS; #endif /* HAVE_LCD_CHARCELLS */ int previous_state_y=game->state_y[display->screen_type][i]; if(state_y==previous_state_y) continue;/*no need to update the picture as it's the same as previous displayed one*/ changes=true; game->state_y[display->screen_type][i]=state_y; #ifdef HAVE_LCD_CHARCELLS char* current_pattern=&(jackpot_slots_patterns[state_y]); display->define_pattern(char_patterns[i], current_pattern); display->putchar(i+1, 0, char_patterns[i]); #else vertical_picture_draw_part(display, picture, state_y, pos_x, pos_y); pos_x+=(picture->width+1); #endif } if(changes){ #ifdef HAVE_LCD_CHARCELLS rb->snprintf(str,sizeof(str),"$%d", game->money); display->putchar(++i, 0, ']'); display->puts(++i, 0, str); #else rb->snprintf(str,sizeof(str),"money : $%d", game->money); display->puts(0, 0, str); #endif display->update(); } }
/** * Draws a part of the given picture on the given screen * Use it when the data contains multiple pictures from top to bottom. * * @param display the screen where to display the picture * @param picture the picture's data, only a part will be displayed * @param sprite_no display that sprite in the picture * @param x abscissa where to put the picture * @param y ordinate where to put the picture */ void vertical_picture_draw_sprite(struct screen* display, const struct picture* picture, int sprite_no, int x, int y){ vertical_picture_draw_part( display, picture, sprite_no*picture->slide_height, x, y); }