configure control, but not activate

This commit is contained in:
AleaJactaEst 2022-02-12 23:15:01 +01:00
parent 9277d4f5c9
commit 1b44ccd206
21 changed files with 821 additions and 8 deletions

View file

@ -29,3 +29,9 @@ msgstr "Select your language"
msgid "Quit" msgid "Quit"
msgstr "Exit" msgstr "Exit"
msgid "Sort by input"
msgstr "Sort by input"
msgid "Reload system config"
msgstr "Reload system config"

View file

@ -29,3 +29,9 @@ msgstr "Sélectionner votre langue"
msgid "Quit" msgid "Quit"
msgstr "Sortir" msgstr "Sortir"
msgid "Sort by input"
msgstr "Trié par contrôle"
msgid "Reload system config"
msgstr "Recharger la configuration de base"

View file

@ -19,3 +19,12 @@ msgstr ""
msgid "Quit" msgid "Quit"
msgstr "" msgstr ""
msgid "Edit control"
msgstr ""
msgid "Sort by input"
msgstr ""
msgid "Reload system config"
msgstr ""

BIN
scenes/controls/add.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 B

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture2D"
uid="uid://dhme55udo3chx"
path="res://.godot/imported/add.png-857c1c6e0729b01483785eee8bf67941.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://scenes/controls/add.png"
dest_files=["res://.godot/imported/add.png-857c1c6e0729b01483785eee8bf67941.stex"]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/bptc_ldr=0
compress/normal_map=0
compress/channel_pack=0
compress/streamed=false
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/HDR_as_SRGB=false
process/size_limit=0
detect_3d/compress_to=1

46
scenes/controls/add.svg Normal file
View file

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="210mm"
height="297mm"
viewBox="0 0 210 297"
version="1.1"
id="svg1286"
inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20, custom)"
sodipodi:docname="add.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview1288"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:document-units="mm"
showgrid="false"
inkscape:zoom="0.37104026"
inkscape:cx="52.554943"
inkscape:cy="738.46433"
inkscape:window-width="1920"
inkscape:window-height="1011"
inkscape:window-x="1080"
inkscape:window-y="604"
inkscape:window-maximized="1"
inkscape:current-layer="layer1" />
<defs
id="defs1283" />
<g
inkscape:label="Calque 1"
inkscape:groupmode="layer"
id="layer1">
<path
style="fill:none;stroke:#000000;stroke-width:10;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"
d="M 104.74284,5.5453867 V 294.86579 M 4.6333131,141.4333 208.64733,141.55264"
id="path1380" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

View file

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture2D"
uid="uid://24bvysta5tma"
path="res://.godot/imported/add.svg-26b0305e6798499dcda78ea163b6ef1d.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://scenes/controls/add.svg"
dest_files=["res://.godot/imported/add.svg-26b0305e6798499dcda78ea163b6ef1d.stex"]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/bptc_ldr=0
compress/normal_map=0
compress/channel_pack=0
compress/streamed=false
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/HDR_as_SRGB=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0

View file

@ -0,0 +1,25 @@
extends HBoxContainer
signal add_pressed( command )
var action = null
func set_label( command ):
$Label.text = command
func set_action( _action ):
action = _action
func set_param(_action, _command, position):
set_label(_command)
set_action(_action)
if position:
$Add_front.visible = true
$Add.visible = false
else:
$Add_front.visible = false
$Add.visible = true
func _on_add_pressed():
emit_signal( "add_pressed", action, $Label.text )

View file

@ -0,0 +1,32 @@
[gd_scene load_steps=3 format=3 uid="uid://d2nu5ak74y4xk"]
[ext_resource type="Script" path="res://scenes/controls/control_function.gd" id="1_2cvgr"]
[ext_resource type="Texture2D" uid="uid://dhme55udo3chx" path="res://scenes/controls/add.png" id="2_f4wes"]
[node name="Control" type="HBoxContainer"]
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( "1_2cvgr" )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Add_front" type="TextureButton" parent="."]
offset_right = 23.0
offset_bottom = 600.0
texture_normal = ExtResource( "2_f4wes" )
stretch_mode = 3
[node name="Label" type="Label" parent="."]
offset_left = 27.0
offset_top = 288.0
offset_right = 997.0
offset_bottom = 311.0
size_flags_horizontal = 3
[node name="Add" type="TextureButton" parent="."]
offset_left = 1001.0
offset_right = 1024.0
offset_bottom = 600.0
texture_normal = ExtResource( "2_f4wes" )
stretch_mode = 3

