mirror of
https://github.com/thegatesbrowser/thegates.git
synced 2025-08-22 23:17:26 -04:00
MacOS support
This commit is contained in:
parent
643f750156
commit
644a8bb969
7 changed files with 45 additions and 6 deletions
2
app/.gitignore
vendored
2
app/.gitignore
vendored
|
@ -2,4 +2,4 @@
|
||||||
.godot/
|
.godot/
|
||||||
|
|
||||||
# for ipc files (inter process communication)
|
# for ipc files (inter process communication)
|
||||||
sandbox/
|
./sandbox/
|
|
@ -8,3 +8,5 @@ linux = "sandbox/Sandbox.x86_64"
|
||||||
linux_debug = "godot.linuxbsd.template_debug.dev.sandbox.x86_64.llvm"
|
linux_debug = "godot.linuxbsd.template_debug.dev.sandbox.x86_64.llvm"
|
||||||
windows = "sandbox/Sandbox.exe"
|
windows = "sandbox/Sandbox.exe"
|
||||||
windows_debug = "godot.windows.template_debug.dev.sandbox.x86_64.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"
|
||||||
|
|
|
@ -313,6 +313,7 @@ script = ExtResource("9_ncfxj")
|
||||||
ui_events = ExtResource("9_ir58h")
|
ui_events = ExtResource("9_ir58h")
|
||||||
|
|
||||||
[node name="RenderResult" type="TextureRect" parent="HBoxContainer/WorldCanvas"]
|
[node name="RenderResult" type="TextureRect" parent="HBoxContainer/WorldCanvas"]
|
||||||
|
texture_filter = 1
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
anchors_preset = 14
|
anchors_preset = 14
|
||||||
anchor_top = 0.5
|
anchor_top = 0.5
|
||||||
|
@ -328,6 +329,7 @@ stretch_mode = 5
|
||||||
script = ExtResource("5_nlg2s")
|
script = ExtResource("5_nlg2s")
|
||||||
gate_events = ExtResource("2_q7cvi")
|
gate_events = ExtResource("2_q7cvi")
|
||||||
command_events = ExtResource("6_18mgg")
|
command_events = ExtResource("6_18mgg")
|
||||||
|
ui_events = ExtResource("9_ir58h")
|
||||||
splash_screen = ExtResource("10_23bjc")
|
splash_screen = ExtResource("10_23bjc")
|
||||||
|
|
||||||
[node name="HideOnPress" type="TextureButton" parent="HBoxContainer/WorldCanvas/RenderResult"]
|
[node name="HideOnPress" type="TextureButton" parent="HBoxContainer/WorldCanvas/RenderResult"]
|
||||||
|
|
|
@ -3,14 +3,15 @@ class_name RenderResult
|
||||||
|
|
||||||
@export var gate_events: GateEvents
|
@export var gate_events: GateEvents
|
||||||
@export var command_events: CommandEvents
|
@export var command_events: CommandEvents
|
||||||
|
@export var ui_events: UiEvents
|
||||||
@export var splash_screen: Texture2D
|
@export var splash_screen: Texture2D
|
||||||
|
|
||||||
var rd: RenderingDevice
|
var rd: RenderingDevice
|
||||||
var ext_texure: ExternalTexture
|
var ext_texure: ExternalTexture
|
||||||
var texture_rid: RID
|
var texture_rid: RID
|
||||||
|
|
||||||
@onready var width: int = get_viewport().size.x
|
@onready var width: int = int(ui_events.current_ui_size.x)
|
||||||
@onready var height: int = get_viewport().size.y
|
@onready var height: int = int(ui_events.current_ui_size.y)
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
|
|
|
@ -7,6 +7,9 @@ class_name SandboxExecutable
|
||||||
@export var windows: String
|
@export var windows: String
|
||||||
@export var windows_debug: String
|
@export var windows_debug: String
|
||||||
|
|
||||||
|
@export var macos: String
|
||||||
|
@export var macos_debug: String
|
||||||
|
|
||||||
var path: String :
|
var path: String :
|
||||||
get = get_executable_path
|
get = get_executable_path
|
||||||
|
|
||||||
|
@ -24,6 +27,8 @@ func get_filename() -> String:
|
||||||
return windows_debug if is_debug else windows
|
return windows_debug if is_debug else windows
|
||||||
Platform.LINUX_BSD:
|
Platform.LINUX_BSD:
|
||||||
return linux_debug if is_debug else linux
|
return linux_debug if is_debug else linux
|
||||||
|
Platform.MACOS:
|
||||||
|
return macos_debug if is_debug else macos
|
||||||
_:
|
_:
|
||||||
assert(false, "Platform is not supported")
|
assert(false, "Platform is not supported")
|
||||||
return ""
|
return ""
|
||||||
|
|
|
@ -21,6 +21,8 @@ func start_sandbox(gate: Gate) -> void:
|
||||||
start_sandbox_windows(gate)
|
start_sandbox_windows(gate)
|
||||||
Platform.LINUX_BSD:
|
Platform.LINUX_BSD:
|
||||||
start_sandbox_linux(gate)
|
start_sandbox_linux(gate)
|
||||||
|
Platform.MACOS:
|
||||||
|
start_sandbox_macos(gate)
|
||||||
_:
|
_:
|
||||||
assert(false, "Platform is not supported")
|
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
|
snbx_env.start.get_base_dir(), # cd to dir
|
||||||
"--main-pack", snbx_env.main_pack,
|
"--main-pack", snbx_env.main_pack,
|
||||||
"--resolution", "%dx%d" % [render_result.width, render_result.height],
|
"--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)
|
Debug.logclr(snbx_env.start + " " + " ".join(args), Color.DARK_VIOLET)
|
||||||
sandbox_pid = OS.create_process(snbx_env.start, args)
|
sandbox_pid = OS.create_process(snbx_env.start, args)
|
||||||
|
@ -56,7 +58,26 @@ func start_sandbox_windows(gate: Gate) -> void:
|
||||||
var args = [
|
var args = [
|
||||||
"--main-pack", pack_file,
|
"--main-pack", pack_file,
|
||||||
"--gdext-libs-dir", shared_libs,
|
"--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)
|
Debug.logclr(snbx_executable.path + " " + " ".join(args), Color.DARK_VIOLET)
|
||||||
sandbox_pid = OS.create_process(snbx_executable.path, args)
|
sandbox_pid = OS.create_process(snbx_executable.path, args)
|
||||||
|
@ -70,6 +91,8 @@ func kill_sandbox() -> void:
|
||||||
kill_sandbox_windows()
|
kill_sandbox_windows()
|
||||||
Platform.LINUX_BSD:
|
Platform.LINUX_BSD:
|
||||||
kill_sandbox_linux()
|
kill_sandbox_linux()
|
||||||
|
Platform.MACOS:
|
||||||
|
kill_sandbox_macos()
|
||||||
_:
|
_:
|
||||||
assert(false, "Platform is not supported")
|
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)
|
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:
|
func _exit_tree() -> void:
|
||||||
kill_sandbox()
|
kill_sandbox()
|
||||||
|
|
2
godot
2
godot
|
@ -1 +1 @@
|
||||||
Subproject commit 29d6d651a6dd28c0a132a97de65098a7a13e145c
|
Subproject commit a165561a8e7615abc82ed5d549e7788a55a44568
|
Loading…
Add table
Add a link
Reference in a new issue