Ui Rebuild and Full Controller Support #59
3 changed files with 11 additions and 4 deletions
|
@ -7,7 +7,7 @@
|
||||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_02uod"]
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_02uod"]
|
||||||
bg_color = Color(0.439216, 0.631373, 0.537255, 1)
|
bg_color = Color(0.439216, 0.631373, 0.537255, 1)
|
||||||
|
|
||||||
[node name="SettingsMenu" type="Node" node_paths=PackedStringArray("back_button", "tab_container", "bottom_item_video", "bottom_item_audio", "bottom_item_controls", "bottom_item_controls_gamepad", "display_options_button", "vsync_toggle", "resolutions_options_button", "master_volume_slider", "music_volume_slider", "sfx_volume_slider")]
|
[node name="SettingsMenu" type="Node" node_paths=PackedStringArray("back_button", "tab_container", "bottom_item_video", "bottom_item_audio", "bottom_item_controls", "bottom_item_controls_gamepad", "remap_controller", "display_options_button", "vsync_toggle", "resolutions_options_button", "master_volume_slider", "music_volume_slider", "sfx_volume_slider")]
|
||||||
script = ExtResource("1_2rgd2")
|
script = ExtResource("1_2rgd2")
|
||||||
back_button = NodePath("Panel/MarginContainer/VBoxContainer/MarginContainer/Back Button")
|
back_button = NodePath("Panel/MarginContainer/VBoxContainer/MarginContainer/Back Button")
|
||||||
tab_container = NodePath("Panel/MarginContainer/VBoxContainer/SettingsTabs")
|
tab_container = NodePath("Panel/MarginContainer/VBoxContainer/SettingsTabs")
|
||||||
|
@ -15,6 +15,7 @@ bottom_item_video = NodePath("Panel/MarginContainer/VBoxContainer/SettingsTabs/V
|
||||||
bottom_item_audio = NodePath("Panel/MarginContainer/VBoxContainer/SettingsTabs/Audio/ScrollView/VBox/MarginContainer/GridContainer/SFXVolSlider")
|
bottom_item_audio = NodePath("Panel/MarginContainer/VBoxContainer/SettingsTabs/Audio/ScrollView/VBox/MarginContainer/GridContainer/SFXVolSlider")
|
||||||
bottom_item_controls = NodePath("Panel/MarginContainer/VBoxContainer/SettingsTabs/Controlls/ScrollView/VBox/MarginContainer/GridContainer/AttackRemapButton")
|
bottom_item_controls = NodePath("Panel/MarginContainer/VBoxContainer/SettingsTabs/Controlls/ScrollView/VBox/MarginContainer/GridContainer/AttackRemapButton")
|
||||||
bottom_item_controls_gamepad = NodePath("Panel/MarginContainer/VBoxContainer/SettingsTabs/Gamepad/ScrollView/Vbox/MarginContainer/GridContainer/AttackRemapButton")
|
bottom_item_controls_gamepad = NodePath("Panel/MarginContainer/VBoxContainer/SettingsTabs/Gamepad/ScrollView/Vbox/MarginContainer/GridContainer/AttackRemapButton")
|
||||||
|
remap_controller = NodePath("Remap Controller")
|
||||||
display_options_button = NodePath("Panel/MarginContainer/VBoxContainer/SettingsTabs/Video/ScrollView/VBox/MarginContainer/GridContainer/DisplayModeOptions")
|
display_options_button = NodePath("Panel/MarginContainer/VBoxContainer/SettingsTabs/Video/ScrollView/VBox/MarginContainer/GridContainer/DisplayModeOptions")
|
||||||
vsync_toggle = NodePath("Panel/MarginContainer/VBoxContainer/SettingsTabs/Video/ScrollView/VBox/MarginContainer/GridContainer/VsyncButton")
|
vsync_toggle = NodePath("Panel/MarginContainer/VBoxContainer/SettingsTabs/Video/ScrollView/VBox/MarginContainer/GridContainer/VsyncButton")
|
||||||
resolutions_options_button = NodePath("Panel/MarginContainer/VBoxContainer/SettingsTabs/Video/ScrollView/VBox/MarginContainer/GridContainer/ResolutionsOptions")
|
resolutions_options_button = NodePath("Panel/MarginContainer/VBoxContainer/SettingsTabs/Video/ScrollView/VBox/MarginContainer/GridContainer/ResolutionsOptions")
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
extends Control
|
extends Control
|
||||||
|
class_name RemapController
|
||||||
|
|
||||||
@export var min_time_between_remaps := 0.4
|
@export var min_time_between_remaps := 0.4
|
||||||
|
|
||||||
|
@ -6,6 +7,7 @@ var remap_button : Button
|
||||||
var remap_action : String
|
var remap_action : String
|
||||||
|
|
||||||
var time_since_remap := 0.0
|
var time_since_remap := 0.0
|
||||||
|
var is_remapping := false
|
||||||
|
|
||||||
func _unhandled_key_input(event):
|
func _unhandled_key_input(event):
|
||||||
if remap_button != null and event.pressed:
|
if remap_button != null and event.pressed:
|
||||||
|
@ -17,7 +19,6 @@ func _input(event):
|
||||||
if event is InputEventMouseButton and event.pressed:
|
if event is InputEventMouseButton and event.pressed:
|
||||||
remap_key(event)
|
remap_key(event)
|
||||||
if event is InputEventJoypadButton and event.pressed:
|
if event is InputEventJoypadButton and event.pressed:
|
||||||
print(event)
|
|
||||||
remap_key(event)
|
remap_key(event)
|
||||||
if event is InputEventJoypadMotion:
|
if event is InputEventJoypadMotion:
|
||||||
remap_key(event)
|
remap_key(event)
|
||||||
|
@ -31,10 +32,13 @@ func _ready():
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
if remap_button == null:
|
if remap_button == null:
|
||||||
time_since_remap += delta
|
time_since_remap += delta
|
||||||
|
if is_remapping and time_since_remap > min_time_between_remaps:
|
||||||
|
is_remapping = false
|
||||||
pass
|
pass
|
||||||
|
|
||||||
func start_remap(button : Button, action : String):
|
func start_remap(button : Button, action : String):
|
||||||
if(time_since_remap < min_time_between_remaps): return
|
if(is_remapping): return
|
||||||
|
is_remapping = true
|
||||||
if(remap_button != null):
|
if(remap_button != null):
|
||||||
remap_button.display_key()
|
remap_button.display_key()
|
||||||
remap_button = button
|
remap_button = button
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
extends Node
|
extends Node
|
||||||
|
|
||||||
# Video Settings UI References
|
|
||||||
@export var back_button : Control
|
@export var back_button : Control
|
||||||
@export var tab_container : TabContainer
|
@export var tab_container : TabContainer
|
||||||
@export var bottom_item_video : Control
|
@export var bottom_item_video : Control
|
||||||
|
@ -8,6 +7,8 @@ extends Node
|
||||||
@export var bottom_item_controls : Control
|
@export var bottom_item_controls : Control
|
||||||
@export var bottom_item_controls_gamepad : Control
|
@export var bottom_item_controls_gamepad : Control
|
||||||
|
|
||||||
|
@export var remap_controller : RemapController
|
||||||
|
|
||||||
@export var display_options_button : OptionButton
|
@export var display_options_button : OptionButton
|
||||||
@export var vsync_toggle : CheckButton
|
@export var vsync_toggle : CheckButton
|
||||||
@export var resolutions_options_button : OptionButton
|
@export var resolutions_options_button : OptionButton
|
||||||
|
@ -45,6 +46,7 @@ func _process(_delta):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
func update_change_tab():
|
func update_change_tab():
|
||||||
|
if(remap_controller.is_remapping): return
|
||||||
var do_left = Input.is_action_just_pressed("ui_tab_left")
|
var do_left = Input.is_action_just_pressed("ui_tab_left")
|
||||||
var do_right = Input.is_action_just_pressed("ui_tab_right")
|
var do_right = Input.is_action_just_pressed("ui_tab_right")
|
||||||
|
|
||||||
|
|
Reference in a new issue