View file

@ -0,0 +1,23 @@
extends HBoxContainer
signal del_pressed( command, control, eventInput )
var command:String
var eventInput
func set_param( command:String, control:String, param_comment:String, eventInput ):
self.command = command
$Label.text = control
self.eventInput = eventInput
if param_comment.length() > 0:
$Comment.text = param_comment
$Empty.visible = false
$Comment.visible = true
else:
$Comment.text = ""
$Empty.visible = true
$Comment.visible = false
func _on_del_pressed():
emit_signal( "del_pressed", self.command, $Label.text, self.eventInput )

View file

@ -0,0 +1,44 @@
[gd_scene load_steps=3 format=3 uid="uid://mtftrelrm0uy"]
[ext_resource type="Script" path="res://scenes/controls/control_input.gd" id="1_dp231"]
[ext_resource type="Texture2D" uid="uid://js4s65teoql3" path="res://scenes/controls/trash.png" id="2_r7srr"]
[node name="Control" type="HBoxContainer"]
anchor_right = 1.0
anchor_bottom = 1.0
size_flags_horizontal = 3
size_flags_vertical = 3
script = ExtResource( "1_dp231" )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Empty" type="Label" parent="."]
offset_right = 329.0
offset_bottom = 600.0
size_flags_horizontal = 3
size_flags_vertical = 5
[node name="Comment" type="Label" parent="."]
offset_left = 333.0
offset_right = 662.0
offset_bottom = 600.0
size_flags_horizontal = 3
size_flags_vertical = 5
[node name="Del" type="TextureButton" parent="."]
offset_left = 666.0
offset_right = 690.0
offset_bottom = 600.0
hint_tooltip = "Delete"
size_flags_horizontal = 5
size_flags_vertical = 5
texture_normal = ExtResource( "2_r7srr" )
stretch_mode = 0
[node name="Label" type="Label" parent="."]
offset_left = 694.0
offset_right = 1024.0
offset_bottom = 600.0
size_flags_horizontal = 3
size_flags_vertical = 5

272
scenes/controls/controls.gd Normal file
View file

