test-client-godot/scenes/GUI/Settings/Settings.gd

55 lines
2.4 KiB
GDScript3
Raw Normal View History

2018-07-25 07:36:19 +00:00
extends Container
signal return_pressed
func _ready():
$Menus/TabContainer/Display/ScrollContainer/VBoxContainer/Fullscreen/CheckBox.pressed = ProjectSettings.get_setting( "display/window/size/fullscreen" )
$Menus/TabContainer/Display/ScrollContainer/VBoxContainer/Borderless/CheckBox.pressed = ProjectSettings.get_setting( "display/window/size/borderless" )
$Menus/TabContainer/Display/ScrollContainer/VBoxContainer/Resizable/CheckBox.pressed = ProjectSettings.get_setting( "display/window/size/resizable" )
$Menus/TabContainer/Display/ScrollContainer/VBoxContainer/CurrentScreen/SpinBox.value = OS.current_screen
#func _process(delta):
# # Called every frame. Delta is time since last frame.
# # Update game logic here.
# pass
func _on_ReturnButton_pressed():
emit_signal( "return_pressed" )
func _on_Title_text_changed(new_text):
# ----------------------------------
# Changing windows title
var new_title = "Khanat"
new_text = new_text.strip_edges()
if not new_text == "":
new_title = new_text
new_title += " (" + String(OS.get_window_size().x) + "x" + String(OS.get_window_size().y) + ")"
OS.set_window_title( new_title )
# ----------------------------------
func _on_Fullscreen_toggled(button_pressed):
if ProjectSettings.has_setting( "display/window/size/fullscreen" ):
ProjectSettings.set_setting("display/window/size/fullscreen", button_pressed)
OS.window_fullscreen = ProjectSettings.get_setting("display/window/size/fullscreen")
func _on_Borderless_toggled(button_pressed):
if ProjectSettings.has_setting( "display/window/size/borderless" ):
ProjectSettings.set_setting("display/window/size/borderless", button_pressed)
OS.window_borderless = ProjectSettings.get_setting("display/window/size/borderless")
func _on_Resizable_toggled(button_pressed):
if ProjectSettings.has_setting( "display/window/size/resizable" ):
ProjectSettings.set_setting("display/window/size/resizable", button_pressed)
OS.window_resizable = ProjectSettings.get_setting("display/window/size/resizable")
# La fonction existe dans la doc mais le moteur lui ne la reconnait pas,
# soit il y a une subtilité quelquepart soit la doc n'est pas à jour.
func _on_AlwaysOnTop_toggled(button_pressed):
# OS.set_window_always_on_top( button_pressed )
pass
func _on_SpinBox_value_changed(value):
OS.current_screen = value