def get_window_pos(self): normalized_pos = (GameMath.inverse_lerp(0, Settings.SCREEN_WIDTH, self.x), GameMath.inverse_lerp(0, Settings.SCREEN_HEIGHT, self.y)) return (GameMath.no_clamp_lerp(0, Settings.WINDOW_WIDTH, normalized_pos[0]), GameMath.no_clamp_lerp(0, Settings.WINDOW_HEIGHT, normalized_pos[1]))
def get_window_vertices(self): window_verts = [] for v in self.get_camera_vertices(): normalized_vert = (GameMath.inverse_lerp(0, Settings.SCREEN_WIDTH, v[0]), GameMath.inverse_lerp(0, Settings.SCREEN_HEIGHT, v[1])) window_verts.append( (GameMath.no_clamp_lerp(0, Settings.WINDOW_WIDTH, normalized_vert[0]), GameMath.no_clamp_lerp(0, Settings.WINDOW_HEIGHT, normalized_vert[1]))) return window_verts
def update_colors(self): current_lerp_time = GameMath.inverse_lerp(self.last_changed_beat, self.last_changed_beat + MusicManager.crotchet * self.beats_to_change, MusicManager.get_song_position()) p1 = Levels.levels[GameManager.currentLevelIndex].current_palettes[0] p2 = Levels.levels[GameManager.currentLevelIndex].current_palettes[1] if self.fading_in: Colors.currentPalette = GameMath.palette_lerp(p2, p1, current_lerp_time) else: Colors.currentPalette = GameMath.palette_lerp(p1, p2, current_lerp_time)