@ -0,0 +1,272 @@
extends Control
var control_system_conf = {}
func _init():
load_control_system()
func _ready():
pass
func reload_control_system():
# Adding new Action
for key in control_system_conf:
if not InputMap.has_action(key):
InputMap.add_action(key)
# Adding new event
for newevent in control_system_conf[key]:
var ele = generate_inputevent(newevent)
if not InputMap.action_has_event(key, ele):
InputMap.action_add_event(key, ele)
# Remove action/event not used
for keyInput in InputMap.get_actions():
var foundAction:bool = false
for key in control_system_conf:
if key == keyInput:
foundAction = true
break
if not foundAction:
InputMap.erase_action(keyInput)
continue
var listInput = InputMap.get_action_list(keyInput)
for eventInput in listInput:
var foundEvent:bool = false
var vis = get_dict_inputevent(eventInput)
for v in control_system_conf[keyInput]:
if compare_dict_inputevent(v, vis):
foundEvent = true
break
if not foundEvent:
InputMap.action_erase_event(keyInput, eventInput)
func compare_dict_inputevent(ref, cmp):
if ref.size() != cmp.size():
return false
for key in ref:
if ref[key] != cmp[key]:
return false
return true
func get_dict_inputevent(event):
if event is InputEventKey:
return {
'type' : 'InputEventKey',
'keycode' : event.get_keycode(),
'physical_keycode' : event.get_physical_keycode(),
'unicode' :event.get_unicode(),
'echo' : event.is_echo(),
'alt' : event.is_alt_pressed(),
'command' : event.is_command_pressed(),
'control' : event.is_ctrl_pressed(),
'meta' : event.is_meta_pressed(),
'shift' : event.is_shift_pressed(),
'storing_command': event.is_storing_command()
}
elif event is InputEventMouseButton:
return { 'type' : 'InputEventMouseButton', 'value' : event.get_button_index() }
elif event is InputEventJoypadButton:
return { 'type' : 'InputEventJoypadButton', 'value' : event.get_button_index() }
return { 'type' : 'Unknown'}
func generate_inputevent(param):
if param['type'] == 'InputEventKey':
var ele:InputEventKey = InputEventKey.new()
ele.set_physical_scancode(param['physical_scancode'])
ele.set_scancode(param['scancode'])
ele.set_echo(param['echo'])
if OS.get_ime_selection():
ele.set_unicode(param['unicode'])
ele.set_alt(param['alt'])
ele.set_command(param['command'])
ele.set_control(param['control'])
ele.set_metakey(param['meta'])
ele.set_shift(param['shift'])
return ele
elif param['type'] == 'InputEventMouseButton':
var ele:InputEventMouseButton = InputEventMouseButton.new()
ele.set_button_index(param['value'])
return ele
elif param['type'] == 'InputEventJoypadButton':
var ele:InputEventJoypadButton = InputEventJoypadButton.new()
ele.set_button_index(param['value'])
return ele
return null
func get_hash_inputevent(event):
var head:String
if event is InputEventKey:
head = 'a'
elif event is InputEventMouseButton:
head = 'm'
elif event is InputEventJoypadButton:
head = 'j'
else:
head ='z'
return head + str(get_string_input(event))
func get_string_input_mousse_button(event:InputEventMouseButton):
match event.get_button_index():
1:
return "BUTTON_LEFT"
3:
return "BUTTON_MIDDLE"
2:
return "BUTTON_RIGHT"
4:
return "BUTTON_WHEEL_UP"
5:
return "BUTTON_WHEEL_DOWN"
6:
return "BUTTON_WHEEL_LEFT"
7:
return "BUTTON_WHEEL_RIGHT"
8:
return "BUTTON_XBUTTON1"
9:
return "BUTTON_XBUTTON2"
_:
return "MOUSSE BUTTON: " + str(event.get_button_index())
func get_string_input_joypad_button(event:InputEventJoypadButton):
match event.get_button_index():
0:
return "JOY_BUTTON_A"
1:
return "JOY_BUTTON_B"
2:
return "JOY_BUTTON_X"
3:
return "JOY_BUTTON_Y"
4:
return "JOY_BUTTON_BACK"
5:
return "JOY_BUTTON_GUIDE"
6:
return "JOY_BUTTON_START"
7:
return "JOY_BUTTON_LEFT_STICK"
8:
return "JOY_BUTTON_RIGHT_STICK"
9:
return "JOY_BUTTON_LEFT_SHOULDER"
10:
return "JOY_BUTTON_RIGHT_SHOULDER"
11:
return "JOY_BUTTON_DPAD_UP"
12:
return "JOY_BUTTON_DPAD_DOWN"
13:
return "JOY_BUTTON_DPAD_LEFT"
14:
return "JOY_BUTTON_DPAD_RIGHT"
_:
return "JOYPAD BUTTON: " + str(event.get_button_index())
func get_string_input_keyboard(event:InputEventKey):
return OS.get_keycode_string(event.keycode)
func get_string_input(event):
if event is InputEventKey:
return get_string_input_keyboard(event) # OS.get_scancode_string(event.get_scancode_with_modifiers())
elif event is InputEventMouseButton:
return get_string_input_mousse_button(event)
elif event is InputEventJoypadButton:
return get_string_input_joypad_button(event)
else:
return str(event)
func load_current_control():
var conf = {}
for key in InputMap.get_actions():
var a = InputMap.action_get_events(key)
var beta = []
for z in a:
beta.append( get_dict_inputevent(z) )
conf[key] = beta
return conf
func configure_control():
if $Window/VBox/Menu/SortByInput.is_pressed():
configure_control_sort_by_input()
else:
configure_control_sort_by_categories()
func configure_control_sort_by_input():
#$Window/VBox/Input/Control
var def = {}
for action in InputMap.get_actions():
for z in InputMap.action_get_events(action):
var id = str(get_hash_inputevent(z)) + "_" + str(action)
def[id] = { 'event': z, 'action': action }
var defsorted = def.keys()
defsorted.sort()
var lastevent = null
for id in defsorted:
var z = def[id]['event']
var action = def[id]['action']
var zhash = get_dict_inputevent(z).hash()
if zhash != lastevent:
var separator = HSeparator.new()
$Window/VBox/Input/Control.add_child( separator )
lastevent = zhash
if z is InputEventKey:
var item = preload( "res://scenes/controls/control_input.tscn" ).instantiate(1) #.instance()
item.set_param(action, get_string_input_keyboard(z), action, z)
#item.connect( "del_pressed", self, "_on_input_box_del_pressed" )
#print(action,':', z, z.get_scancode_with_modifiers(),' - ', z.get_scancode(), ' - ', z.unicode , ' - ', OS.get_scancode_string(z.get_scancode_with_modifiers()))
$Window/VBox/Input/Control.add_child( item )
#$Window/VBox/Test.add_child( item )
elif z is InputEventMouseButton:
var item = preload( "res://scenes/controls/control_input.tscn" ).instantiate()
#item.set_label(action, "Mouse Button: " + str(z.get_button_index()))
item.set_param(action, "Mouse Button: " + get_string_input_mousse_button(z), action, z)
#item.connect( "del_pressed", self, "_on_input_box_del_pressed" )
$Window/VBox/Input/Control.add_child( item )
#print(action,':', z, z.get_button_mask(), ' - ', z.get_factor(), ' - ' , z.get_button_index() )
elif z is InputEventJoypadButton:
#print(action,':', z, z.get_button_index() )
var item = preload( "res://scenes/controls/control_input.tscn" ).instantiate()
#item.set_label(action, "Joypad Button: " + str(z.get_button_index()))
item.set_param(action, "Joypad Button: " + get_string_input_joypad_button(z), action, z)
#item.connect( "del_pressed", self, "_on_input_box_del_pressed" )
$Window/VBox/Input/Control.add_child( item )
for action in InputMap.get_actions():
var separator = HSeparator.new()
$Window/VBox/Input/Control.add_child( separator )
var control_box = preload( "res://scenes/controls/control_function.tscn" ).instantiate()
#control_box.set_label(key)
control_box.set_param(action, action, true)
#control_box.connect( "add_pressed", self, "_on_control_box_add_pressed" )
$Window/VBox/Input/Control.add_child( control_box )
func configure_control_sort_by_categories():
print("configure_control_sort_by_categories")
func load_control_system():
control_system_conf = load_current_control()
func _on_quit_pressed():
$Window.visible = false
func _on_sort_by_input_pressed():
configure_control()

