midori-school/levels/ui/settings.gd

92 lines
2.3 KiB
GDScript3
Raw Normal View History

2024-09-26 02:43:45 +02:00
extends Control
const gamepadtest = preload("res://gamepad.gd")
var vsync
var fullscreen
var xw
var gldrv
func _ready():
vsync = $VBoxContainer/L20
fullscreen = $VBoxContainer/Lilytest
xw = $VBoxContainer/Dialogtest
gldrv = $VBoxContainer/Bullethell
#Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN)
$VBoxContainer/L20.grab_focus()
2024-11-04 00:29:58 +01:00
if OS.is_vsync_enabled():
2024-09-26 02:43:45 +02:00
vsync.set_text(tr("SETTING_VSYNCT"))
else:
vsync.set_text(tr("SETTING_VSYNCF"))
2024-11-04 00:29:58 +01:00
if OS.is_window_fullscreen():
2024-09-26 02:43:45 +02:00
fullscreen.set_text(tr("SETTING_FULLSCREEN"))
else:
fullscreen.set_text(tr("SETTING_WINDOWED"))
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass
func _level():
# This is like autoloading the scene, only
# it happens after already loading the main scene.
2024-11-04 00:29:58 +01:00
get_tree().change_scene("res://backgounds/disclaimer.tscn")
2024-09-26 02:43:45 +02:00
#Global.live = 1
#Global.gamelevel = randi() % 3
#if Global.gamelevel == 0:
2024-11-04 00:29:58 +01:00
# get_tree().change_scene("res://backgounds/galaxy.tscn")
2024-09-26 02:43:45 +02:00
#elif Global.gamelevel == 1:
2024-11-04 00:29:58 +01:00
# get_tree().change_scene("res://backgounds/wormhole.tscn")
2024-09-26 02:43:45 +02:00
#else:
2024-11-04 00:29:58 +01:00
# get_tree().change_scene("res://backgounds/abstract.tscn")
2024-09-26 02:43:45 +02:00
#get_tree().root.add_child(title)
#get_tree().root.remove_child(boot)
#boot.queue_free()
func _input(event):
gamepadtest.new(event)
# Mouse in viewport coordinates.
if Input.is_action_just_pressed("ui_cancel"):
_on_back_pressed()
#print("Mouse Click/Unclick at: ", event.position)
# if highlighted == 1:
# _on_debug_pressed()
# if highlighted == 2:
# _on_exit_pressed()
# else:
# _on_start_pressed()
# elif Input.is_action_pressed("ui_up"):
# focus_next
func _on_back_pressed():
2024-11-04 00:29:58 +01:00
get_tree().change_scene("res://levels/ui/tmenu.tscn")
2024-09-26 02:43:45 +02:00
func _on_l_20_pressed():
2024-11-04 00:29:58 +01:00
if OS.is_vsync_enabled():
OS.set_use_vsync(false)
2024-09-26 02:43:45 +02:00
vsync.set_text(tr("SETTING_VSYNCF"))
else:
2024-11-04 00:29:58 +01:00
OS.set_use_vsync(true)
2024-09-26 02:43:45 +02:00
vsync.set_text(tr("SETTING_VSYNCT"))
func _on_lilytest_pressed() -> void:
2024-11-04 00:29:58 +01:00
if OS.is_window_fullscreen():
OS.set_window_fullscreen(false)
2024-09-26 02:43:45 +02:00
fullscreen.set_text(tr("SETTING_WINDOWED"))
else:
2024-11-04 00:29:58 +01:00
OS.set_window_fullscreen(true)
2024-09-26 02:43:45 +02:00
fullscreen.set_text(tr("SETTING_FULLSCREEN"))
func _on_dialogtest_pressed() -> void:
2024-11-04 00:29:58 +01:00
get_tree().change_scene("res://levels/ui/debug.tscn")
2024-09-26 02:43:45 +02:00
func _on_bullethell_pressed() -> void:
2024-11-04 00:29:58 +01:00
get_tree().change_scene("res://levels/ui/savefile.tscn")