mirror of
https://github.com/Yonokid/PyTaiko.git
synced 2026-02-04 03:30:13 +01:00
minor optimizations
This commit is contained in:
@@ -448,10 +448,10 @@ class OutlinedText:
|
|||||||
else:
|
else:
|
||||||
offset = 0
|
offset = 0
|
||||||
dest_rect = ray.Rectangle(x, y+offset, self.texture.width+x2, self.texture.height+y2)
|
dest_rect = ray.Rectangle(x, y+offset, self.texture.width+x2, self.texture.height+y2)
|
||||||
if self.outline_thickness > 0:
|
if self.outline_thickness > 0 and self._last_color != ray.BLANK:
|
||||||
ray.begin_shader_mode(self.shader)
|
ray.begin_shader_mode(self.shader)
|
||||||
ray.draw_texture_pro(self.texture, self.default_src, dest_rect, origin, rotation, final_color)
|
ray.draw_texture_pro(self.texture, self.default_src, dest_rect, origin, rotation, final_color)
|
||||||
if self.outline_thickness > 0:
|
if self.outline_thickness > 0 and self._last_color != ray.BLANK:
|
||||||
ray.end_shader_mode()
|
ray.end_shader_mode()
|
||||||
|
|
||||||
def unload(self):
|
def unload(self):
|
||||||
|
|||||||
@@ -198,10 +198,26 @@ class VideoPlayer:
|
|||||||
def draw(self):
|
def draw(self):
|
||||||
"""Draw video frames to the raylib canvas"""
|
"""Draw video frames to the raylib canvas"""
|
||||||
if self.texture is not None:
|
if self.texture is not None:
|
||||||
|
source = (0, 0, self.texture.width, self.texture.height)
|
||||||
|
texture_aspect = self.texture.width / self.texture.height
|
||||||
|
screen_aspect = tex.screen_width / tex.screen_height
|
||||||
|
if texture_aspect > screen_aspect:
|
||||||
|
dest_width = tex.screen_width
|
||||||
|
dest_height = tex.screen_width / texture_aspect
|
||||||
|
dest_x = 0
|
||||||
|
dest_y = (tex.screen_height - dest_height) / 2
|
||||||
|
else:
|
||||||
|
dest_height = tex.screen_height
|
||||||
|
dest_width = tex.screen_height * texture_aspect
|
||||||
|
dest_x = (tex.screen_width - dest_width) / 2
|
||||||
|
dest_y = 0
|
||||||
|
|
||||||
|
destination = (dest_x, dest_y, dest_width, dest_height)
|
||||||
|
ray.ClearBackground(ray.BLACK)
|
||||||
ray.DrawTexturePro(
|
ray.DrawTexturePro(
|
||||||
self.texture,
|
self.texture,
|
||||||
(0, 0, self.texture.width, self.texture.height),
|
source,
|
||||||
(0, 0, tex.screen_width, tex.screen_height),
|
destination,
|
||||||
(0, 0),
|
(0, 0),
|
||||||
0,
|
0,
|
||||||
ray.WHITE
|
ray.WHITE
|
||||||
|
|||||||
@@ -314,8 +314,10 @@ class GameScreen(Screen):
|
|||||||
|
|
||||||
def draw_overlay(self):
|
def draw_overlay(self):
|
||||||
self.song_info.draw()
|
self.song_info.draw()
|
||||||
self.transition.draw()
|
if not self.transition.is_finished:
|
||||||
self.result_transition.draw()
|
self.transition.draw()
|
||||||
|
if self.result_transition.is_started:
|
||||||
|
self.result_transition.draw()
|
||||||
self.allnet_indicator.draw()
|
self.allnet_indicator.draw()
|
||||||
|
|
||||||
def draw(self):
|
def draw(self):
|
||||||
@@ -534,8 +536,8 @@ class Player:
|
|||||||
self.draw_note_list.extend(branch_section.draw_notes)
|
self.draw_note_list.extend(branch_section.draw_notes)
|
||||||
self.draw_bar_list.extend(branch_section.bars)
|
self.draw_bar_list.extend(branch_section.bars)
|
||||||
self.play_notes = deque(sorted(self.play_notes))
|
self.play_notes = deque(sorted(self.play_notes))
|
||||||
self.draw_note_list = deque(sorted(self.draw_note_list, key=lambda x: x.hit_ms))
|
self.draw_note_list = deque(sorted(self.draw_note_list, key=lambda x: x.load_ms))
|
||||||
self.draw_bar_list = deque(sorted(self.draw_bar_list, key=lambda x: x.hit_ms))
|
self.draw_bar_list = deque(sorted(self.draw_bar_list, key=lambda x: x.load_ms))
|
||||||
total_don = [note for note in self.play_notes if note.type in {NoteType.DON, NoteType.DON_L}]
|
total_don = [note for note in self.play_notes if note.type in {NoteType.DON, NoteType.DON_L}]
|
||||||
total_kat = [note for note in self.play_notes if note.type in {NoteType.KAT, NoteType.KAT_L}]
|
total_kat = [note for note in self.play_notes if note.type in {NoteType.KAT, NoteType.KAT_L}]
|
||||||
total_other = [note for note in self.play_notes if note.type not in {NoteType.DON, NoteType.DON_L, NoteType.KAT, NoteType.KAT_L}]
|
total_other = [note for note in self.play_notes if note.type not in {NoteType.DON, NoteType.DON_L, NoteType.KAT, NoteType.KAT_L}]
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ void main()
|
|||||||
|
|
||||||
float outline = 0.0;
|
float outline = 0.0;
|
||||||
int ringSamples = 16;
|
int ringSamples = 16;
|
||||||
int rings = 2;
|
int rings = 1;
|
||||||
for(int ring = 1; ring <= rings; ring++) {
|
for(int ring = 1; ring <= rings; ring++) {
|
||||||
float ringRadius = float(ring) / float(rings);
|
float ringRadius = float(ring) / float(rings);
|
||||||
for(int i = 0; i < ringSamples; i++) {
|
for(int i = 0; i < ringSamples; i++) {
|
||||||
|
|||||||
Reference in New Issue
Block a user