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:
|
||||
offset = 0
|
||||
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.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()
|
||||
|
||||
def unload(self):
|
||||
|
||||
@@ -198,10 +198,26 @@ class VideoPlayer:
|
||||
def draw(self):
|
||||
"""Draw video frames to the raylib canvas"""
|
||||
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(
|
||||
self.texture,
|
||||
(0, 0, self.texture.width, self.texture.height),
|
||||
(0, 0, tex.screen_width, tex.screen_height),
|
||||
source,
|
||||
destination,
|
||||
(0, 0),
|
||||
0,
|
||||
ray.WHITE
|
||||
|
||||
Reference in New Issue
Block a user