From 87869f1f9c3261392151cf68710802bf721b8cf4 Mon Sep 17 00:00:00 2001 From: Nordup Date: Sat, 17 Aug 2024 23:27:35 +0400 Subject: [PATCH] allow high resolutions --- app/scripts/sandbox/render_result.gd | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/app/scripts/sandbox/render_result.gd b/app/scripts/sandbox/render_result.gd index 14b17e1..dd7bd84 100644 --- a/app/scripts/sandbox/render_result.gd +++ b/app/scripts/sandbox/render_result.gd @@ -5,14 +5,12 @@ class_name RenderResult @export var command_events: CommandEvents @export var ui_events: UiEvents -const MAX_RESOLUTION_WIDTH = 1920 # TODO: move to settings +@onready var width: int = get_viewport().size.x +@onready var height: int = get_viewport().size.y var ext_texure: ExternalTexture var texture_rid: RID -var width: int -var height: int - func _ready() -> void: gate_events.gate_entered.connect(create_external_texture) @@ -20,21 +18,6 @@ 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)