mirror of
https://github.com/Yonokid/PyTaiko.git
synced 2026-02-04 19:50:12 +01:00
add nameplates
This commit is contained in:
@@ -93,6 +93,8 @@ class DonBG3(DonBGBase):
|
||||
super().__init__(tex, index, player_num)
|
||||
self.bounce_up = tex.get_animation(4)
|
||||
self.bounce_down = tex.get_animation(5)
|
||||
self.bounce_up.start()
|
||||
self.bounce_down.start()
|
||||
self.overlay_move = tex.get_animation(6)
|
||||
self.overlay_move_2 = tex.get_animation(7)
|
||||
|
||||
@@ -100,6 +102,9 @@ class DonBG3(DonBGBase):
|
||||
super().update(current_time_ms, is_clear)
|
||||
self.bounce_up.update(current_time_ms)
|
||||
self.bounce_down.update(current_time_ms)
|
||||
if self.bounce_up.is_finished:
|
||||
self.bounce_up.restart()
|
||||
self.bounce_down.restart()
|
||||
self.overlay_move.update(current_time_ms)
|
||||
self.overlay_move_2.update(current_time_ms)
|
||||
|
||||
@@ -137,12 +142,17 @@ class DonBG5(DonBGBase):
|
||||
super().__init__(tex, index, player_num)
|
||||
self.bounce_up = tex.get_animation(4)
|
||||
self.bounce_down = tex.get_animation(5)
|
||||
self.bounce_up.start()
|
||||
self.bounce_down.start()
|
||||
self.adjust = tex.get_animation(8)
|
||||
|
||||
def update(self, current_time_ms: float, is_clear: bool):
|
||||
super().update(current_time_ms, is_clear)
|
||||
self.bounce_up.update(current_time_ms)
|
||||
self.bounce_down.update(current_time_ms)
|
||||
if self.bounce_up.is_finished:
|
||||
self.bounce_up.restart()
|
||||
self.bounce_down.restart()
|
||||
self.adjust.update(current_time_ms)
|
||||
|
||||
def draw(self, tex: TextureWrapper):
|
||||
@@ -321,7 +331,7 @@ class BGFever:
|
||||
|
||||
@staticmethod
|
||||
def create(tex: TextureWrapper, index: int):
|
||||
map = [None, None, None, BGFever4]
|
||||
map = [BGFever1, None, None, BGFever4]
|
||||
selected_obj = map[index]
|
||||
return selected_obj(tex, index)
|
||||
|
||||
@@ -331,6 +341,19 @@ class BGFeverBase:
|
||||
tex.load_zip('background', f'bg_fever/{self.name}')
|
||||
self.transitioned = False
|
||||
|
||||
class BGFever1(BGFeverBase):
|
||||
def __init__(self, tex: TextureWrapper, index: int):
|
||||
super().__init__(tex, index)
|
||||
|
||||
def start(self):
|
||||
pass
|
||||
|
||||
def update(self, current_time_ms: float):
|
||||
pass
|
||||
|
||||
def draw(self, tex: TextureWrapper):
|
||||
pass
|
||||
|
||||
class BGFever4(BGFeverBase):
|
||||
def __init__(self, tex: TextureWrapper, index: int):
|
||||
super().__init__(tex, index)
|
||||
|
||||
@@ -130,7 +130,6 @@ class TextureWrapper:
|
||||
raise Exception(f"Texture {tex_name} was not found in {zip}")
|
||||
|
||||
def load_screen_textures(self, screen_name: str) -> None:
|
||||
self.unload_textures()
|
||||
screen_path = self.graphics_path / screen_name
|
||||
if (screen_path / 'animation.json').exists():
|
||||
with open(screen_path / 'animation.json') as json_file:
|
||||
|
||||
@@ -252,6 +252,7 @@ class OutlinedText:
|
||||
def __init__(self, text: str, font_size: int, color: ray.Color, outline_color: ray.Color, outline_thickness=5.0, vertical=False):
|
||||
self.text = text
|
||||
self.hash = self._hash_text(text, font_size, color, vertical)
|
||||
self.outline_thickness = outline_thickness
|
||||
if self.hash in text_cache:
|
||||
self.texture = ray.load_texture(f'cache/image/{self.hash}.png')
|
||||
else:
|
||||
@@ -260,7 +261,7 @@ class OutlinedText:
|
||||
self.texture = self._create_text_vertical(text, font_size, color, ray.BLANK, self.font)
|
||||
else:
|
||||
self.texture = self._create_text_horizontal(text, font_size, color, ray.BLANK, self.font)
|
||||
outline_size = ray.ffi.new('float*', outline_thickness)
|
||||
outline_size = ray.ffi.new('float*', self.outline_thickness)
|
||||
if isinstance(outline_color, tuple):
|
||||
outline_color_alloc = ray.ffi.new("float[4]", [
|
||||
outline_color[0] / 255.0,
|
||||
@@ -498,9 +499,11 @@ class OutlinedText:
|
||||
else:
|
||||
alpha_value = ray.ffi.new('float*', color.a / 255.0)
|
||||
ray.set_shader_value(self.shader, self.alpha_loc, alpha_value, SHADER_UNIFORM_FLOAT)
|
||||
ray.begin_shader_mode(self.shader)
|
||||
if self.outline_thickness > 0:
|
||||
ray.begin_shader_mode(self.shader)
|
||||
ray.draw_texture_pro(self.texture, src, dest, origin, rotation, color)
|
||||
ray.end_shader_mode()
|
||||
if self.outline_thickness > 0:
|
||||
ray.end_shader_mode()
|
||||
|
||||
def unload(self):
|
||||
ray.unload_shader(self.shader)
|
||||
|
||||
Reference in New Issue
Block a user