Merge pull request #708 from voylin/Fix_GUI_Input_Mapping_Demo_4.0-dev

Fixed Script Errors for GUI Input Mapping Demo - 4.0-dev
This commit is contained in:
Aaron Franke
2022-04-03 03:46:34 -05:00
committed by GitHub
5 changed files with 32 additions and 56 deletions

View File

@@ -8,9 +8,9 @@ func _ready():
display_current_key() display_current_key()
func _toggled(button_pressed): func _toggled(is_button_pressed):
set_process_unhandled_key_input(button_pressed) set_process_unhandled_key_input(is_button_pressed)
if button_pressed: if is_button_pressed:
text = "... Key" text = "... Key"
release_focus() release_focus()
else: else:
@@ -21,7 +21,7 @@ func _unhandled_key_input(event):
# Note that you can use the _input callback instead, especially if # Note that you can use the _input callback instead, especially if
# you want to work with gamepads. # you want to work with gamepads.
remap_action_to(event) remap_action_to(event)
pressed = false button_pressed = false
func remap_action_to(event): func remap_action_to(event):
@@ -31,5 +31,5 @@ func remap_action_to(event):
func display_current_key(): func display_current_key():
var current_key = InputMap.get_action_list(action)[0].as_text() var current_key = InputMap.action_get_events(action)[0].as_text()
text = "%s Key" % current_key text = "%s Key" % current_key

View File