View file

@ -0,0 +1,106 @@
[gd_scene load_steps=2 format=3 uid="uid://cl8xk8w3jmta0"]
[ext_resource type="Script" path="res://scenes/controls/controls.gd" id="1_2c8s6"]
[node name="Control" type="Control"]
visible = false
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( "1_2c8s6" )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Window" type="Window" parent="."]
title = "Edit control"
size = Vector2i(400, 500)
visible = false
content_scale_mode = 1
content_scale_aspect = 4
[node name="VBox" type="VBoxContainer" parent="Window"]
offset_right = 40.0
offset_bottom = 40.0
size_flags_horizontal = 6
size_flags_vertical = 6
[node name="Menu" type="HBoxContainer" parent="Window/VBox"]
offset_right = 301.0
offset_bottom = 31.0
size_flags_horizontal = 3
[node name="SortByInput" type="CheckBox" parent="Window/VBox/Menu"]
offset_right = 127.0
offset_bottom = 31.0
size_flags_horizontal = 7
text = "Sort by input"
[node name="Reload" type="Button" parent="Window/VBox/Menu"]
offset_left = 131.0
offset_right = 301.0
offset_bottom = 31.0
size_flags_horizontal = 7
text = "Reload system config"
[node name="Input" type="ScrollContainer" parent="Window/VBox"]
offset_top = 35.0
offset_right = 301.0
offset_bottom = 35.0
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="Control" type="VBoxContainer" parent="Window/VBox/Input"]
offset_right = 301.0
offset_bottom = 56.0
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="Label" type="Label" parent="Window/VBox/Input/Control"]
offset_right = 293.0
offset_bottom = 26.0
size_flags_horizontal = 3
size_flags_vertical = 7
text = "Test"
[node name="Label2" type="Label" parent="Window/VBox/Input/Control"]
offset_top = 30.0
offset_right = 293.0
offset_bottom = 56.0
size_flags_horizontal = 3
size_flags_vertical = 7
text = "Test"
[node name="Test" type="VBoxContainer" parent="Window/VBox"]
offset_top = 39.0
offset_right = 301.0
offset_bottom = 95.0
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="Label3" type="Label" parent="Window/VBox/Test"]
offset_right = 301.0
offset_bottom = 26.0
size_flags_horizontal = 3
size_flags_vertical = 7
text = "Test"
[node name="Label4" type="Label" parent="Window/VBox/Test"]
offset_top = 30.0
offset_right = 301.0
offset_bottom = 56.0
size_flags_horizontal = 3
size_flags_vertical = 7
text = "Test"
[node name="Quit" type="Button" parent="Window/VBox"]
offset_top = 99.0
offset_right = 301.0
offset_bottom = 130.0
size_flags_horizontal = 6
size_flags_vertical = 10
text = "Quit"
[connection signal="close_requested" from="Window" to="." method="_on_quit_pressed"]
[connection signal="pressed" from="Window/VBox/Menu/SortByInput" to="." method="_on_sort_by_input_pressed"]
[connection signal="pressed" from="Window/VBox/Menu/Reload" to="." method="reload_system_config"]
[connection signal="pressed" from="Window/VBox/Quit" to="." method="_on_quit_pressed"]

