mirror of
https://github.com/thegatesbrowser/thegates.git
synced 2025-08-23 08:17:34 -04:00
MacOS support
This commit is contained in:
parent
643f750156
commit
644a8bb969
7 changed files with 45 additions and 6 deletions
|
@ -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:
|
||||
|
|
|
@ -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 ""
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue