Compare commits
No commits in common. "07aa3c846bb09fa6d03b08443489c84d5809c732" and "87508f9170c6f3f94090b116cafefae9ce0ac5f4" have entirely different histories.
07aa3c846b
...
87508f9170
8 changed files with 47 additions and 30 deletions
|
@ -41,7 +41,7 @@
|
||||||
[ext_resource type="StyleBox" uid="uid://0jfr1uwuog0s" path="res://Assets/UI/Slider/v/background.tres" id="39_dl1e4"]
|
[ext_resource type="StyleBox" uid="uid://0jfr1uwuog0s" path="res://Assets/UI/Slider/v/background.tres" id="39_dl1e4"]
|
||||||
[ext_resource type="FontFile" uid="uid://dqdeftjkwxe64" path="res://Assets/Fonts/Dogica/dogicapixel.ttf" id="40_bmcvq"]
|
[ext_resource type="FontFile" uid="uid://dqdeftjkwxe64" path="res://Assets/Fonts/Dogica/dogicapixel.ttf" id="40_bmcvq"]
|
||||||
|
|
||||||
[sub_resource type="Image" id="Image_cw2pn"]
|
[sub_resource type="Image" id="Image_kwuuq"]
|
||||||
data = {
|
data = {
|
||||||
"data": PackedByteArray(255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0),
|
"data": PackedByteArray(255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 64, 255, 255, 255, 64, 255, 255, 255, 0),
|
||||||
"format": "RGBA8",
|
"format": "RGBA8",
|
||||||
|
@ -51,7 +51,7 @@ data = {
|
||||||
}
|
}
|
||||||
|
|
||||||
[sub_resource type="ImageTexture" id="ImageTexture_g5bup"]
|
[sub_resource type="ImageTexture" id="ImageTexture_g5bup"]
|
||||||
image = SubResource("Image_cw2pn")
|
image = SubResource("Image_kwuuq")
|
||||||
|
|
||||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_sj7h5"]
|
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_sj7h5"]
|
||||||
|
|
||||||
|
|
|
@ -195,6 +195,7 @@ vertical_alignment = 1
|
||||||
|
|
||||||
[node name="MoveUpRemapButton" type="Button" parent="SettingsTabs/Controls/MarginContainer/GridContainer" node_paths=PackedStringArray("remap_controller")]
|
[node name="MoveUpRemapButton" type="Button" parent="SettingsTabs/Controls/MarginContainer/GridContainer" node_paths=PackedStringArray("remap_controller")]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
toggle_mode = true
|
||||||
script = ExtResource("2_4asaa")
|
script = ExtResource("2_4asaa")
|
||||||
input_action_name = "move_up"
|
input_action_name = "move_up"
|
||||||
remap_controller = NodePath("../../../../../Remap Controller")
|
remap_controller = NodePath("../../../../../Remap Controller")
|
||||||
|
@ -208,6 +209,7 @@ vertical_alignment = 1
|
||||||
[node name="MoveLeftRemapButton" type="Button" parent="SettingsTabs/Controls/MarginContainer/GridContainer" node_paths=PackedStringArray("remap_controller")]
|
[node name="MoveLeftRemapButton" type="Button" parent="SettingsTabs/Controls/MarginContainer/GridContainer" node_paths=PackedStringArray("remap_controller")]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
|
toggle_mode = true
|
||||||
script = ExtResource("2_4asaa")
|
script = ExtResource("2_4asaa")
|
||||||
input_action_name = "move_left"
|
input_action_name = "move_left"
|
||||||
remap_controller = NodePath("../../../../../Remap Controller")
|
remap_controller = NodePath("../../../../../Remap Controller")
|
||||||
|
@ -221,6 +223,7 @@ vertical_alignment = 1
|
||||||
[node name="MoveDownRemapButton" type="Button" parent="SettingsTabs/Controls/MarginContainer/GridContainer" node_paths=PackedStringArray("remap_controller")]
|
[node name="MoveDownRemapButton" type="Button" parent="SettingsTabs/Controls/MarginContainer/GridContainer" node_paths=PackedStringArray("remap_controller")]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
|
toggle_mode = true
|
||||||
script = ExtResource("2_4asaa")
|
script = ExtResource("2_4asaa")
|
||||||
input_action_name = "move_down"
|
input_action_name = "move_down"
|
||||||
remap_controller = NodePath("../../../../../Remap Controller")
|
remap_controller = NodePath("../../../../../Remap Controller")
|
||||||
|
@ -235,6 +238,7 @@ vertical_alignment = 1
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
focus_neighbor_bottom = NodePath("../../../../../Back Button")
|
focus_neighbor_bottom = NodePath("../../../../../Back Button")
|
||||||
|
toggle_mode = true
|
||||||
script = ExtResource("2_4asaa")
|
script = ExtResource("2_4asaa")
|
||||||
input_action_name = "move_right"
|
input_action_name = "move_right"
|
||||||
remap_controller = NodePath("../../../../../Remap Controller")
|
remap_controller = NodePath("../../../../../Remap Controller")
|
||||||
|
|
|
@ -13,10 +13,6 @@ func load_data():
|
||||||
"display_mode": 0,
|
"display_mode": 0,
|
||||||
"vsync_on": false,
|
"vsync_on": false,
|
||||||
"current_resolution_index": 0,
|
"current_resolution_index": 0,
|
||||||
"move_up": KEY_W,
|
|
||||||
"move_down": KEY_S,
|
|
||||||
"move_left": KEY_A,
|
|
||||||
"move_right": KEY_D,
|
|
||||||
"master_volume": 0,
|
"master_volume": 0,
|
||||||
"music_volume": 0,
|
"music_volume": 0,
|
||||||
"sfx_volume": 0,
|
"sfx_volume": 0,
|
||||||
|
|
|
@ -4,8 +4,6 @@ extends Node
|
||||||
@export var music_bus_index : int = 1
|
@export var music_bus_index : int = 1
|
||||||
@export var sfx_bus_index : int = 2
|
@export var sfx_bus_index : int = 2
|
||||||
|
|
||||||
@export var remappable_input_actions = ["move_up", "move_down", "move_left", "move_right"]
|
|
||||||
|
|
||||||
const resolutions_dictionary : Dictionary = {
|
const resolutions_dictionary : Dictionary = {
|
||||||
"800x600" : Vector2(800, 600),
|
"800x600" : Vector2(800, 600),
|
||||||
"1024x546" : Vector2(1024, 546),
|
"1024x546" : Vector2(1024, 546),
|
||||||
|
@ -61,19 +59,3 @@ func update_sfx_volume(vol : int) -> void:
|
||||||
Save.save_data()
|
Save.save_data()
|
||||||
AudioServer.set_bus_volume_db(sfx_bus_index, vol)
|
AudioServer.set_bus_volume_db(sfx_bus_index, vol)
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# Controls
|
|
||||||
func set_controls_from_save_file() -> void:
|
|
||||||
for remappable_input_action in remappable_input_actions:
|
|
||||||
for i in Save.game_data.keys().size():
|
|
||||||
if Save.game_data.keys()[i] == remappable_input_action:
|
|
||||||
for key in InputMap.action_get_events(remappable_input_action):
|
|
||||||
InputMap.action_erase_event(remappable_input_action, key)
|
|
||||||
var control_key = InputEventKey.new()
|
|
||||||
control_key.set_keycode(Save.game_data.values()[i])
|
|
||||||
InputMap.action_add_event(remappable_input_action, control_key)
|
|
||||||
pass
|
|
||||||
|
|
||||||
func set_control_binding(action : String, keycode : int):
|
|
||||||
print(keycode)
|
|
||||||
pass
|
|
||||||
|
|
|
@ -6,7 +6,6 @@ extends Node
|
||||||
|
|
||||||
# Engine Callbackss
|
# Engine Callbackss
|
||||||
func _ready():
|
func _ready():
|
||||||
GlobalSettings.set_controls_from_save_file()
|
|
||||||
GlobalSettings.set_display_mode(Save.game_data.display_mode)
|
GlobalSettings.set_display_mode(Save.game_data.display_mode)
|
||||||
GlobalSettings.toggle_vsync(Save.game_data.vsync_on)
|
GlobalSettings.toggle_vsync(Save.game_data.vsync_on)
|
||||||
GlobalSettings.set_resolution(Save.game_data.current_resolution_index)
|
GlobalSettings.set_resolution(Save.game_data.current_resolution_index)
|
||||||
|
|
38
Scripts/UI/MenuButton.gd
Normal file
38
Scripts/UI/MenuButton.gd
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
extends TextureButton
|
||||||
|
|
||||||
|
@export var text : String = "Sample Text"
|
||||||
|
@export var pointer_margin_from_center : int = 100
|
||||||
|
@export var leftPointer : Sprite2D
|
||||||
|
@export var rightPointer : Sprite2D
|
||||||
|
@export var textBox : RichTextLabel
|
||||||
|
|
||||||
|
# Engine Callbacks
|
||||||
|
func _ready():
|
||||||
|
textBox.parse_bbcode("[center] %s [/center]" % [text])
|
||||||
|
pass
|
||||||
|
|
||||||
|
func _process(_delta):
|
||||||
|
handle_hover_and_focus()
|
||||||
|
handle_x_position()
|
||||||
|
|
||||||
|
func handle_hover_and_focus() -> void:
|
||||||
|
if has_focus():
|
||||||
|
leftPointer.visible = true
|
||||||
|
rightPointer.visible = true
|
||||||
|
elif is_hovered():
|
||||||
|
leftPointer.visible = true
|
||||||
|
leftPointer.modulate.a = 0.5
|
||||||
|
rightPointer.visible = true
|
||||||
|
rightPointer.modulate.a = 0.5
|
||||||
|
else:
|
||||||
|
leftPointer.visible = false
|
||||||
|
leftPointer.modulate.a = 1
|
||||||
|
rightPointer.visible = false
|
||||||
|
rightPointer.modulate.a = 1
|
||||||
|
pass
|
||||||
|
|
||||||
|
func handle_x_position() -> void:
|
||||||
|
var center_x = get_parent().position.x + (get_parent().size.x / 2.0)
|
||||||
|
leftPointer.global_position.x = center_x - pointer_margin_from_center
|
||||||
|
rightPointer.global_position.x = center_x + pointer_margin_from_center
|
||||||
|
pass
|
|
@ -20,16 +20,15 @@ func start_remap(button : Button, action : String):
|
||||||
remap_action = action
|
remap_action = action
|
||||||
remap_button.text = "..."
|
remap_button.text = "..."
|
||||||
set_process_unhandled_key_input(true)
|
set_process_unhandled_key_input(true)
|
||||||
button.release_focus()
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
func remap_key(event):
|
func remap_key(event):
|
||||||
set_process_unhandled_key_input(false)
|
print(event)
|
||||||
|
# Do Actual Rebinding
|
||||||
for key in InputMap.action_get_events(remap_action):
|
for key in InputMap.action_get_events(remap_action):
|
||||||
InputMap.action_erase_event(remap_action, key)
|
InputMap.action_erase_event(remap_action, key)
|
||||||
InputMap.action_add_event(remap_action, event)
|
InputMap.action_add_event(remap_action, event)
|
||||||
Save.game_data["%s" % [remap_action]] = event.keycode
|
|
||||||
remap_button.display_key()
|
remap_button.display_key()
|
||||||
remap_button.grab_focus()
|
|
||||||
remap_button = null
|
remap_button = null
|
||||||
|
set_process_unhandled_key_input(false)
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -67,7 +67,6 @@ func add_resolution_items():
|
||||||
|
|
||||||
# Other Buttons
|
# Other Buttons
|
||||||
func _on_back_pressed():
|
func _on_back_pressed():
|
||||||
Save.save_data()
|
|
||||||
on_back.call()
|
on_back.call()
|
||||||
queue_free()
|
queue_free()
|
||||||
pass
|
pass
|
||||||
|
|
Reference in a new issue