BIN
scenes/controls/trash.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 666 B

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture2D"
uid="uid://js4s65teoql3"
path="res://.godot/imported/trash.png-da4a5f49ff87a6019cdc4d92eedfccfb.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://scenes/controls/trash.png"
dest_files=["res://.godot/imported/trash.png-da4a5f49ff87a6019cdc4d92eedfccfb.stex"]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/bptc_ldr=0
compress/normal_map=0
compress/channel_pack=0
compress/streamed=false
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/HDR_as_SRGB=false
process/size_limit=0
detect_3d/compress_to=1

97
scenes/controls/trash.svg Normal file
View file

@ -0,0 +1,97 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="210mm"
height="297mm"
viewBox="0 0 210 297"
version="1.1"
id="svg5"
inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20, custom)"
sodipodi:docname="trash.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview7"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:document-units="mm"
showgrid="true"
inkscape:zoom="0.52473017"
inkscape:cx="-48.596405"
inkscape:cy="754.67358"
inkscape:window-width="1920"
inkscape:window-height="1011"
inkscape:window-x="1080"
inkscape:window-y="604"
inkscape:window-maximized="1"
inkscape:current-layer="layer1">
<inkscape:grid
type="xygrid"
id="grid960" />
</sodipodi:namedview>
<defs
id="defs2" />
<g
inkscape:label="Calque 1"
inkscape:groupmode="layer"
id="layer1">
<g
id="g1059">
<path
style="fill:none;stroke:#000000;stroke-width:10;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"
d="M 100.54167,275.16666 H 42.333333 L 21.166667,42.333333"
id="path962" />
<path
style="fill:none;stroke:#000000;stroke-width:10.6459;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 10.583333,42.333333 H 100.54167"
id="path966" />
<path
style="fill:none;stroke:#000000;stroke-width:10;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"
d="M 52.916666,275.16666 42.333333,42.333333"
id="path968" />
<path
style="fill:none;stroke:#000000;stroke-width:10;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"
d="M 68.791666,275.16666 63.499999,42.333333"
id="path970" />
<path
style="fill:none;stroke:#000000;stroke-width:10;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"
d="M 84.666666,275.16666 V 42.333333"
id="path972" />
</g>
<g
id="g1059-3"
transform="matrix(-1,0,0,1,201.08334,0)">
<path
style="fill:none;stroke:#000000;stroke-width:10;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 100.54167,275.16666 H 42.333333 L 21.166667,42.333333"
id="path962-6" />
<path
style="fill:none;stroke:#000000;stroke-width:10.6459;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 10.583333,42.333333 H 100.54167"
id="path966-7" />
<path
style="fill:none;stroke:#000000;stroke-width:10;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 52.916666,275.16666 42.333333,42.333333"
id="path968-5" />
<path
style="fill:none;stroke:#000000;stroke-width:10;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 68.791666,275.16666 63.499999,42.333333"
id="path970-3" />
<path
style="fill:none;stroke:#000000;stroke-width:10;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 84.666666,275.16666 V 42.333333"
id="path972-5" />
</g>
<path
style="fill:none;stroke:#000000;stroke-width:10.2137;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 100.54167,279.92917 V 37.041667"
id="path1151" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.1 KiB

View file

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture2D"
uid="uid://c7xor1oxx72h4"
path="res://.godot/imported/trash.svg-f0ab7922f4cdf12c78a96422c95706d8.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://scenes/controls/trash.svg"
dest_files=["res://.godot/imported/trash.svg-f0ab7922f4cdf12c78a96422c95706d8.stex"]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/bptc_ldr=0
compress/normal_map=0
compress/channel_pack=0
compress/streamed=false
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/HDR_as_SRGB=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0

View file

