Add some UI
This commit is contained in:
@@ -2,9 +2,15 @@ class_name SettingsMenu extends Control
|
||||
|
||||
@export var tabs:TabBar
|
||||
@export var tabControls:Array[Control]
|
||||
@export var checkInvertX:CheckBox
|
||||
@export var checkInvertY:CheckBox
|
||||
|
||||
func _ready() -> void:
|
||||
tabs.tab_changed.connect(onTabChanged)
|
||||
checkInvertX.button_pressed = SETTINGS.invertCameraX
|
||||
checkInvertY.button_pressed = SETTINGS.invertCameraY
|
||||
checkInvertX.toggled.connect(func(v:bool): SETTINGS.invertCameraX = v)
|
||||
checkInvertY.toggled.connect(func(v:bool): SETTINGS.invertCameraY = v)
|
||||
onTabChanged(tabs.current_tab)
|
||||
|
||||
func _notification(what:int) -> void:
|
||||
@@ -16,3 +22,10 @@ func onTabChanged(tabIndex:int) -> void:
|
||||
control.visible = false
|
||||
if tabIndex >= 0 and tabIndex < tabControls.size():
|
||||
tabControls[tabIndex].visible = true
|
||||
_focusFirstIn(tabControls[tabIndex])
|
||||
|
||||
func _focusFirstIn(container:Control) -> void:
|
||||
for child in container.get_children():
|
||||
if child is Control and child.focus_mode != Control.FOCUS_NONE:
|
||||
child.grab_focus()
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user