33 lines
870 B
GDScript
33 lines
870 B
GDScript
extends Spatial
|
|
|
|
var mouse_captured : bool = false
|
|
|
|
func _ready():
|
|
randomize()
|
|
|
|
if Global.sceneguide:
|
|
var guide = load("res://mirrors/text.tscn")
|
|
add_child(guide.instance())
|
|
|
|
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_pressed("toggle_mouse"):
|
|
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)
|