@ -1,18 +1,16 @@
extends Control extends Control
func _input(event): func _input(_event):
if Input.is_action_pressed("ui_menu"): if Input.is_action_just_pressed("ui_menu"):
$Menu.visible = ! $Menu.visible $Menu.visible = ! $Menu.visible
func _on_timer_timeout(): func _on_timer_timeout():
print("fin")
$Message/Label.visible = false $Message/Label.visible = false
func _on_quit_pressed(): func _on_quit_pressed():
#get_tree().quit()
$ConfirmQuit.popup_centered() $ConfirmQuit.popup_centered()
$ConfirmQuit.visible = true $ConfirmQuit.visible = true
pass pass
@ -25,3 +23,9 @@ func _on_confirmation_dialog_confirmed():
func _on_languages_pressed(): func _on_languages_pressed():
$MenuOption/Window.popup_centered() $MenuOption/Window.popup_centered()
$MenuOption/Window.visible = true $MenuOption/Window.visible = true
func _on_keys_pressed():
#$MenuControl/Window.popup_centered()
#$MenuControl/Window.visible = true
pass

View file

@ -1,7 +1,8 @@
[gd_scene load_steps=3 format=3 uid="uid://cdyi1a858p7em"] [gd_scene load_steps=4 format=3 uid="uid://cdyi1a858p7em"]
[ext_resource type="Script" path="res://scenes/hud/hud.gd" id="1_s6f6d"] [ext_resource type="Script" path="res://scenes/hud/hud.gd" id="1_s6f6d"]
[ext_resource type="PackedScene" uid="uid://dpvequp5fv27k" path="res://scenes/languages/languages.tscn" id="2_um8fw"] [ext_resource type="PackedScene" uid="uid://dpvequp5fv27k" path="res://scenes/languages/languages.tscn" id="2_um8fw"]
[ext_resource type="PackedScene" uid="uid://cl8xk8w3jmta0" path="res://scenes/controls/controls.tscn" id="3_08xl7"]
[node name="Control" type="Control"] [node name="Control" type="Control"]
anchor_right = 1.0 anchor_right = 1.0
@ -41,8 +42,8 @@ __meta__ = {
} }
[node name="Keys" type="Button" parent="Menu"] [node name="Keys" type="Button" parent="Menu"]
offset_left = 444.0 offset_left = 510.0
offset_right = 488.0 offset_right = 554.0
offset_bottom = 40.0 offset_bottom = 40.0
text = "Keys" text = "Keys"
@ -69,6 +70,9 @@ dialog_text = "Do you want quit?"
[node name="MenuOption" parent="." instance=ExtResource( "2_um8fw" )] [node name="MenuOption" parent="." instance=ExtResource( "2_um8fw" )]
visible = false visible = false
[node name="MenuControl" parent="." instance=ExtResource( "3_08xl7" )]
[connection signal="pressed" from="Menu/Keys" to="." method="_on_keys_pressed"]
[connection signal="pressed" from="Menu/Languages" to="." method="_on_languages_pressed"] [connection signal="pressed" from="Menu/Languages" to="." method="_on_languages_pressed"]
[connection signal="pressed" from="Menu/Quit" to="." method="_on_quit_pressed"] [connection signal="pressed" from="Menu/Quit" to="." method="_on_quit_pressed"]
[connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"] [connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"]

View file

@ -31,7 +31,7 @@ func _ready():
$Window/VBoxContainer/Select.select(selected) $Window/VBoxContainer/Select.select(selected)
func _on_select_item_selected(index): func _on_select_item_selected(_index):
var pos = 0 var pos = 0
for key in TranslationServer.get_loaded_locales(): for key in TranslationServer.get_loaded_locales():
if pos == $Window/VBoxContainer/Select.get_selected(): if pos == $Window/VBoxContainer/Select.get_selected():

View file

@ -33,5 +33,6 @@ offset_right = 43.0
offset_bottom = 66.0 offset_bottom = 66.0
text = "Quit" text = "Quit"
[connection signal="close_requested" from="Window" to="." method="_on_quit_pressed"]
[connection signal="item_selected" from="Window/VBoxContainer/Select" to="." method="_on_select_item_selected"] [connection signal="item_selected" from="Window/VBoxContainer/Select" to="." method="_on_select_item_selected"]
[connection signal="pressed" from="Window/VBoxContainer/Quit" to="." method="_on_quit_pressed"] [connection signal="pressed" from="Window/VBoxContainer/Quit" to="." method="_on_quit_pressed"]