sand-receive/mirrors/assets/scripts/OnReadyWorld.gd
2023-10-29 04:41:25 +09:00

38 lines
1.1 KiB
GDScript

extends Spatial
var mouse_captured : bool = false
func _ready():
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
mouse_captured = true
OS.set_window_title("Mirrors")
var portals = get_tree().get_nodes_in_group("portals")
for p in portals:
var o = p.get_node('osc')
var pre = ceil(rand_range(0, 23))
o.set_preset(pre)
func _process(delta):
var current_res = OS.get_screen_size()
ProjectSettings.set("display/window/size/width", current_res.x)
ProjectSettings.set("display/window/size/height", current_res.y)
if Input.is_action_just_released("reload_scene"):
get_tree().reload_current_scene()
if Input.is_action_just_released("fullscreen_toggle"):
OS.window_fullscreen = !OS.window_fullscreen
if !OS.window_fullscreen:
OS.window_maximized = true
if Input.is_action_just_released("toggle_help"):
$ControlsUI.visible = !$ControlsUI.visible
if Input.is_action_just_pressed("mouse_toggle"):
if mouse_captured:
mouse_captured = false
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
else:
mouse_captured = true
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)