diff --git a/app/project.godot b/app/project.godot index 2ad2cb5..580c4b4 100644 --- a/app/project.godot +++ b/app/project.godot @@ -42,6 +42,7 @@ gdscript/warnings/integer_division=0 window/size/viewport_width=1920 window/size/viewport_height=1080 window/size/mode=4 +window/size/resizable=false window/size/borderless=true window/stretch/mode="canvas_items" window/stretch/aspect="expand" diff --git a/app/scripts/sandbox/render_result.gd b/app/scripts/sandbox/render_result.gd index 0fa0bce..14b17e1 100644 --- a/app/scripts/sandbox/render_result.gd +++ b/app/scripts/sandbox/render_result.gd @@ -5,11 +5,13 @@ class_name RenderResult @export var command_events: CommandEvents @export var ui_events: UiEvents +const MAX_RESOLUTION_WIDTH = 1920 # TODO: move to settings + var ext_texure: ExternalTexture var texture_rid: RID -@onready var width: int = get_viewport().size.x / (2 if Platform.is_macos() else 1) -@onready var height: int = get_viewport().size.y / (2 if Platform.is_macos() else 1) +var width: int +var height: int func _ready() -> void: @@ -18,6 +20,21 @@ func _ready() -> void: command_events.ext_texture_format.connect(ext_texture_format) command_events.first_frame_drawn.connect(first_frame_drawn) + define_size() + resize_texture() + + +func define_size() -> void: + width = get_viewport().size.x + height = get_viewport().size.y + + if width > MAX_RESOLUTION_WIDTH: + width = int(ui_events.current_ui_size.x) + height = int(ui_events.current_ui_size.y) + Debug.logclr("Max resolution applied", Color.DIM_GRAY) + + +func resize_texture() -> void: # Create empty texture with window size var image = Image.create(width, height, false, Image.FORMAT_RGBA8) self.texture = ImageTexture.create_from_image(image) diff --git a/app/scripts/sandbox/sandbox_manager.gd b/app/scripts/sandbox/sandbox_manager.gd index 06013fc..b2709f2 100644 --- a/app/scripts/sandbox/sandbox_manager.gd +++ b/app/scripts/sandbox/sandbox_manager.gd @@ -38,9 +38,10 @@ func start_sandbox_linux(gate: Gate) -> void: var args = [ snbx_env.start.get_base_dir(), # cd to dir "--main-pack", snbx_env.main_pack, - "--resolution", "%dx%d" % [render_result.width, render_result.height], - "--verbose" if OS.is_stdout_verbose() else "" + "--resolution", "%dx%d" % [render_result.width, render_result.height] ] + if OS.is_stdout_verbose(): args.append(["--verbose"]) + Debug.logclr(snbx_env.start + " " + " ".join(args), Color.DARK_VIOLET) sandbox_pid = OS.create_process(snbx_env.start, args) @@ -57,10 +58,11 @@ func start_sandbox_windows(gate: Gate) -> void: var shared_libs = ProjectSettings.globalize_path(gate.shared_libs_dir) var args = [ "--main-pack", pack_file, - "--gdext-libs-dir", shared_libs, - "--resolution", "%dx%d" % [render_result.width, render_result.height], - "--verbose" if OS.is_stdout_verbose() else "" + "--resolution", "%dx%d" % [render_result.width, render_result.height] ] + if not shared_libs.is_empty(): args += ["--gdext-libs-dir", shared_libs] + if OS.is_stdout_verbose(): args += ["--verbose"] + Debug.logclr(snbx_executable.path + " " + " ".join(args), Color.DARK_VIOLET) sandbox_pid = OS.create_process(snbx_executable.path, args) @@ -75,10 +77,11 @@ func start_sandbox_macos(gate: Gate) -> void: var shared_libs = ProjectSettings.globalize_path(gate.shared_libs_dir) var args = [ "--main-pack", pack_file, - "--gdext-libs-dir", shared_libs, - "--resolution", "%dx%d" % [render_result.width, render_result.height], - "--verbose" if OS.is_stdout_verbose() else "" + "--resolution", "%dx%d" % [render_result.width, render_result.height] ] + if not shared_libs.is_empty(): args += ["--gdext-libs-dir", shared_libs] + if OS.is_stdout_verbose(): args += ["--verbose"] + Debug.logclr(snbx_executable.path + " " + " ".join(args), Color.DARK_VIOLET) sandbox_pid = OS.create_process(snbx_executable.path, args) diff --git a/godot b/godot index 680d6e4..8da1c84 160000 --- a/godot +++ b/godot @@ -1 +1 @@ -Subproject commit 680d6e4ec46d37dc8fd39c53b7a83953f644c3fe +Subproject commit 8da1c840ed391e731c5480e8055fcc8367da8da0