aboutsummaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authortpart <tpart120@proton.me>2024-07-21 17:49:57 +0200
committertpart <tpart120@proton.me>2024-07-21 17:50:02 +0200
commit7a69ab85eb775c7e1461a6ebf883a0b0c7f783a4 (patch)
treea2d90f58ed79c6506bdd61158fbced96dbda10c9 /client
parent599e7d548dabf363848d91056a71ae3ba2bcdfe9 (diff)
downloadhurrycurry-7a69ab85eb775c7e1461a6ebf883a0b0c7f783a4.tar
hurrycurry-7a69ab85eb775c7e1461a6ebf883a0b0c7f783a4.tar.bz2
hurrycurry-7a69ab85eb775c7e1461a6ebf883a0b0c7f783a4.tar.zst
Add support for controller scrolling
Diffstat (limited to 'client')
-rw-r--r--client/menu/book/book.tscn4
-rw-r--r--client/menu/scroll_container_custom.gd24
-rw-r--r--client/menu/settings.tscn4
-rw-r--r--client/menu/setup.tscn4
-rw-r--r--client/project.godot10
5 files changed, 43 insertions, 3 deletions
diff --git a/client/menu/book/book.tscn b/client/menu/book/book.tscn
index a23977d4..824c062d 100644
--- a/client/menu/book/book.tscn
+++ b/client/menu/book/book.tscn
@@ -1,6 +1,7 @@
-[gd_scene load_steps=2 format=3 uid="uid://bdggwo8un3mys"]
+[gd_scene load_steps=3 format=3 uid="uid://bdggwo8un3mys"]
[ext_resource type="Script" path="res://menu/book/book.gd" id="1_gyisx"]
+[ext_resource type="Script" path="res://menu/scroll_container_custom.gd" id="2_0d0p0"]
[node name="Book" type="Control"]
layout_mode = 3
@@ -19,6 +20,7 @@ anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
+script = ExtResource("2_0d0p0")
[node name="VBoxContainer" type="VBoxContainer" parent="ScrollContainer"]
layout_mode = 2
diff --git a/client/menu/scroll_container_custom.gd b/client/menu/scroll_container_custom.gd
new file mode 100644
index 00000000..b8b25652
--- /dev/null
+++ b/client/menu/scroll_container_custom.gd
@@ -0,0 +1,24 @@
+# Hurry Curry! - a game about cooking
+# Copyright 2024 tpart
+#
+# 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/>.
+#
+extends ScrollContainer
+class_name ScrollContainerCustom
+
+# Adds support for scrolling with joypad
+
+const SCROLL_SPEED := 1000.
+
+func _process(delta):
+ set_deferred("scroll_vertical", scroll_vertical + Input.get_axis("scroll_up", "scroll_down") * delta * SCROLL_SPEED)
diff --git a/client/menu/settings.tscn b/client/menu/settings.tscn
index e5a0d1c5..b36f8c29 100644
--- a/client/menu/settings.tscn
+++ b/client/menu/settings.tscn
@@ -1,8 +1,9 @@
-[gd_scene load_steps=4 format=3 uid="uid://8ic77jmadadj"]
+[gd_scene load_steps=5 format=3 uid="uid://8ic77jmadadj"]
[ext_resource type="Theme" uid="uid://b0qmvo504e457" path="res://menu/theme/theme.tres" id="1_foq3a"]
[ext_resource type="Script" path="res://menu/settings.gd" id="2_3hgm8"]
[ext_resource type="Material" uid="uid://beea1pc5nt67r" path="res://menu/theme/dark_blur_material.tres" id="3_8nykw"]
+[ext_resource type="Script" path="res://menu/scroll_container_custom.gd" id="4_vfb63"]
[node name="SettingsMenu" type="Control"]
layout_mode = 3
@@ -52,6 +53,7 @@ text = "Settings"
layout_mode = 2
size_flags_vertical = 3
follow_focus = true
+script = ExtResource("4_vfb63")
[node name="Options" type="VBoxContainer" parent="OuterGap/Panel/InnerGap/VBoxContainer/ScrollContainer"]
layout_mode = 2
diff --git a/client/menu/setup.tscn b/client/menu/setup.tscn
index 626f20c4..9d8e4975 100644
--- a/client/menu/setup.tscn
+++ b/client/menu/setup.tscn
@@ -1,7 +1,8 @@
-[gd_scene load_steps=14 format=3 uid="uid://ddl3efikvqp66"]
+[gd_scene load_steps=15 format=3 uid="uid://ddl3efikvqp66"]
[ext_resource type="Script" path="res://menu/setup.gd" id="1_mo46n"]
[ext_resource type="Theme" uid="uid://ci2qajdoa1an1" path="res://menu/theme/paper.tres" id="1_yq0aa"]
+[ext_resource type="Script" path="res://menu/scroll_container_custom.gd" id="2_4caf2"]
[ext_resource type="FontFile" uid="uid://bo4vh5xkpvrh1" path="res://menu/theme/font-sansita-swashed.woff2" id="3_2vg4d"]
[ext_resource type="AudioStream" uid="uid://do7ii5hx71p0m" path="res://menu/sounds/page.ogg" id="5_xac6d"]
[ext_resource type="AudioStream" uid="uid://5b3noxjmasmu" path="res://menu/sounds/sign.ogg" id="6_wf0gh"]
@@ -94,6 +95,7 @@ grow_horizontal = 2
grow_vertical = 2
follow_focus = true
horizontal_scroll_mode = 0
+script = ExtResource("2_4caf2")
[node name="Control" type="Control" parent="ScrollContainer"]
custom_minimum_size = Vector2(0, 1500)
diff --git a/client/project.godot b/client/project.godot
index ad4616c5..684ca1cd 100644
--- a/client/project.godot
+++ b/client/project.godot
@@ -180,6 +180,16 @@ zoom_out_discrete={
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":16,"position":Vector2(214, 28),"global_position":Vector2(218, 69),"factor":1.0,"button_index":5,"canceled":false,"pressed":true,"double_click":false,"script":null)
]
}
+scroll_down={
+"deadzone": 0.2,
+"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":3,"axis_value":1.0,"script":null)
+]
+}
+scroll_up={
+"deadzone": 0.2,
+"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":3,"axis_value":-1.0,"script":null)
+]
+}
[internationalization]