add new options screen to main menu and pause screen

This commit is contained in:
Haze Weathers 2024-02-27 20:57:14 -05:00
parent 9333d5a61f
commit 24f763d3f6
10 changed files with 94 additions and 7 deletions

View file

@ -1,6 +1,13 @@
extends Control
signal exit
# if true, options screen can not exit
var can_exit: bool = true
onready var tabs: TabContainer = $"%Tabs"
onready var select_tab: HBoxContainer = $"%SelectTab"
# options nodes
@ -18,15 +25,22 @@ onready var sound_vol: HSlider = $"%SelectSoundVol"
onready var landing_sound: HBoxContainer = $"%SelectLandingSound"
func _ready() -> void:
get_scene_instance_load_placeholder()
_init_values()
yield(get_tree(), "idle_frame")
func focus() -> void:
select_tab.selection = 0
$"%SelectTab".grab_focus()
_on_tab_selected(0)
func _input(event: InputEvent) -> void:
func _unhandled_input(event: InputEvent) -> void:
Options.save_options()
if can_exit and event.is_action_pressed("ui_cancel"):
emit_signal("exit")
func _init_values() -> void:
@ -46,6 +60,7 @@ func _init_values() -> void:
sound_vol.value = Options.sound_volume * 100.0
landing_sound.selection = 1 if Options.landing_sound else 0
func _on_tab_selected(selection: int) -> void:
tabs.current_tab = selection
var tab = tabs.get_current_tab_control()