@@ -1,8 +1,6 @@
[gd_scene load_steps=3 format=2] [gd_scene load_steps=2 format=3 uid="uid://bjdgwg23lm1d4"]
[ext_resource path="res://ActionRemapButton.tscn" type="PackedScene" id=1] [ext_resource type="PackedScene" path="res://ActionRemapButton.tscn" id="1"]
[sub_resource type="ButtonGroup" id=1]
[node name="InputRemapMenu" type="Control"] [node name="InputRemapMenu" type="Control"]
anchor_right = 1.0 anchor_right = 1.0
@@ -13,8 +11,6 @@ anchor_right = 1.0
offset_top = 24.0 offset_top = 24.0
offset_bottom = 55.0 offset_bottom = 55.0
text = "Click on a button to reassign its action key." text = "Click on a button to reassign its action key."
align = 1
autowrap = true
__meta__ = { __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
@@ -29,7 +25,6 @@ offset_top = -144.0
offset_right = 160.0 offset_right = 160.0
offset_bottom = 144.0 offset_bottom = 144.0
disabled = true disabled = true
group = SubResource( 1 )
flat = true flat = true
__meta__ = { __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
@@ -60,16 +55,13 @@ offset_bottom = 52.0
size_flags_horizontal = 3 size_flags_horizontal = 3
size_flags_vertical = 3 size_flags_vertical = 3
text = "Move Left" text = "Move Left"
align = 1
valign = 1
[node name="RemapButton" parent="RemapButtonGroup/ActionsList/ActionRemapRow" instance=ExtResource( 1 )] [node name="RemapButton" parent="RemapButtonGroup/ActionsList/ActionRemapRow" instance=ExtResource( "1" )]
offset_left = 162.0 offset_left = 162.0
offset_right = 320.0 offset_right = 320.0
offset_bottom = 52.0 offset_bottom = 52.0
size_flags_horizontal = 3 size_flags_horizontal = 3
size_flags_vertical = 3 size_flags_vertical = 3
group = SubResource( 1 )
action = "move_left" action = "move_left"
[node name="ActionRemapRow2" type="HBoxContainer" parent="RemapButtonGroup/ActionsList"] [node name="ActionRemapRow2" type="HBoxContainer" parent="RemapButtonGroup/ActionsList"]
@@ -85,16 +77,13 @@ offset_bottom = 53.0
size_flags_horizontal = 3 size_flags_horizontal = 3
size_flags_vertical = 3 size_flags_vertical = 3
text = "Move Right" text = "Move Right"
align = 1
valign = 1
[node name="RemapButton" parent="RemapButtonGroup/ActionsList/ActionRemapRow2" instance=ExtResource( 1 )] [node name="RemapButton" parent="RemapButtonGroup/ActionsList/ActionRemapRow2" instance=ExtResource( "1" )]
offset_left = 162.0 offset_left = 162.0
offset_right = 320.0 offset_right = 320.0
offset_bottom = 53.0 offset_bottom = 53.0
size_flags_horizontal = 3 size_flags_horizontal = 3
size_flags_vertical = 3 size_flags_vertical = 3
group = SubResource( 1 )
action = "move_right" action = "move_right"
[node name="ActionRemapRow3" type="HBoxContainer" parent="RemapButtonGroup/ActionsList"] [node name="ActionRemapRow3" type="HBoxContainer" parent="RemapButtonGroup/ActionsList"]
@@ -110,16 +99,13 @@ offset_bottom = 53.0
size_flags_horizontal = 3 size_flags_horizontal = 3
size_flags_vertical = 3 size_flags_vertical = 3
text = "Look Up" text = "Look Up"
align = 1
valign = 1
[node name="RemapButton" parent="RemapButtonGroup/ActionsList/ActionRemapRow3" instance=ExtResource( 1 )] [node name="RemapButton" parent="RemapButtonGroup/ActionsList/ActionRemapRow3" instance=ExtResource( "1" )]
offset_left = 162.0 offset_left = 162.0
offset_right = 320.0 offset_right = 320.0
offset_bottom = 53.0 offset_bottom = 53.0
size_flags_horizontal = 3 size_flags_horizontal = 3
size_flags_vertical = 3 size_flags_vertical = 3
group = SubResource( 1 )
action = "look_up" action = "look_up"
[node name="ActionRemapRow4" type="HBoxContainer" parent="RemapButtonGroup/ActionsList"] [node name="ActionRemapRow4" type="HBoxContainer" parent="RemapButtonGroup/ActionsList"]
@@ -135,16 +121,13 @@ offset_bottom = 53.0
size_flags_horizontal = 3 size_flags_horizontal = 3
size_flags_vertical = 3 size_flags_vertical = 3
text = "Crouch" text = "Crouch"
align = 1
valign = 1
[node name="RemapButton" parent="RemapButtonGroup/ActionsList/ActionRemapRow4" instance=ExtResource( 1 )] [node name="RemapButton" parent="RemapButtonGroup/ActionsList/ActionRemapRow4" instance=ExtResource( "1" )]
offset_left = 162.0 offset_left = 162.0
offset_right = 320.0 offset_right = 320.0
offset_bottom = 53.0 offset_bottom = 53.0
size_flags_horizontal = 3 size_flags_horizontal = 3
size_flags_vertical = 3 size_flags_vertical = 3
group = SubResource( 1 )
action = "crouch" action = "crouch"
[node name="ActionRemapRow5" type="HBoxContainer" parent="RemapButtonGroup/ActionsList"] [node name="ActionRemapRow5" type="HBoxContainer" parent="RemapButtonGroup/ActionsList"]
@@ -160,14 +143,11 @@ offset_bottom = 53.0
size_flags_horizontal = 3 size_flags_horizontal = 3
size_flags_vertical = 3 size_flags_vertical = 3
text = "Dash" text = "Dash"
align = 1
valign = 1
[node name="RemapButton" parent="RemapButtonGroup/ActionsList/ActionRemapRow5" instance=ExtResource( 1 )] [node name="RemapButton" parent="RemapButtonGroup/ActionsList/ActionRemapRow5" instance=ExtResource( "1" )]
offset_left = 162.0 offset_left = 162.0
offset_right = 320.0 offset_right = 320.0
offset_bottom = 53.0 offset_bottom = 53.0
size_flags_horizontal = 3 size_flags_horizontal = 3
size_flags_vertical = 3 size_flags_vertical = 3
group = SubResource( 1 )
action = "dash" action = "dash"

View File

@@ -8,7 +8,7 @@ A demo showing how to build an input key remapping screen.
Language: GDScript Language: GDScript
Renderer: GLES 2 Renderer: Vulkan Mobile
Check out this demo on the asset library: https://godotengine.org/asset-library/asset/131 Check out this demo on the asset library: https://godotengine.org/asset-library/asset/131

View File

@@ -1,8 +1,9 @@
[remap] [remap]
importer="texture" importer="texture"
type="StreamTexture2D" type="CompressedTexture2D"
path="res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" uid="uid://bn2conid84pie"
path="res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"
metadata={ metadata={
"vram_texture": false "vram_texture": false
} }
@@ -10,26 +11,23 @@ metadata={
[deps] [deps]
source_file="res://icon.png" source_file="res://icon.png"
dest_files=["res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"] dest_files=["res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"]
[params] [params]
compress/mode=0 compress/mode=0
compress/lossy_quality=0.7 compress/lossy_quality=0.7
compress/hdr_mode=0 compress/hdr_compression=1
compress/bptc_ldr=0 compress/bptc_ldr=0
compress/normal_map=0 compress/normal_map=0
flags/repeat=0 compress/channel_pack=0
flags/filter=true mipmaps/generate=false
flags/mipmaps=false mipmaps/limit=-1
flags/anisotropic=false roughness/mode=0
flags/srgb=2 roughness/src_normal=""
process/fix_alpha_border=true process/fix_alpha_border=true
process/premult_alpha=false process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false process/normal_map_invert_y=false
stream=false process/hdr_as_srgb=false
size_limit=0 process/size_limit=0
detect_3d=true detect_3d/compress_to=1
svg/scale=1.0

View File

@@ -6,7 +6,7 @@
; [section] ; section goes between [] ; [section] ; section goes between []
; param=value ; assign values to parameters ; param=value ; assign values to parameters
config_version=4 config_version=5
[application] [application]
@@ -18,13 +18,13 @@ config/description="A demo showing how to build an input key remapping screen.
after the project is restarted." after the project is restarted."
run/main_scene="res://InputRemapMenu.tscn" run/main_scene="res://InputRemapMenu.tscn"
config/icon="res://icon.png" config/icon="res://icon.png"
config/features=PackedStringArray("4.0")
[display] [display]
window/size/width=640 window/size/viewport_width=640
window/size/height=480 window/size/viewport_height=480
window/dpi/allow_hidpi=true window/stretch/mode="canvas_items"
window/stretch/mode="2d"
window/stretch/aspect="expand" window/stretch/aspect="expand"
[gdnative] [gdnative]
@@ -61,6 +61,4 @@ dash={
[rendering] [rendering]
quality/driver/driver_name="GLES2" vulkan/rendering/back_end=1
vram_compression/import_etc=true
vram_compression/import_etc2=false