diff --git a/app/.gitignore b/app/.gitignore index f1b281c..70bf677 100644 --- a/app/.gitignore +++ b/app/.gitignore @@ -2,4 +2,4 @@ .godot/ # for ipc files (inter process communication) -sandbox/ \ No newline at end of file +./sandbox/ \ No newline at end of file diff --git a/app/resources/sandbox_executable.tres b/app/resources/sandbox_executable.tres index 9aca2d2..324b0b3 100644 --- a/app/resources/sandbox_executable.tres +++ b/app/resources/sandbox_executable.tres @@ -8,3 +8,5 @@ linux = "sandbox/Sandbox.x86_64" linux_debug = "godot.linuxbsd.template_debug.dev.sandbox.x86_64.llvm" windows = "sandbox/Sandbox.exe" windows_debug = "godot.windows.template_debug.dev.sandbox.x86_64.exe" +macos = "sandbox/Sandbox.arm64" +macos_debug = "godot.macos.template_debug.dev.sandbox.arm64" diff --git a/app/scenes/menu_body/world.tscn b/app/scenes/menu_body/world.tscn index 6f84ea8..ad285ef 100644 --- a/app/scenes/menu_body/world.tscn +++ b/app/scenes/menu_body/world.tscn @@ -313,6 +313,7 @@ script = ExtResource("9_ncfxj") ui_events = ExtResource("9_ir58h") [node name="RenderResult" type="TextureRect" parent="HBoxContainer/WorldCanvas"] +texture_filter = 1 layout_mode = 1 anchors_preset = 14 anchor_top = 0.5 @@ -328,6 +329,7 @@ stretch_mode = 5 script = ExtResource("5_nlg2s") gate_events = ExtResource("2_q7cvi") command_events = ExtResource("6_18mgg") +ui_events = ExtResource("9_ir58h") splash_screen = ExtResource("10_23bjc") [node name="HideOnPress" type="TextureButton" parent="HBoxContainer/WorldCanvas/RenderResult"] diff --git a/app/scripts/sandbox/render_result.gd b/app/scripts/sandbox/render_result.gd index 349829d..f0737f9 100644 --- a/app/scripts/sandbox/render_result.gd +++ b/app/scripts/sandbox/render_result.gd @@ -3,14 +3,15 @@ class_name RenderResult @export var gate_events: GateEvents @export var command_events: CommandEvents +@export var ui_events: UiEvents @export var splash_screen: Texture2D var rd: RenderingDevice var ext_texure: ExternalTexture var texture_rid: RID -@onready var width: int = get_viewport().size.x -@onready var height: int = get_viewport().size.y +@onready var width: int = int(ui_events.current_ui_size.x) +@onready var height: int = int(ui_events.current_ui_size.y) func _ready() -> void: diff --git a/app/scripts/sandbox/sandbox_executable.gd b/app/scripts/sandbox/sandbox_executable.gd index 25e1c81..7589cde 100644 --- a/app/scripts/sandbox/sandbox_executable.gd +++ b/app/scripts/sandbox/sandbox_executable.gd @@ -7,6 +7,9 @@ class_name SandboxExecutable @export var windows: String @export var windows_debug: String +@export var macos: String +@export var macos_debug: String + var path: String : get = get_executable_path @@ -24,6 +27,8 @@ func get_filename() -> String: return windows_debug if is_debug else windows Platform.LINUX_BSD: return linux_debug if is_debug else linux + Platform.MACOS: + return macos_debug if is_debug else macos _: assert(false, "Platform is not supported") return "" diff --git a/app/scripts/sandbox/sandbox_manager.gd b/app/scripts/sandbox/sandbox_manager.gd index 85695f8..06013fc 100644 --- a/app/scripts/sandbox/sandbox_manager.gd +++ b/app/scripts/sandbox/sandbox_manager.gd @@ -21,6 +21,8 @@ func start_sandbox(gate: Gate) -> void: start_sandbox_windows(gate) Platform.LINUX_BSD: start_sandbox_linux(gate) + Platform.MACOS: + start_sandbox_macos(gate) _: assert(false, "Platform is not supported") @@ -37,7 +39,7 @@ func start_sandbox_linux(gate: Gate) -> void: 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" + "--verbose" if OS.is_stdout_verbose() else "" ] Debug.logclr(snbx_env.start + " " + " ".join(args), Color.DARK_VIOLET) sandbox_pid = OS.create_process(snbx_env.start, args) @@ -56,7 +58,26 @@ func start_sandbox_windows(gate: Gate) -> void: var args = [ "--main-pack", pack_file, "--gdext-libs-dir", shared_libs, - "--resolution", "%dx%d" % [render_result.width, render_result.height] + "--resolution", "%dx%d" % [render_result.width, render_result.height], + "--verbose" if OS.is_stdout_verbose() else "" + ] + Debug.logclr(snbx_executable.path + " " + " ".join(args), Color.DARK_VIOLET) + sandbox_pid = OS.create_process(snbx_executable.path, args) + + gate_events.gate_entered_emit() + + +func start_sandbox_macos(gate: Gate) -> void: + if not snbx_executable.exists(): + Debug.logerr("Sandbox executable not found at " + snbx_executable.path); return + + var pack_file = ProjectSettings.globalize_path(gate.resource_pack) + 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 "" ] Debug.logclr(snbx_executable.path + " " + " ".join(args), Color.DARK_VIOLET) sandbox_pid = OS.create_process(snbx_executable.path, args) @@ -70,6 +91,8 @@ func kill_sandbox() -> void: kill_sandbox_windows() Platform.LINUX_BSD: kill_sandbox_linux() + Platform.MACOS: + kill_sandbox_macos() _: assert(false, "Platform is not supported") @@ -93,5 +116,11 @@ func kill_sandbox_windows() -> void: Debug.logclr("Process killed " + str(sandbox_pid), Color.DIM_GRAY) +func kill_sandbox_macos() -> void: + if OS.is_process_running(sandbox_pid): + OS.kill(sandbox_pid) + Debug.logclr("Process killed " + str(sandbox_pid), Color.DIM_GRAY) + + func _exit_tree() -> void: kill_sandbox() diff --git a/godot b/godot index 29d6d65..a165561 160000 --- a/godot +++ b/godot @@ -1 +1 @@ -Subproject commit 29d6d651a6dd28c0a132a97de65098a7a13e145c +Subproject commit a165561a8e7615abc82ed5d549e7788a55a44568