From 0e1efadebe4610425a621501628b217939902b8a Mon Sep 17 00:00:00 2001 From: somepin <79652090+somepin@users.noreply.github.com> Date: Tue, 4 Nov 2025 21:20:45 -0500 Subject: [PATCH 1/2] Add window scale letterbox for non-16:9/ultrawide monitors --- PyTaiko.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/PyTaiko.py b/PyTaiko.py index b36420b..23375fe 100644 --- a/PyTaiko.py +++ b/PyTaiko.py @@ -195,6 +195,8 @@ def main(): ray.toggle_borderless_windowed() logger.info("Toggled borderless windowed mode") + scale = min(ray.get_screen_width() / screen_width, ray.get_screen_height() / screen_height) + ray.begin_texture_mode(target) ray.begin_blend_mode(ray.BlendMode.BLEND_CUSTOM_SEPARATE) @@ -215,11 +217,13 @@ def main(): ray.end_blend_mode() ray.end_texture_mode() ray.begin_drawing() - ray.clear_background(ray.WHITE) + ray.clear_background(ray.BLACK) ray.draw_texture_pro( target.texture, ray.Rectangle(0, 0, target.texture.width, -target.texture.height), - ray.Rectangle(0, 0, ray.get_screen_width(), ray.get_screen_height()), + ray.Rectangle((ray.get_screen_width() - (screen_width * scale)) * 0.5, + (ray.get_screen_height() - (screen_height * scale)) * 0.5, + screen_width * scale, screen_height * scale), ray.Vector2(0,0), 0, ray.WHITE From 09a5d9454d6a50f2eff5d232688a543cf4110d5f Mon Sep 17 00:00:00 2001 From: somepin <79652090+somepin@users.noreply.github.com> Date: Wed, 5 Nov 2025 09:14:31 -0500 Subject: [PATCH 2/2] Handle get_screen_width/height returning 0 --- PyTaiko.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/PyTaiko.py b/PyTaiko.py index 23375fe..20b491a 100644 --- a/PyTaiko.py +++ b/PyTaiko.py @@ -195,7 +195,16 @@ def main(): ray.toggle_borderless_windowed() logger.info("Toggled borderless windowed mode") - scale = min(ray.get_screen_width() / screen_width, ray.get_screen_height() / screen_height) + curr_screen_width = ray.get_screen_width() + curr_screen_height = ray.get_screen_height() + + if curr_screen_width == 0 or curr_screen_height == 0: + dest_rect = ray.Rectangle(0, 0, screen_width, screen_height) + else: + scale = min(curr_screen_width / screen_width, curr_screen_height / screen_height) + dest_rect = ray.Rectangle((curr_screen_width - (screen_width * scale)) * 0.5, + (curr_screen_height - (screen_height * scale)) * 0.5, + screen_width * scale, screen_height * scale) ray.begin_texture_mode(target) ray.begin_blend_mode(ray.BlendMode.BLEND_CUSTOM_SEPARATE) @@ -221,9 +230,7 @@ def main(): ray.draw_texture_pro( target.texture, ray.Rectangle(0, 0, target.texture.width, -target.texture.height), - ray.Rectangle((ray.get_screen_width() - (screen_width * scale)) * 0.5, - (ray.get_screen_height() - (screen_height * scale)) * 0.5, - screen_width * scale, screen_height * scale), + dest_rect, ray.Vector2(0,0), 0, ray.WHITE