Skip to content

Commit 204cb3b

Browse files
committed
add: shortcut keys for buttons
1 parent 8c3d54d commit 204cb3b

File tree

2 files changed

+62
-8
lines changed

2 files changed

+62
-8
lines changed

src/ExerciseEditor/exercise_editor.tscn

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[gd_scene load_steps=34 format=3 uid="uid://dusuxw5u4uhul"]
1+
[gd_scene load_steps=36 format=3 uid="uid://dusuxw5u4uhul"]
22

33
[ext_resource type="Theme" uid="uid://dppj17ign8l2n" path="res://src/Themes/main.tres" id="1_p01ag"]
44
[ext_resource type="Script" path="res://src/ExerciseEditor/exercise_editor.gd" id="1_sslhb"]
@@ -43,6 +43,14 @@ events = [SubResource("InputEventKey_iny2v")]
4343
script/source = "extends CustomButton
4444
"
4545

46+
[sub_resource type="InputEventKey" id="InputEventKey_378uw"]
47+
device = -1
48+
keycode = 88
49+
unicode = 120
50+
51+
[sub_resource type="Shortcut" id="Shortcut_d871w"]
52+
events = [SubResource("InputEventKey_378uw")]
53+
4654
[sub_resource type="GDScript" id="GDScript_5es36"]
4755
script/source = "extends CustomButton
4856

@@ -263,7 +271,8 @@ script = SubResource("GDScript_y6yfr")
263271
[node name="ExitToMenuBtn" type="Button" parent="MarginContainer2/VBoxContainer/HBoxContainer/LessonsContainer" groups=["scene_change_element"]]
264272
custom_minimum_size = Vector2(200, 40)
265273
layout_mode = 2
266-
text = "Exit To Menu"
274+
shortcut = SubResource("Shortcut_d871w")
275+
text = "E(x)it To Menu"
267276
script = SubResource("GDScript_5es36")
268277

269278
[node name="VBoxContainer2" type="VBoxContainer" parent="MarginContainer2/VBoxContainer/HBoxContainer"]

src/main.tscn

+51-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[gd_scene load_steps=23 format=3 uid="uid://cnx3k4cy1imd"]
1+
[gd_scene load_steps=33 format=3 uid="uid://cnx3k4cy1imd"]
22

33
[ext_resource type="Theme" uid="uid://dppj17ign8l2n" path="res://src/Themes/main.tres" id="1_wgeyo"]
44
[ext_resource type="Script" path="res://src/main.gd" id="1_xgqc1"]
@@ -19,6 +19,14 @@
1919
background_color = Color(0.423529, 0.423529, 0.423529, 1)
2020
ambient_light_source = 2
2121

22+
[sub_resource type="InputEventKey" id="InputEventKey_1l8wj"]
23+
device = -1
24+
keycode = 76
25+
unicode = 108
26+
27+
[sub_resource type="Shortcut" id="Shortcut_25xlf"]
28+
events = [SubResource("InputEventKey_1l8wj")]
29+
2230
[sub_resource type="GDScript" id="GDScript_6o4cl"]
2331
script/source = "extends CustomButton
2432

@@ -27,6 +35,14 @@ func _on_pressed() -> void:
2735
pass # R%TakeLessonBtneplace with function body.
2836
"
2937

38+
[sub_resource type="InputEventKey" id="InputEventKey_4a3hf"]
39+
device = -1
40+
keycode = 80
41+
unicode = 112
42+
43+
[sub_resource type="Shortcut" id="Shortcut_cxmsr"]
44+
events = [SubResource("InputEventKey_4a3hf")]
45+
3046
[sub_resource type="GDScript" id="GDScript_dlcgn"]
3147
script/source = "extends CustomButton
3248

@@ -46,6 +62,14 @@ func _on_pressed() -> void:
4662
SceneChanger.change_to_network_competition_scene()
4763
"
4864

