def draw_pokemon(self, display: pygame.Surface, poke: 'player_pokemon.PlayerPokemon', _x: float, _y: float, poke_y: int, color, text_color ): if not poke: return heal = poke.heal, poke.get_max_heal() _x2 = 24 utils.draw_rond_rectangle(display, _x, _y, SURFACE_SIZE[1] * 0.08, SURFACE_SIZE[0] * 0.2, color) utils.draw_progress_bar(display, (_x + _x2, _y + 1060 * 0.02), (600 * 0.28, 5), (52, 56, 61), (45, 181, 4), heal[0] / heal[1]) display.blit(poke.get_front_image(0.5), (_x - 20, _y + 4 - poke_y)) # display heal display.blit(game.FONT_16.render("{}/{}".format(heal[0], heal[1]), True, text_color), (_x + _x2, _y + SURFACE_SIZE[0] * 0.028)) # display lvl display.blit(game.FONT_24.render("N.{}".format(poke.lvl), True, text_color), (_x + _x2 + SURFACE_SIZE[1] * 0.25, _y + SURFACE_SIZE[0] * 0.025)) # display name display.blit(game.FONT_20.render(poke.get_name(True), True, text_color), (_x + _x2, _y + 2)) # display pokeball display.blit(pygame.transform.scale(poke.poke_ball.image, (16, 16)), (_x + _x2 + SURFACE_SIZE[1] * 0.3, _y + 5))
def render(self, display): display.fill((238, 235, 252)) pygame.draw.polygon(display, (241, 65, 78), StatusMenu.st_poly_1) pygame.draw.polygon(display, (206, 51, 65), StatusMenu.st_poly_2) pygame.draw.polygon(display, (0, 0, 0), StatusMenu.st_poly_3) pygame.draw.polygon(display, (241, 65, 78), StatusMenu.st_arrow_1) pygame.draw.polygon(display, (241, 65, 78), StatusMenu.st_arrow_2) display.blit(self.display_large, (SURFACE_SIZE[0] * 0.5, SURFACE_SIZE[1] * 0.2)) display.blit(self.name, (SURFACE_SIZE[0] * 0.6, SURFACE_SIZE[1] * 0.06)) display.blit(self.lvl, (SURFACE_SIZE[0] * 0.8, SURFACE_SIZE[1] * 0.06)) display.blit(self.poke_ball, (SURFACE_SIZE[0] * 0.555, SURFACE_SIZE[1] * 0.06 + 1)) _y = SURFACE_SIZE[1] * 0.1 for i in range(2): pygame.draw.rect(display, (219, 219, 217), pygame.Rect(0, _y, SURFACE_SIZE[0] * 0.25, SURFACE_SIZE[1] * 0.13)) pygame.draw.rect(display, (255, 255, 255), pygame.Rect(SURFACE_SIZE[0] * 0.25, _y, SURFACE_SIZE[0] * 0.25, SURFACE_SIZE[1] * 0.13)) pygame.draw.rect(display, (241, 241, 241), pygame.Rect(0, _y + SURFACE_SIZE[1] * 0.06, SURFACE_SIZE[0] * 0.5, SURFACE_SIZE[1] * 0.01)) a = 0 if i == 0 else 2 display.blit(self.text[a], (SURFACE_SIZE[0] * 0.125 - self.text_width[a], _y + SURFACE_SIZE[1] * 0.015)) display.blit(self.text[a + 1], (SURFACE_SIZE[0] * 0.125 - self.text_width[a + 1], _y + SURFACE_SIZE[1] * 0.085)) _x_ = SURFACE_SIZE[0] * 0.27 if i == 0: display.blit(self.name2, (_x_, _y + SURFACE_SIZE[1] * 0.015)) for ii in range(len(self._type)): utils.draw_type(display, _x_, _y + SURFACE_SIZE[1] * 0.085, self.poke.poke.types[ii]) _x_ += SURFACE_SIZE[0] * 0.11 else: display.blit(self.xp, (_x_, _y + SURFACE_SIZE[1] * 0.015)) display.blit(self.xp_need, (SURFACE_SIZE[0] * 0.46 - self.xp_need_size, _y + SURFACE_SIZE[1] * 0.078)) utils.draw_progress_bar(display, (_x_, _y + SURFACE_SIZE[1] * 0.11), (SURFACE_SIZE[0] * 0.19, 4), (101, 100, 98), (96, 204, 212), self.xp_s[0] / self.xp_s[1]) _y += SURFACE_SIZE[1] * 0.14 _x = SURFACE_SIZE[0] * 0.03 _y = SURFACE_SIZE[1] * 0.5 for ab in range(4): utils.draw_ability(display, (_x, _y), self.poke.get_ability(ab)) _y += 40
def draw_pokemon(self, display: pygame.Surface, i: int, _x: float, _y: float, poke_y: int): color, start = ((0, 0, 0), 1) if self.selected == i else ((255, 255, 255), 0) utils.draw_rond_rectangle(display, _x, _y, 49, 212, color) xp = self.progress[i] _x2 = SURFACE_SIZE[1] * 0.04 text = self.text[i] utils.draw_progress_bar(display, (_x + _x2, _y + 21), (SURFACE_SIZE[1] * 0.28, 5), (52, 56, 61), (45, 181, 4), xp[0] / xp[1]) display.blit(self.display_small[i], (_x - 20, _y + 4 - poke_y)) # display heal display.blit(text[start], (_x + _x2, _y + SURFACE_SIZE[0] * 0.028)) # display lvl display.blit( text[start + 2], (_x + _x2 + SURFACE_SIZE[1] * 0.24, _y + SURFACE_SIZE[0] * 0.024)) # display name display.blit(text[start + 4], (_x + _x2, _y + 2)) # display pokeball display.blit(self.poke_ball[i], (_x + _x2 + SURFACE_SIZE[1] * 0.3, _y + 5)) # display status poke = self.player.team[i] if poke: im = poke.combat_status.get_all_image() if len(im) > 0: current = im[min( utils.current_milli_time() % (len(im) * 2000) // 2000, len(im) - 1)] utils.draw_rond_rectangle(display, _x + 105, _y + 31, 12, 50, current[1]) display.blit( tx := game.FONT_12.render(current[0], True, (255, 255, 255)), (_x + 130 - tx.get_size()[0] // 2, _y + 37 - tx.get_size()[1] // 2)) if self.selected == i: display.blit(self.arrow, (_x - 50, _y + 2)) display.blit(self.display_large[i], (SURFACE_SIZE[0] * 0.5, SURFACE_SIZE[1] * 0.2))
def draw_xp_pokemon(display: pygame.Surface, progress: Optional[list[tuple[int, bool]]]) -> NoReturn: pygame.draw.polygon(display, (255, 255, 255), ((477, 0), (583, 0), (265, 600), (159, 600))) pygame.draw.polygon(display, "#f4f4f4", ((0, 0), (477, 0), (159, 600), (0, 600))) y = 10 h = 70 c = 5 for i in range(6): pygame.draw.polygon(display, "#e0e0e0", ((0, y), (x(y), y), (x(y + h), y + h), (0, y + h))) poke = game.game_instance.player.team[i] if poke: im = poke.get_front_image(0.7) delta_x, delta_y = utils.get_first_color(im) display.blit(im, (40 - delta_x // 2, y + 60 - delta_y)) display.blit( game.FONT_24.render(poke.get_name(True), True, (0, 0, 0)), (80, y + 10)) display.blit( game.FONT_24.render(f'N. {poke.lvl}', True, (0, 0, 0)), (80, y + h - 5 - game.FONT_SIZE_24[1])) if progress and (xp_p := progress[i][0]) > 0: display.blit( tx := game.FONT_24.render(f'+ {(xp_p):,}', True, (0, 0, 0)), (230 - tx.get_size()[0], y + h - 5 - game.FONT_SIZE_24[1])) if progress[i][1]: display.blit( game.FONT_24.render( game.game_instance.get_message("level_up"), True, (227, 25, 45)), (240, y + 10)) xp = poke.current_xp_status() utils.draw_progress_bar(display, (80, y + h - 4), (150, 4), "#5a5a5a", "#45c1fd", xp[0] / xp[1]) y += h + c
def get_compilation(self): duration = self.duration clips = [] # Cut randomized clips from random videos in chronological order section_index = 0 subsection_index = 0 sections = self.bmcfg.sections if self.bmcfg else [] current_time = 0.0 frame_time = 1.0 / self.fps while duration - current_time > frame_time: # Select random clip length that is a whole multiple of beats long if self.bmcfg and len(sections) >= 1: # Use beatmeter generator config: time cuts to beats perfectly if subsection_index == 0: # compute number of subsections in this pattern and length section = sections[section_index] next_section_start = (sections[section_index + 1].start if section_index + 1 < len(sections) else section.stop) section_length = next_section_start - section.start subsection_length = section.pattern_duration or ( 4 * 60 / (section.bpm or self.bpm)) subsection_length *= 2**(3 - self.speed) if subsection_length >= section_length: subsection_length = section_length num_subsections = round(section_length / subsection_length) elif subsection_index == num_subsections: # Go to next beat pattern section subsection_index = 0 section_index += 1 continue length = subsection_length if section_index == 0 and subsection_index == 0: # First cut in round is longer, since beat hasn't started length += sections[0].start elif (section_index == len(sections) - 1 and subsection_index == num_subsections - 1): # Last cut in round extended to match Base track length length = duration - current_time elif subsection_index == num_subsections - 1: # Last cut per section is adjusted to account for drift # due to imperfect beat timings given in beatmeter config length = sections[section_index + 1].start - current_time subsection_index += 1 else: # Simple accelerating cuts if beatmeter config is not provided seconds_per_beat = 60 / self.bpm current_multiple = 4 * 2**(5 - self.speed) current_progress = current_time / duration for step in (0.25, 0.5, 0.75): if current_progress > step: current_multiple /= 2 length = seconds_per_beat * max(1, current_multiple) # Cut multiple clips from various sources out_clips = [] for _ in range(self.versions): # Advance all clips by simlar percentage of total duration self.advance_sources(length, current_time) # Get the next clip source i = self.get_source_clip_index(length) out_clip = self.sources[i].clip start = self.sources[i].start # Cut a subclip out_clip = out_clip.subclip(start, start + length) out_clip = resize(out_clip, self.dims) out_clips.append(out_clip) self.choose_version(out_clips) clips.append(out_clips[self._chosen or 0]) current_time += length # TODO: move progress into GUI if self.versions > 1: draw_progress_bar(min(1, current_time / duration), 80) if self.versions > 1: print("\nDone!") return clips