def __update_display(self): # update text surfaces based on state values self.__update_text_surfaces() # fill screen self.SCREEN.fill(BLUE) # calculate offset for centering text offset = gen.menu_item("> INPUT: ", "KEYBOARD", False).get_width() / 2 x_loc = DISPLAY_RES[0] / 2 - offset - HELVETICA[30].size("")[0] # blit surfaces if self.charsel_state: self.__blit_character_select(self.SCREEN) # for i in range(NUM_SPRITES+1): self.SCREEN.blit(CHARACTERS_IMAGE, (180*i + 10, 50), (i*180, 0, 180, 120)) else: self.SCREEN.blit(PYGAME_IMAGE, (DISPLAY_RES[0] / 2 - PYGAME_IMAGE.get_width() / 2, 5)) self.SCREEN.blit(LOGO_IMAGE, (DISPLAY_RES[0] / 2 - LOGO_IMAGE.get_width() / 2, 70)) self.SCREEN.blit( self.gamedate_text_surface, (DISPLAY_RES[0] / 2 - self.gamedate_text_surface.get_width() / 2, 275) ) self.SCREEN.blit(self.start_text_surface, (x_loc, 325)) self.SCREEN.blit(self.newgame_text_surface, (x_loc, 360)) self.SCREEN.blit(self.check_buzzers_surface, (x_loc, 395)) self.SCREEN.blit(self.sfx_text_surface, (x_loc, 430)) self.SCREEN.blit(self.speech_text_surface, (x_loc, 465)) self.SCREEN.blit(self.music_text_surface, (x_loc, 500)) self.SCREEN.blit(self.buzzer_prompt_surface, (0, 0)) self.SCREEN.blit(self.buzzer_status_surface, (165, 0)) # display players self.__blit_all_characters(self.SCREEN)
def set_game_date(self, date): print self.game_date self.game_date = date self.gamedate_text_surface = gen.menu_item("", self.game_date, False) self.__update_display()
def __update_text_surfaces(self): # determine value of menu items if self.input_state: input_value = "BUZZERS" else: input_value = "KEYBOARD" if self.sfx_state: sfx_value = "ON" else: sfx_value = "OFF" if self.speech_state: speech_value = "ON" else: speech_value = "OFF" if self.music_state: music_value = "ON" else: music_value = "OFF" # update buzzer status surface self.buzzer_status_surface = self.__get_buzzer_status_surface() # update game date if not self.game_date: self.gamedate_text_surface = gen.menu_item(" GETTING ", "GAME...", False) # update text surfaces based on cursor location self.start_text_surface = gen.menu_item("> ", "START GAME", (self.cursor_loc == 0)) self.newgame_text_surface = gen.menu_item("> ", "GET NEW GAME", (self.cursor_loc == 1)) self.check_buzzers_surface = gen.menu_item("> INPUT: ", input_value, (self.cursor_loc == 2)) self.sfx_text_surface = gen.menu_item("> SFX: ", sfx_value, (self.cursor_loc == 3)) self.speech_text_surface = gen.menu_item("> SPEECH: ", speech_value, (self.cursor_loc == 4)) self.music_text_surface = gen.menu_item("> MUSIC: ", music_value, (self.cursor_loc == 5))
def __update_display(self): # update text surfaces based on state values self.__update_text_surfaces() # fill screen self.SCREEN.fill(BLUE) # calculate offset for centering text offset = gen.menu_item("> INPUT: ", "KEYBOARD", False).get_width() / 2 x_loc = DISPLAY_RES[0] / 2 - offset - HELVETICA[30].size("")[0] scaled_alex = pygame.transform.scale( ALEX_IMAGE, (ALEX_IMAGE.get_width() * 3, ALEX_IMAGE.get_height() * 3)) # blit surfaces if self.charsel_state: self.SCREEN.blit(pygame.transform.scale(MAINBG_IMAGE, DISPLAY_RES), (0, 0)) self.__blit_character_select(self.SCREEN) else: # self.SCREEN.blit(PYGAME_IMAGE, (DISPLAY_RES[0]/2-PYGAME_IMAGE.get_width()/2, 5)) util.blit_alpha(self.SCREEN, scaled_alex, (0, DISPLAY_RES[1] - scaled_alex.get_height()), 100) util.blit_alpha(self.SCREEN, pygame.transform.flip(scaled_alex, True, True), (DISPLAY_RES[0] - scaled_alex.get_width(), DISPLAY_RES[1] - scaled_alex.get_height()), 100) self.SCREEN.blit( LOGO_IMAGE, (DISPLAY_RES[0] / 2 - LOGO_IMAGE.get_width() / 2, 70)) self.SCREEN.blit(self.gamedate_text_surface, (DISPLAY_RES[0] / 2 - self.gamedate_text_surface.get_width() / 2, 275)) self.SCREEN.blit(self.start_text_surface, (x_loc, 325)) self.SCREEN.blit(self.newgame_text_surface, (x_loc, 360)) self.SCREEN.blit(self.check_buzzers_surface, (x_loc, 395)) self.SCREEN.blit(self.sfx_text_surface, (x_loc, 430)) self.SCREEN.blit(self.speech_text_surface, (x_loc, 465)) self.SCREEN.blit(self.music_text_surface, (x_loc, 500)) self.SCREEN.blit(self.buzzer_prompt_surface, (0, 0)) self.SCREEN.blit(self.buzzer_status_surface, (165, 0)) # display players self.__blit_all_characters(self.SCREEN)
def __update_display(self): # update text surfaces based on state values self.__update_text_surfaces() # fill screen self.SCREEN.fill(BLUE) # calculate offset for centering text offset = gen.menu_item("> INPUT: ", "KEYBOARD", False).get_width()/2 x_loc = DISPLAY_RES[0]/2 - offset - HELVETICA[30].size("")[0] scaled_alex = pygame.transform.scale(ALEX_IMAGE, (ALEX_IMAGE.get_width()*3, ALEX_IMAGE.get_height()*3)) # blit surfaces if self.charsel_state: self.SCREEN.blit(pygame.transform.scale(MAINBG_IMAGE, DISPLAY_RES), (0, 0)) self.__blit_character_select(self.SCREEN) else: #self.SCREEN.blit(PYGAME_IMAGE, (DISPLAY_RES[0]/2-PYGAME_IMAGE.get_width()/2, 5)) util.blit_alpha(self.SCREEN, scaled_alex, (0, DISPLAY_RES[1]-scaled_alex.get_height()), 100) util.blit_alpha(self.SCREEN, pygame.transform.flip(scaled_alex, True, True), (DISPLAY_RES[0]-scaled_alex.get_width(), DISPLAY_RES[1]-scaled_alex.get_height()), 100) self.SCREEN.blit(LOGO_IMAGE, (DISPLAY_RES[0]/2-LOGO_IMAGE.get_width()/2, 70)) self.SCREEN.blit(self.gamedate_text_surface, (DISPLAY_RES[0]/2 - self.gamedate_text_surface.get_width()/2, 275)) self.SCREEN.blit(self.start_text_surface, (x_loc, 325)) self.SCREEN.blit(self.newgame_text_surface, (x_loc, 360)) self.SCREEN.blit(self.check_buzzers_surface, (x_loc, 395)) self.SCREEN.blit(self.sfx_text_surface, (x_loc, 430)) self.SCREEN.blit(self.speech_text_surface, (x_loc, 465)) self.SCREEN.blit(self.music_text_surface, (x_loc, 500)) self.SCREEN.blit(self.buzzer_prompt_surface, (0, 0)) self.SCREEN.blit(self.buzzer_status_surface, (165, 0)) # display players self.__blit_all_characters(self.SCREEN)