65+
[sub_resource type="InputEventKey" id="InputEventKey_ws8em"]
66+
device = -1
67+
keycode = 69
68+
unicode = 101
69+
70+
[sub_resource type="Shortcut" id="Shortcut_haa07"]
71+
events = [SubResource("InputEventKey_ws8em")]
72+
4973
[sub_resource type="GDScript" id="GDScript_hpd8f"]
5074
script/source = "extends CustomButton
5175

@@ -58,6 +82,14 @@ func _on_pressed() -> void:
5882
pass # Replace with function body.
5983
"
6084

85+
[sub_resource type="InputEventKey" id="InputEventKey_e8w6m"]
86+
device = -1
87+
keycode = 83
88+
unicode = 115
89+
90+
[sub_resource type="Shortcut" id="Shortcut_fdxuy"]
91+
events = [SubResource("InputEventKey_e8w6m")]
92+
6193
[sub_resource type="GDScript" id="GDScript_d0c1b"]
6294
script/source = "extends CustomButton
6395

@@ -67,6 +99,14 @@ func _on_pressed() -> void:
6799
pass # Replace with function body.
68100
"
69101

102+
[sub_resource type="InputEventKey" id="InputEventKey_0fb7p"]
103+
device = -1
104+
keycode = 88
105+
unicode = 120
106+
107+
[sub_resource type="Shortcut" id="Shortcut_ucryw"]
108+
events = [SubResource("InputEventKey_0fb7p")]
109+
70110
[sub_resource type="GDScript" id="GDScript_l5vsv"]
71111
script/source = "extends CustomButton
72112

@@ -124,7 +164,8 @@ custom_minimum_size = Vector2(250, 60)
124164
layout_mode = 2
125165
size_flags_vertical = 4
126166
theme_override_font_sizes/font_size = 21
127-
text = "Step by Step Lessons"
167+
shortcut = SubResource("Shortcut_25xlf")
168+
text = "Step by Step (L)essons"
128169
icon = ExtResource("4_g7xuq")
129170
script = SubResource("GDScript_6o4cl")
130171

@@ -133,7 +174,8 @@ custom_minimum_size = Vector2(250, 60)
133174
layout_mode = 2
134175
size_flags_vertical = 4
135176
theme_override_font_sizes/font_size = 21
136-
text = "Practice"
177+
shortcut = SubResource("Shortcut_cxmsr")
178+
text = "(P)ractice"
137179
icon = ExtResource("5_nb47a")
138180
script = SubResource("GDScript_dlcgn")
139181

@@ -154,7 +196,8 @@ custom_minimum_size = Vector2(250, 60)
154196
layout_mode = 2
155197
size_flags_vertical = 4
156198
theme_override_font_sizes/font_size = 21
157-
text = "Exercise Editor"
199+
shortcut = SubResource("Shortcut_haa07")
200+
text = "(E)xercise Editor"
158201
icon = ExtResource("7_o4aed")
159202
script = SubResource("GDScript_hpd8f")
160203

@@ -163,7 +206,8 @@ custom_minimum_size = Vector2(250, 60)
163206
layout_mode = 2
164207
size_flags_vertical = 4
165208
theme_override_font_sizes/font_size = 21
166-
text = "Settings"
209+
shortcut = SubResource("Shortcut_fdxuy")
210+
text = "(S)ettings"
167211
icon = ExtResource("8_2y7oh")
168212
script = SubResource("GDScript_d0c1b")
169213

@@ -172,7 +216,8 @@ custom_minimum_size = Vector2(250, 60)
172216
layout_mode = 2
173217
size_flags_vertical = 4
174218
theme_override_font_sizes/font_size = 21
175-
text = "Exit"
219+
shortcut = SubResource("Shortcut_ucryw")
220+
text = "E(x)it"
176221
icon = ExtResource("9_on2em")
177222
script = SubResource("GDScript_l5vsv")
178223

0 commit comments

Comments
 (0)