aboutsummaryrefslogtreecommitdiff
path: root/client/gui/overlays/controls_visualization/keyboard
diff options
context:
space:
mode:
authortpart <tpart120@proton.me>2025-09-29 22:50:44 +0200
committertpart <tpart120@proton.me>2025-09-29 22:50:50 +0200
commitc1e826625f3ca3116d482b27e2f0b230cbd55346 (patch)
tree7ad7b96afc3b88574a7d000a5ca615e9eff91083 /client/gui/overlays/controls_visualization/keyboard
parent0c8f9abfd586964c0f04a0a81989ae2d3dbfebdb (diff)
downloadhurrycurry-c1e826625f3ca3116d482b27e2f0b230cbd55346.tar
hurrycurry-c1e826625f3ca3116d482b27e2f0b230cbd55346.tar.bz2
hurrycurry-c1e826625f3ca3116d482b27e2f0b230cbd55346.tar.zst
Add new controls explanation (Closes #427)
Diffstat (limited to 'client/gui/overlays/controls_visualization/keyboard')
-rw-r--r--client/gui/overlays/controls_visualization/keyboard/keyboard_button.tscn33
-rw-r--r--client/gui/overlays/controls_visualization/keyboard/keyboard_explanation.gd46
-rw-r--r--client/gui/overlays/controls_visualization/keyboard/keyboard_explanation.gd.uid1
-rw-r--r--client/gui/overlays/controls_visualization/keyboard/keyboard_explanation.tscn249
4 files changed, 329 insertions, 0 deletions
diff --git a/client/gui/overlays/controls_visualization/keyboard/keyboard_button.tscn b/client/gui/overlays/controls_visualization/keyboard/keyboard_button.tscn
new file mode 100644
index 00000000..e4462464
--- /dev/null
+++ b/client/gui/overlays/controls_visualization/keyboard/keyboard_button.tscn
@@ -0,0 +1,33 @@
+[gd_scene load_steps=2 format=3 uid="uid://dj7tqrgpdja42"]
+
+[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_ilwpo"]
+content_margin_left = 5.0
+content_margin_top = 5.0
+content_margin_right = 5.0
+content_margin_bottom = 5.0
+bg_color = Color(0.9, 0.9, 0.9, 1)
+border_width_left = 4
+border_width_top = 4
+border_width_right = 4
+border_width_bottom = 4
+border_color = Color(0.15, 0.15, 0.15, 1)
+corner_radius_top_left = 15
+corner_radius_top_right = 15
+corner_radius_bottom_right = 15
+corner_radius_bottom_left = 15
+shadow_size = 3
+
+[node name="KeyboardButton" type="Button"]
+custom_minimum_size = Vector2(75, 75)
+offset_right = 8.0
+offset_bottom = 8.0
+size_flags_horizontal = 0
+size_flags_vertical = 0
+focus_mode = 0
+theme_override_colors/font_color = Color(0, 0, 0, 1)
+theme_override_colors/font_disabled_color = Color(0, 0, 0, 1)
+theme_override_font_sizes/font_size = 36
+theme_override_styles/normal = SubResource("StyleBoxFlat_ilwpo")
+theme_override_styles/disabled = SubResource("StyleBoxFlat_ilwpo")
+disabled = true
+text = "A"
diff --git a/client/gui/overlays/controls_visualization/keyboard/keyboard_explanation.gd b/client/gui/overlays/controls_visualization/keyboard/keyboard_explanation.gd
new file mode 100644
index 00000000..5d6dfb42
--- /dev/null
+++ b/client/gui/overlays/controls_visualization/keyboard/keyboard_explanation.gd
@@ -0,0 +1,46 @@
+# Hurry Curry! - a game about cooking
+# Copyright (C) 2025 Hurry Curry! contributors
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, version 3 of the License only.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+#
+class_name KeyboardExplanation
+extends DeviceExplanation
+
+const MODULATE_SPEED := 5.
+
+var double_handed := false
+
+@onready var j: Node2D = $VBoxContainer/Control2/JKL/J
+@onready var l: Node2D = $VBoxContainer/Control2/JKL/L
+
+@onready var left_hand_label: Label = $VBoxContainer/Control2/JKL/LeftHand/Label
+@onready var right_hand: Node2D = $VBoxContainer/Control2/JKL/RightHand
+@onready var right_arrow: Sprite2D = $VBoxContainer/Control2/JKL/Sprite2D2
+
+func toggle_double_handed(val: bool) -> void:
+ double_handed = val
+ right_hand.visible = val
+ right_arrow.visible = val
+ l.visible = val
+ left_hand_label.text = tr("c.controls_explanation.interact_left") if val else tr("c.settings.input.interact")
+
+var t := 0.
+func _process(delta: float) -> void:
+ if not double_handed: return
+
+ t += delta
+ var weight: float = (cos(t * MODULATE_SPEED) - 1.) * -0.5
+ for i: Node2D in [j,l]:
+ i.modulate = Color.WHITE.lerp(Color("ffcd59ff"), weight)
+ var size_ := lerpf(1, 1.2, weight)
+ i.scale = Vector2(size_, size_)
diff --git a/client/gui/overlays/controls_visualization/keyboard/keyboard_explanation.gd.uid b/client/gui/overlays/controls_visualization/keyboard/keyboard_explanation.gd.uid
new file mode 100644
index 00000000..0d383385
--- /dev/null
+++ b/client/gui/overlays/controls_visualization/keyboard/keyboard_explanation.gd.uid
@@ -0,0 +1 @@
+uid://dekpmw0i03eyi
diff --git a/client/gui/overlays/controls_visualization/keyboard/keyboard_explanation.tscn b/client/gui/overlays/controls_visualization/keyboard/keyboard_explanation.tscn
new file mode 100644
index 00000000..54001686
--- /dev/null
+++ b/client/gui/overlays/controls_visualization/keyboard/keyboard_explanation.tscn
@@ -0,0 +1,249 @@
+[gd_scene load_steps=5 format=3 uid="uid://wwj1ow1f437s"]
+
+[ext_resource type="Script" uid="uid://dekpmw0i03eyi" path="res://gui/overlays/controls_visualization/keyboard/keyboard_explanation.gd" id="1_ubxjd"]
+[ext_resource type="PackedScene" uid="uid://dj7tqrgpdja42" path="res://gui/overlays/controls_visualization/keyboard/keyboard_button.tscn" id="2_8nrgi"]
+[ext_resource type="FontVariation" uid="uid://cl6m4hqsnrpav" path="res://gui/resources/fonts/sansita-swashed-bold.tres" id="3_nvtkh"]
+[ext_resource type="Texture2D" uid="uid://cf8hrxilqe2ih" path="res://gui/overlays/controls_visualization/arrow.svg" id="4_mjakv"]
+
+[node name="KeyboardExplanation" type="Control"]
+custom_minimum_size = Vector2(0, 450)
+layout_mode = 3
+anchors_preset = 15
+anchor_right = 1.0
+anchor_bottom = 1.0
+grow_horizontal = 2
+grow_vertical = 2
+script = ExtResource("1_ubxjd")
+
+[node name="VBoxContainer" type="HBoxContainer" parent="."]
+layout_mode = 1
+anchors_preset = 15
+anchor_right = 1.0
+anchor_bottom = 1.0
+grow_horizontal = 2
+grow_vertical = 2
+
+[node name="Control" type="Control" parent="VBoxContainer"]
+custom_minimum_size = Vector2(400, 375)
+layout_mode = 2
+size_flags_vertical = 4
+
+[node name="WASD" type="Node2D" parent="VBoxContainer/Control"]
+
+[node name="Node2D" type="Node2D" parent="VBoxContainer/Control/WASD"]
+position = Vector2(200, 100)
+
+[node name="KeyboardButton" parent="VBoxContainer/Control/WASD/Node2D" instance=ExtResource("2_8nrgi")]
+anchors_preset = 8
+anchor_left = 0.5
+anchor_top = 0.5
+anchor_right = 0.5
+anchor_bottom = 0.5
+offset_left = -24.0
+offset_top = -24.5
+offset_right = 24.0
+offset_bottom = 24.5
+grow_horizontal = 2
+grow_vertical = 2
+text = "W"
+
+[node name="Node2D2" type="Node2D" parent="VBoxContainer/Control/WASD"]
+position = Vector2(200, 175)
+
+[node name="KeyboardButton" parent="VBoxContainer/Control/WASD/Node2D2" instance=ExtResource("2_8nrgi")]
+anchors_preset = 8
+anchor_left = 0.5
+anchor_top = 0.5
+anchor_right = 0.5
+anchor_bottom = 0.5
+offset_left = -24.0
+offset_top = -24.5
+offset_right = 24.0
+offset_bottom = 24.5
+grow_horizontal = 2
+grow_vertical = 2
+text = "S"
+
+[node name="Node2D3" type="Node2D" parent="VBoxContainer/Control/WASD"]
+position = Vector2(125, 175)
+
+[node name="KeyboardButton" parent="VBoxContainer/Control/WASD/Node2D3" instance=ExtResource("2_8nrgi")]
+anchors_preset = 8
+anchor_left = 0.5
+anchor_top = 0.5
+anchor_right = 0.5
+anchor_bottom = 0.5
+offset_left = -24.0
+offset_top = -24.5
+offset_right = 24.0
+offset_bottom = 24.5
+grow_horizontal = 2
+grow_vertical = 2
+
+[node name="Node2D4" type="Node2D" parent="VBoxContainer/Control/WASD"]
+position = Vector2(275, 175)
+
+[node name="KeyboardButton" parent="VBoxContainer/Control/WASD/Node2D4" instance=ExtResource("2_8nrgi")]
+anchors_preset = 8
+anchor_left = 0.5
+anchor_top = 0.5
+anchor_right = 0.5
+anchor_bottom = 0.5
+offset_left = -24.0
+offset_top = -24.5
+offset_right = 24.0
+offset_bottom = 24.5
+grow_horizontal = 2
+grow_vertical = 2
+text = "D"
+
+[node name="Node2D5" type="Node2D" parent="VBoxContainer/Control/WASD"]
+position = Vector2(200, 275)
+
+[node name="Label" type="Label" parent="VBoxContainer/Control/WASD/Node2D5"]
+anchors_preset = 8
+anchor_left = 0.5
+anchor_top = 0.5
+anchor_right = 0.5
+anchor_bottom = 0.5
+offset_left = -21.5
+offset_top = -11.5
+offset_right = 21.5
+offset_bottom = 11.5
+grow_horizontal = 2
+grow_vertical = 2
+theme_override_fonts/font = ExtResource("3_nvtkh")
+theme_override_font_sizes/font_size = 40
+text = "c.controls_explanation.move"
+
+[node name="Spacer" type="Control" parent="VBoxContainer"]
+layout_mode = 2
+size_flags_horizontal = 3
+
+[node name="Control2" type="Control" parent="VBoxContainer"]
+custom_minimum_size = Vector2(750, 450)
+layout_mode = 2
+size_flags_vertical = 4
+
+[node name="JKL" type="Node2D" parent="VBoxContainer/Control2"]
+position = Vector2(150, 0)
+
+[node name="K" type="Node2D" parent="VBoxContainer/Control2/JKL"]
+position = Vector2(200, 175)
+
+[node name="KeyboardButton" parent="VBoxContainer/Control2/JKL/K" instance=ExtResource("2_8nrgi")]
+anchors_preset = 8
+anchor_left = 0.5
+anchor_top = 0.5
+anchor_right = 0.5
+anchor_bottom = 0.5
+offset_left = -24.0
+offset_top = -24.5
+offset_right = 24.0
+offset_bottom = 24.5
+grow_horizontal = 2
+grow_vertical = 2
+text = "K"
+
+[node name="J" type="Node2D" parent="VBoxContainer/Control2/JKL"]
+position = Vector2(125, 175)
+
+[node name="KeyboardButton" parent="VBoxContainer/Control2/JKL/J" instance=ExtResource("2_8nrgi")]
+anchors_preset = 8
+anchor_left = 0.5
+anchor_top = 0.5
+anchor_right = 0.5
+anchor_bottom = 0.5
+offset_left = -24.0
+offset_top = -24.5
+offset_right = 24.0
+offset_bottom = 24.5
+grow_horizontal = 2
+grow_vertical = 2
+text = "J"
+
+[node name="L" type="Node2D" parent="VBoxContainer/Control2/JKL"]
+position = Vector2(275, 175)
+
+[node name="KeyboardButton" parent="VBoxContainer/Control2/JKL/L" instance=ExtResource("2_8nrgi")]
+anchors_preset = 8
+anchor_left = 0.5
+anchor_top = 0.5
+anchor_right = 0.5
+anchor_bottom = 0.5
+offset_left = -24.0
+offset_top = -24.5
+offset_right = 24.0
+offset_bottom = 24.5
+grow_horizontal = 2
+grow_vertical = 2
+text = "L"
+
+[node name="LeftHand" type="Node2D" parent="VBoxContainer/Control2/JKL"]
+position = Vector2(25, 375)
+
+[node name="Label" type="Label" parent="VBoxContainer/Control2/JKL/LeftHand"]
+anchors_preset = 8
+anchor_left = 0.5
+anchor_top = 0.5
+anchor_right = 0.5
+anchor_bottom = 0.5
+offset_left = -21.5
+offset_top = -11.5
+offset_right = 21.5
+offset_bottom = 11.5
+grow_horizontal = 2
+grow_vertical = 2
+theme_override_fonts/font = ExtResource("3_nvtkh")
+theme_override_font_sizes/font_size = 40
+text = "c.controls_explanation.interact_left"
+
+[node name="RightHand" type="Node2D" parent="VBoxContainer/Control2/JKL"]
+position = Vector2(375, 375)
+
+[node name="Label" type="Label" parent="VBoxContainer/Control2/JKL/RightHand"]
+anchors_preset = 8
+anchor_left = 0.5
+anchor_top = 0.5
+anchor_right = 0.5
+anchor_bottom = 0.5
+offset_left = -21.5
+offset_top = -11.5
+offset_right = 21.5
+offset_bottom = 11.5
+grow_horizontal = 2
+grow_vertical = 2
+theme_override_fonts/font = ExtResource("3_nvtkh")
+theme_override_font_sizes/font_size = 40
+text = "c.controls_explanation.interact_right"
+
+[node name="Boost" type="Node2D" parent="VBoxContainer/Control2/JKL"]
+position = Vector2(335, 65)
+
+[node name="Label" type="Label" parent="VBoxContainer/Control2/JKL/Boost"]
+anchors_preset = 4
+anchor_top = 0.5
+anchor_bottom = 0.5
+offset_top = -29.0
+offset_right = 113.0
+offset_bottom = 20.0
+grow_vertical = 2
+theme_override_fonts/font = ExtResource("3_nvtkh")
+theme_override_font_sizes/font_size = 40
+text = "c.controls_explanation.boost"
+
+[node name="Sprite2D" type="Sprite2D" parent="VBoxContainer/Control2/JKL"]
+position = Vector2(50, 275)
+scale = Vector2(0.5, 0.5)
+texture = ExtResource("4_mjakv")
+
+[node name="Sprite2D2" type="Sprite2D" parent="VBoxContainer/Control2/JKL"]
+position = Vector2(350, 275)
+scale = Vector2(-0.5, 0.5)
+texture = ExtResource("4_mjakv")
+
+[node name="Sprite2D3" type="Sprite2D" parent="VBoxContainer/Control2/JKL"]
+position = Vector2(250, 90)
+rotation = -1.5707964
+scale = Vector2(-0.5, 0.5)
+texture = ExtResource("4_mjakv")