adding joypad camera move

This commit is contained in:
AleaJactaEst 2022-04-16 00:12:12 +02:00
parent f451c4e3d4
commit 5597020a41
9 changed files with 301 additions and 124 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -940,6 +940,11 @@ func _process( delta ):
var y = 0 var y = 0
var animation_selected:AnimationSelected = AnimationSelected.IDLE var animation_selected:AnimationSelected = AnimationSelected.IDLE
# Joypad
if tps:
var move_camera:Vector2 = Input.get_vector("INPUT_VIEW_CAMERA_LEFT_JOYPAD", "INPUT_VIEW_CAMERA_RIGHT_JOYPAD", "INPUT_VIEW_CAMERA_FORWARD_JOYPAD", "INPUT_VIEW_CAMERA_BACK_JOYPAD")
move_camera(move_camera.y * 0.04, move_camera.x * 0.04)
if offset_camera_current != offset_camera_target: if offset_camera_current != offset_camera_target:
var offset_diff = move_camera_y_one_step( offset_camera_target - offset_camera_current, MOVE_CAMERA_Y_OFFSET) var offset_diff = move_camera_y_one_step( offset_camera_target - offset_camera_current, MOVE_CAMERA_Y_OFFSET)
offset_camera_current += offset_diff offset_camera_current += offset_diff

View file

@ -287,17 +287,45 @@ INPUT_ACTION_CAMERA_MOVE_PLAYER_MOUSE_PLUS={
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"store_command":true,"alt_pressed":false,"shift_pressed":false,"meta_pressed":false,"command_pressed":false,"button_mask":2,"position":Vector2(217, 135),"global_position":Vector2(217, 135),"factor":1.0,"button_index":2,"pressed":true,"double_click":false,"script":null) "events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"store_command":true,"alt_pressed":false,"shift_pressed":false,"meta_pressed":false,"command_pressed":false,"button_mask":2,"position":Vector2(217, 135),"global_position":Vector2(217, 135),"factor":1.0,"button_index":2,"pressed":true,"double_click":false,"script":null)
] ]
} }
INPUT_VIEW_CAMERA_MOVE_PLAYER_FOLLOW_JOYPAD={ INPUT_VIEW_CAMERA_LEFT_JOYPAD={
"deadzone": 0.5, "deadzone": 0.5,
"events": [] "events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":-1.0,"script":null)
]
} }
INPUT_VIEW_CAMERA_MOVE_ONLY_JOYPAD={ INPUT_VIEW_CAMERA_RIGHT_JOYPAD={
"deadzone": 0.5, "deadzone": 0.5,
"events": [] "events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":1.0,"script":null)
]
} }
INPUT_ACTION_CAMERA_MOVE_PLAYER_JOYPAD={ INPUT_VIEW_CAMERA_FORWARD_JOYPAD={
"deadzone": 0.5, "deadzone": 0.5,
"events": [] "events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":-1.0,"script":null)
]
}
INPUT_VIEW_CAMERA_BACK_JOYPAD={
"deadzone": 0.5,
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":1.0,"script":null)
]
}
INPUT_ACTION_PLAYER_LEFT_JOYPAD={
"deadzone": 0.5,
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":2,"axis_value":-1.0,"script":null)
]
}
INPUT_ACTION_PLAYER_RIGHT_JOYPAD={
"deadzone": 0.5,
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":2,"axis_value":1.0,"script":null)
]
}
INPUT_ACTION_PLAYER_FORWARD_JOYPAD={
"deadzone": 0.5,
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":3,"axis_value":-1.0,"script":null)
]
}
INPUT_ACTION_PLAYER_BACK_JOYPAD={
"deadzone": 0.5,
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":3,"axis_value":1.0,"script":null)
]
} }
[internationalization] [internationalization]

View file

@ -142,12 +142,22 @@ func load_current_control():
func update_mouse_button_move_camera(): func update_mouse_button_move_camera():
Common.msg_debug("update_mouse_button_move_camera")
$Window/v/Tab/MOUSE/v/CameraPlayer/h1/SelectButton.set_text(Common.get_input_plus("INPUT_VIEW_CAMERA_MOVE_PLAYER_FOLLOW_MOUSE")) $Window/v/Tab/MOUSE/v/CameraPlayer/h1/SelectButton.set_text(Common.get_input_plus("INPUT_VIEW_CAMERA_MOVE_PLAYER_FOLLOW_MOUSE"))
$Window/v/Tab/MOUSE/v/CameraOnly/h1/SelectButton.set_text(Common.get_input_plus("INPUT_VIEW_CAMERA_MOVE_ONLY_MOUSE")) $Window/v/Tab/MOUSE/v/CameraOnly/h1/SelectButton.set_text(Common.get_input_plus("INPUT_VIEW_CAMERA_MOVE_ONLY_MOUSE"))
$Window/v/Tab/MOUSE/v/CameraPlayerMove/h1/SelectButton.set_text(Common.get_input_plus("INPUT_ACTION_CAMERA_MOVE_PLAYER_MOUSE")) $Window/v/Tab/MOUSE/v/CameraPlayerMove/h1/SelectButton.set_text(Common.get_input_plus("INPUT_ACTION_CAMERA_MOVE_PLAYER_MOUSE"))
$Window/v/Tab/JOYPAD/v/CameraPlayer/h1/SelectButton.set_text(Common.get_input_plus("INPUT_VIEW_CAMERA_MOVE_PLAYER_FOLLOW_JOYPAD"))
$Window/v/Tab/JOYPAD/v/CameraOnly/h1/SelectButton.set_text(Common.get_input_plus("INPUT_VIEW_CAMERA_MOVE_ONLY_JOYPAD"))
$Window/v/Tab/JOYPAD/v/CameraPlayerMove/h1/SelectButton.set_text(Common.get_input_plus("INPUT_ACTION_CAMERA_MOVE_PLAYER_JOYPAD")) func update_joypad_motion():
Common.msg_debug("update_joypad_motion")
$Window/v/Tab/JOYPAD/v/CameraLeft/h1/CameraLeft.set_text(Common.get_input_plus("INPUT_VIEW_CAMERA_LEFT_JOYPAD"))
$Window/v/Tab/JOYPAD/v/CameraRight/h1/CameraRight.set_text(Common.get_input_plus("INPUT_VIEW_CAMERA_RIGHT_JOYPAD"))
$Window/v/Tab/JOYPAD/v/CameraForward/h1/CameraForward.set_text(Common.get_input_plus("INPUT_VIEW_CAMERA_FORWARD_JOYPAD"))
$Window/v/Tab/JOYPAD/v/CameraBack/h1/CameraBack.set_text(Common.get_input_plus("INPUT_VIEW_CAMERA_BACK_JOYPAD"))
$Window/v/Tab/JOYPAD/v/PlayerLeft/h1/PlayerLeft.set_text(Common.get_input_plus("INPUT_ACTION_PLAYER_LEFT_JOYPAD"))
$Window/v/Tab/JOYPAD/v/PlayerRight/h1/PlayerRight.set_text(Common.get_input_plus("INPUT_ACTION_PLAYER_RIGHT_JOYPAD"))
$Window/v/Tab/JOYPAD/v/PlayerForward/h1/PlayerForward.set_text(Common.get_input_plus("INPUT_ACTION_PLAYER_FORWARD_JOYPAD"))
$Window/v/Tab/JOYPAD/v/PlayerBack/h1/PlayerBack.set_text(Common.get_input_plus("INPUT_ACTION_PLAYER_BACK_JOYPAD"))
func configure_control(): func configure_control():
@ -164,6 +174,7 @@ func configure_control():
$Window/v/Tab/CONTROL/Input.visible = true $Window/v/Tab/CONTROL/Input.visible = true
configure_control_sort_by_input() configure_control_sort_by_input()
update_mouse_button_move_camera() update_mouse_button_move_camera()
update_joypad_motion()
func configure_control_by_group(): func configure_control_by_group():
@ -413,23 +424,58 @@ func _on_select_mouse_button_camera_player_move_pressed():
$DefineInput/Window.visible = true $DefineInput/Window.visible = true
func _on_select_joypad_button_camera_player_pressed(): func _on_camera_left_pressed():
$Window.visible = false $Window.visible = false
$DefineInput.set_param(4, "INPUT_VIEW_CAMERA_MOVE_PLAYER_FOLLOW_JOYPAD") $DefineInput.set_param(4, "INPUT_VIEW_CAMERA_LEFT_JOYPAD")
$DefineInput/Window.popup_centered() $DefineInput/Window.popup_centered()
$DefineInput/Window.visible = true $DefineInput/Window.visible = true
func _on_select_joypad_button_camera_only_pressed(): func _on_camera_right_pressed():
$Window.visible = false $Window.visible = false
$DefineInput.set_param(4, "INPUT_VIEW_CAMERA_MOVE_ONLY_JOYPAD") $DefineInput.set_param(5, "INPUT_VIEW_CAMERA_RIGHT_JOYPAD")
$DefineInput/Window.popup_centered() $DefineInput/Window.popup_centered()
$DefineInput/Window.visible = true $DefineInput/Window.visible = true
func _on_joypad_camera_player_move_button_pressed(): func _on_camera_forward_pressed():
$Window.visible = false $Window.visible = false
$DefineInput.set_param(4, "INPUT_ACTION_CAMERA_MOVE_PLAYER_JOYPAD") $DefineInput.set_param(6, "INPUT_VIEW_CAMERA_FORWARD_JOYPAD")
$DefineInput/Window.popup_centered()
$DefineInput/Window.visible = true
func _on_camera_back_pressed():
$Window.visible = false
$DefineInput.set_param(7, "INPUT_VIEW_CAMERA_BACK_JOYPAD")
$DefineInput/Window.popup_centered()
$DefineInput/Window.visible = true
func _on_player_left_pressed():
$Window.visible = false
$DefineInput.set_param(8, "INPUT_ACTION_PLAYER_LEFT_JOYPAD")
$DefineInput/Window.popup_centered()
$DefineInput/Window.visible = true
func _on_player_right_pressed():
$Window.visible = false
$DefineInput.set_param(9, "INPUT_ACTION_PLAYER_RIGHT_JOYPAD")
$DefineInput/Window.popup_centered()
$DefineInput/Window.visible = true
func _on_player_forward_pressed():
$Window.visible = false
$DefineInput.set_param(10, "INPUT_ACTION_PLAYER_FORWARD_JOYPAD")
$DefineInput/Window.popup_centered()
$DefineInput/Window.visible = true
func _on_player_back_pressed():
$Window.visible = false
$DefineInput.set_param(11, "INPUT_ACTION_PLAYER_BACK_JOYPAD")
$DefineInput/Window.popup_centered() $DefineInput/Window.popup_centered()
$DefineInput/Window.visible = true $DefineInput/Window.visible = true

View file

@ -244,144 +244,222 @@ offset_right = 40.0
offset_bottom = 40.0 offset_bottom = 40.0
[node name="v" type="VBoxContainer" parent="Window/v/Tab/JOYPAD"] [node name="v" type="VBoxContainer" parent="Window/v/Tab/JOYPAD"]
offset_right = 934.0 offset_right = 318.0
offset_bottom = 312.0 offset_bottom = 572.0
size_flags_horizontal = 3 size_flags_horizontal = 3
size_flags_vertical = 3 size_flags_vertical = 3
[node name="CameraPlayer" type="VBoxContainer" parent="Window/v/Tab/JOYPAD/v"] [node name="CameraLeft" type="VBoxContainer" parent="Window/v/Tab/JOYPAD/v"]
offset_right = 40.0 offset_right = 40.0
offset_bottom = 40.0 offset_bottom = 40.0
[node name="Label" type="Label" parent="Window/v/Tab/JOYPAD/v/CameraPlayer"] [node name="Label" type="Label" parent="Window/v/Tab/JOYPAD/v/CameraLeft"]
offset_right = 40.0 offset_right = 40.0
offset_bottom = 23.0 offset_bottom = 23.0
text = "INPUT_VIEW_CAMERA_MOVE_PLAYER_FOLLOW" text = "INPUT_VIEW_CAMERA_LEFT_JOYPAD"
[node name="h1" type="HBoxContainer" parent="Window/v/Tab/JOYPAD/v/CameraPlayer"] [node name="h1" type="HBoxContainer" parent="Window/v/Tab/JOYPAD/v/CameraLeft"]
offset_right = 40.0 offset_right = 40.0
offset_bottom = 40.0 offset_bottom = 40.0
[node name="space" type="Label" parent="Window/v/Tab/JOYPAD/v/CameraPlayer/h1"] [node name="space" type="Label" parent="Window/v/Tab/JOYPAD/v/CameraLeft/h1"]
minimum_size = Vector2(50, 0) minimum_size = Vector2(50, 0)
offset_right = 40.0 offset_right = 40.0
offset_bottom = 23.0 offset_bottom = 23.0
[node name="SelectButton" type="Button" parent="Window/v/Tab/JOYPAD/v/CameraPlayer/h1"] [node name="CameraLeft" type="Button" parent="Window/v/Tab/JOYPAD/v/CameraLeft/h1"]
offset_right = 8.0 offset_right = 8.0
offset_bottom = 31.0 offset_bottom = 31.0
text = "SELECT" text = "SELECT"
[node name="h2" type="HBoxContainer" parent="Window/v/Tab/JOYPAD/v/CameraPlayer"]
offset_right = 40.0
offset_bottom = 40.0
[node name="space" type="Label" parent="Window/v/Tab/JOYPAD/v/CameraPlayer/h2"]
minimum_size = Vector2(50, 0)
offset_right = 40.0
offset_bottom = 23.0
[node name="ReverseHorizontal" type="CheckBox" parent="Window/v/Tab/JOYPAD/v/CameraPlayer/h2"]
offset_right = 24.0
offset_bottom = 31.0
text = "EDIT_CONTROL/MOVE_CAMERA_REVERSE_HORIZONTAL"
[node name="ReverseVertical" type="CheckBox" parent="Window/v/Tab/JOYPAD/v/CameraPlayer/h2"]
offset_right = 24.0
offset_bottom = 31.0
text = "EDIT_CONTROL/MOVE_CAMERA_REVERSE_VERTICAL"
[node name="HSeparator1" type="HSeparator" parent="Window/v/Tab/JOYPAD/v"] [node name="HSeparator1" type="HSeparator" parent="Window/v/Tab/JOYPAD/v"]
offset_right = 40.0 offset_right = 40.0
offset_bottom = 4.0 offset_bottom = 4.0
[node name="CameraOnly" type="VBoxContainer" parent="Window/v/Tab/JOYPAD/v"] [node name="CameraRight" type="VBoxContainer" parent="Window/v/Tab/JOYPAD/v"]
offset_right = 40.0 offset_right = 40.0
offset_bottom = 40.0 offset_bottom = 40.0
[node name="Label" type="Label" parent="Window/v/Tab/JOYPAD/v/CameraOnly"] [node name="Label" type="Label" parent="Window/v/Tab/JOYPAD/v/CameraRight"]
offset_right = 40.0 offset_right = 40.0
offset_bottom = 23.0 offset_bottom = 23.0
text = "INPUT_VIEW_CAMERA_MOVE_ONLY" text = "INPUT_VIEW_CAMERA_RIGHT_JOYPAD"
[node name="h1" type="HBoxContainer" parent="Window/v/Tab/JOYPAD/v/CameraOnly"] [node name="h1" type="HBoxContainer" parent="Window/v/Tab/JOYPAD/v/CameraRight"]
offset_right = 40.0 offset_right = 40.0
offset_bottom = 40.0 offset_bottom = 40.0
[node name="space" type="Label" parent="Window/v/Tab/JOYPAD/v/CameraOnly/h1"] [node name="space" type="Label" parent="Window/v/Tab/JOYPAD/v/CameraRight/h1"]
minimum_size = Vector2(50, 0) minimum_size = Vector2(50, 0)
offset_right = 40.0 offset_right = 40.0
offset_bottom = 23.0 offset_bottom = 23.0
[node name="SelectButton" type="Button" parent="Window/v/Tab/JOYPAD/v/CameraOnly/h1"] [node name="CameraRight" type="Button" parent="Window/v/Tab/JOYPAD/v/CameraRight/h1"]
offset_right = 8.0 offset_right = 8.0
offset_bottom = 31.0 offset_bottom = 31.0
text = "SELECT" text = "SELECT"
[node name="h2" type="HBoxContainer" parent="Window/v/Tab/JOYPAD/v/CameraOnly"]
offset_right = 40.0
offset_bottom = 40.0
[node name="space" type="Label" parent="Window/v/Tab/JOYPAD/v/CameraOnly/h2"]
minimum_size = Vector2(50, 0)
offset_right = 40.0
offset_bottom = 23.0
[node name="ReverseHorizontal" type="CheckBox" parent="Window/v/Tab/JOYPAD/v/CameraOnly/h2"]
offset_right = 24.0
offset_bottom = 31.0
text = "EDIT_CONTROL/MOVE_CAMERA_REVERSE_HORIZONTAL"
[node name="ReverseVertical" type="CheckBox" parent="Window/v/Tab/JOYPAD/v/CameraOnly/h2"]
offset_right = 24.0
offset_bottom = 31.0
text = "EDIT_CONTROL/MOVE_CAMERA_REVERSE_VERTICAL"
[node name="HSeparator2" type="HSeparator" parent="Window/v/Tab/JOYPAD/v"] [node name="HSeparator2" type="HSeparator" parent="Window/v/Tab/JOYPAD/v"]
offset_right = 40.0 offset_right = 40.0
offset_bottom = 4.0 offset_bottom = 4.0
[node name="CameraPlayerMove" type="VBoxContainer" parent="Window/v/Tab/JOYPAD/v"] [node name="CameraForward" type="VBoxContainer" parent="Window/v/Tab/JOYPAD/v"]
offset_right = 40.0 offset_right = 40.0
offset_bottom = 40.0 offset_bottom = 40.0
[node name="Label" type="Label" parent="Window/v/Tab/JOYPAD/v/CameraPlayerMove"] [node name="Label" type="Label" parent="Window/v/Tab/JOYPAD/v/CameraForward"]
offset_right = 40.0 offset_right = 40.0
offset_bottom = 23.0 offset_bottom = 23.0
text = "INPUT_ACTION_CAMERA_MOVE_PLAYER" text = "INPUT_VIEW_CAMERA_FORWARD_JOYPAD"
[node name="h1" type="HBoxContainer" parent="Window/v/Tab/JOYPAD/v/CameraPlayerMove"] [node name="h1" type="HBoxContainer" parent="Window/v/Tab/JOYPAD/v/CameraForward"]
offset_right = 40.0 offset_right = 40.0
offset_bottom = 40.0 offset_bottom = 40.0
[node name="space" type="Label" parent="Window/v/Tab/JOYPAD/v/CameraPlayerMove/h1"] [node name="space" type="Label" parent="Window/v/Tab/JOYPAD/v/CameraForward/h1"]
minimum_size = Vector2(50, 0) minimum_size = Vector2(50, 0)
offset_right = 40.0 offset_right = 40.0
offset_bottom = 23.0 offset_bottom = 23.0
[node name="SelectButton" type="Button" parent="Window/v/Tab/JOYPAD/v/CameraPlayerMove/h1"] [node name="CameraForward" type="Button" parent="Window/v/Tab/JOYPAD/v/CameraForward/h1"]
offset_right = 8.0 offset_right = 8.0
offset_bottom = 31.0 offset_bottom = 31.0
text = "SELECT" text = "SELECT"
[node name="h2" type="HBoxContainer" parent="Window/v/Tab/JOYPAD/v/CameraPlayerMove"] [node name="HSeparator3" type="HSeparator" parent="Window/v/Tab/JOYPAD/v"]
offset_right = 40.0
offset_bottom = 4.0
[node name="CameraBack" type="VBoxContainer" parent="Window/v/Tab/JOYPAD/v"]
offset_right = 40.0 offset_right = 40.0
offset_bottom = 40.0 offset_bottom = 40.0
[node name="space" type="Label" parent="Window/v/Tab/JOYPAD/v/CameraPlayerMove/h2"] [node name="Label" type="Label" parent="Window/v/Tab/JOYPAD/v/CameraBack"]
offset_right = 40.0
offset_bottom = 23.0
text = "INPUT_VIEW_CAMERA_BACK_JOYPAD"
[node name="h1" type="HBoxContainer" parent="Window/v/Tab/JOYPAD/v/CameraBack"]
offset_right = 40.0
offset_bottom = 40.0
[node name="space" type="Label" parent="Window/v/Tab/JOYPAD/v/CameraBack/h1"]
minimum_size = Vector2(50, 0) minimum_size = Vector2(50, 0)
offset_right = 40.0 offset_right = 40.0
offset_bottom = 23.0 offset_bottom = 23.0
[node name="ReverseHorizontal" type="CheckBox" parent="Window/v/Tab/JOYPAD/v/CameraPlayerMove/h2"] [node name="CameraBack" type="Button" parent="Window/v/Tab/JOYPAD/v/CameraBack/h1"]
offset_right = 24.0 offset_right = 8.0
offset_bottom = 31.0 offset_bottom = 31.0
text = "EDIT_CONTROL/MOVE_CAMERA_REVERSE_HORIZONTAL" text = "SELECT"
[node name="ReverseVertical" type="CheckBox" parent="Window/v/Tab/JOYPAD/v/CameraPlayerMove/h2"] [node name="HSeparator4" type="HSeparator" parent="Window/v/Tab/JOYPAD/v"]
offset_right = 24.0 offset_right = 40.0
offset_bottom = 4.0
[node name="PlayerLeft" type="VBoxContainer" parent="Window/v/Tab/JOYPAD/v"]
offset_right = 40.0
offset_bottom = 40.0
[node name="Label" type="Label" parent="Window/v/Tab/JOYPAD/v/PlayerLeft"]
offset_right = 40.0
offset_bottom = 23.0
text = "INPUT_ACTION_PLAYER_LEFT_JOYPAD"
[node name="h1" type="HBoxContainer" parent="Window/v/Tab/JOYPAD/v/PlayerLeft"]
offset_right = 40.0
offset_bottom = 40.0
[node name="space" type="Label" parent="Window/v/Tab/JOYPAD/v/PlayerLeft/h1"]
minimum_size = Vector2(50, 0)
offset_right = 40.0
offset_bottom = 23.0
[node name="PlayerLeft" type="Button" parent="Window/v/Tab/JOYPAD/v/PlayerLeft/h1"]
offset_right = 8.0
offset_bottom = 31.0 offset_bottom = 31.0
text = "EDIT_CONTROL/MOVE_CAMERA_REVERSE_VERTICAL" text = "SELECT"
[node name="HSeparator5" type="HSeparator" parent="Window/v/Tab/JOYPAD/v"]
offset_right = 40.0
offset_bottom = 4.0
[node name="PlayerRight" type="VBoxContainer" parent="Window/v/Tab/JOYPAD/v"]
offset_right = 40.0
offset_bottom = 40.0
[node name="Label" type="Label" parent="Window/v/Tab/JOYPAD/v/PlayerRight"]
offset_right = 40.0
offset_bottom = 23.0
text = "INPUT_ACTION_PLAYER_RIGHT_JOYPAD"
[node name="h1" type="HBoxContainer" parent="Window/v/Tab/JOYPAD/v/PlayerRight"]
offset_right = 40.0
offset_bottom = 40.0
[node name="space" type="Label" parent="Window/v/Tab/JOYPAD/v/PlayerRight/h1"]
minimum_size = Vector2(50, 0)
offset_right = 40.0
offset_bottom = 23.0
[node name="PlayerRight" type="Button" parent="Window/v/Tab/JOYPAD/v/PlayerRight/h1"]
offset_right = 8.0
offset_bottom = 31.0
text = "SELECT"
[node name="HSeparator6" type="HSeparator" parent="Window/v/Tab/JOYPAD/v"]
offset_right = 40.0
offset_bottom = 4.0
[node name="PlayerForward" type="VBoxContainer" parent="Window/v/Tab/JOYPAD/v"]
offset_right = 40.0
offset_bottom = 40.0
[node name="Label" type="Label" parent="Window/v/Tab/JOYPAD/v/PlayerForward"]
offset_right = 40.0
offset_bottom = 23.0
text = "INPUT_ACTION_PLAYER_FORWARD_JOYPAD"
[node name="h1" type="HBoxContainer" parent="Window/v/Tab/JOYPAD/v/PlayerForward"]
offset_right = 40.0
offset_bottom = 40.0
[node name="space" type="Label" parent="Window/v/Tab/JOYPAD/v/PlayerForward/h1"]
minimum_size = Vector2(50, 0)
offset_right = 40.0
offset_bottom = 23.0
[node name="PlayerForward" type="Button" parent="Window/v/Tab/JOYPAD/v/PlayerForward/h1"]
offset_right = 8.0
offset_bottom = 31.0
text = "SELECT"
[node name="HSeparator7" type="HSeparator" parent="Window/v/Tab/JOYPAD/v"]
offset_right = 40.0
offset_bottom = 4.0
[node name="PlayerBack" type="VBoxContainer" parent="Window/v/Tab/JOYPAD/v"]
offset_right = 40.0
offset_bottom = 40.0
[node name="Label" type="Label" parent="Window/v/Tab/JOYPAD/v/PlayerBack"]
offset_right = 40.0
offset_bottom = 23.0
text = "INPUT_ACTION_PLAYER_BACK_JOYPAD"
[node name="h1" type="HBoxContainer" parent="Window/v/Tab/JOYPAD/v/PlayerBack"]
offset_right = 40.0
offset_bottom = 40.0
[node name="space" type="Label" parent="Window/v/Tab/JOYPAD/v/PlayerBack/h1"]
minimum_size = Vector2(50, 0)
offset_right = 40.0
offset_bottom = 23.0
[node name="PlayerBack" type="Button" parent="Window/v/Tab/JOYPAD/v/PlayerBack/h1"]
offset_right = 8.0
offset_bottom = 31.0
text = "SELECT"
[node name="Quit" type="Button" parent="Window/v"] [node name="Quit" type="Button" parent="Window/v"]
anchor_left = 0.5 anchor_left = 0.5
@ -417,7 +495,12 @@ metadata/_edit_use_custom_anchors = false
[connection signal="pressed" from="Window/v/Tab/MOUSE/v/CameraPlayerMove/h1/SelectButton" to="." method="_on_select_mouse_button_camera_player_move_pressed"] [connection signal="pressed" from="Window/v/Tab/MOUSE/v/CameraPlayerMove/h1/SelectButton" to="." method="_on_select_mouse_button_camera_player_move_pressed"]
[connection signal="toggled" from="Window/v/Tab/MOUSE/v/CameraPlayerMove/h2/ReverseHorizontal" to="." method="_on_camera_player_move_reverse_horizontal_toggled"] [connection signal="toggled" from="Window/v/Tab/MOUSE/v/CameraPlayerMove/h2/ReverseHorizontal" to="." method="_on_camera_player_move_reverse_horizontal_toggled"]
[connection signal="toggled" from="Window/v/Tab/MOUSE/v/CameraPlayerMove/h2/ReverseVertical" to="." method="_on_camera_player_move_reverse_vertical_toggled"] [connection signal="toggled" from="Window/v/Tab/MOUSE/v/CameraPlayerMove/h2/ReverseVertical" to="." method="_on_camera_player_move_reverse_vertical_toggled"]
[connection signal="pressed" from="Window/v/Tab/JOYPAD/v/CameraPlayer/h1/SelectButton" to="." method="_on_select_joypad_button_camera_player_pressed"] [connection signal="pressed" from="Window/v/Tab/JOYPAD/v/CameraLeft/h1/CameraLeft" to="." method="_on_camera_left_pressed"]
[connection signal="pressed" from="Window/v/Tab/JOYPAD/v/CameraOnly/h1/SelectButton" to="." method="_on_select_joypad_button_camera_only_pressed"] [connection signal="pressed" from="Window/v/Tab/JOYPAD/v/CameraRight/h1/CameraRight" to="." method="_on_camera_right_pressed"]
[connection signal="pressed" from="Window/v/Tab/JOYPAD/v/CameraPlayerMove/h1/SelectButton" to="." method="_on_joypad_camera_player_move_button_pressed"] [connection signal="pressed" from="Window/v/Tab/JOYPAD/v/CameraForward/h1/CameraForward" to="." method="_on_camera_forward_pressed"]
[connection signal="pressed" from="Window/v/Tab/JOYPAD/v/CameraBack/h1/CameraBack" to="." method="_on_camera_back_pressed"]
[connection signal="pressed" from="Window/v/Tab/JOYPAD/v/PlayerLeft/h1/PlayerLeft" to="." method="_on_player_left_pressed"]
[connection signal="pressed" from="Window/v/Tab/JOYPAD/v/PlayerRight/h1/PlayerRight" to="." method="_on_player_right_pressed"]
[connection signal="pressed" from="Window/v/Tab/JOYPAD/v/PlayerForward/h1/PlayerForward" to="." method="_on_player_forward_pressed"]
[connection signal="pressed" from="Window/v/Tab/JOYPAD/v/PlayerBack/h1/PlayerBack" to="." method="_on_player_back_pressed"]
[connection signal="pressed" from="Window/v/Quit" to="." method="_on_quit_pressed"] [connection signal="pressed" from="Window/v/Quit" to="." method="_on_quit_pressed"]

View file

@ -35,7 +35,21 @@ func set_param(typeevent:int, _action):
elif typeevent == 3: elif typeevent == 3:
comment = "OPTION_DEFINE_INPUT/MESSAGE_JOYPAD" comment = "OPTION_DEFINE_INPUT/MESSAGE_JOYPAD"
elif typeevent == 4: elif typeevent == 4:
comment = "OPTION_DEFINE_INPUT/MESSAGE_JOYPAD" comment = "OPTION_DEFINE_INPUT/MESSAGE_CAMERA_LEFT_JOYPAD"
elif typeevent == 5:
comment = "OPTION_DEFINE_INPUT/MESSAGE_CAMERA_RIGHT_JOYPAD"
elif typeevent == 6:
comment = "OPTION_DEFINE_INPUT/MESSAGE_CAMERA_FORWARD_JOYPAD"
elif typeevent == 7:
comment = "OPTION_DEFINE_INPUT/MESSAGE_CAMERA_BACK_JOYPAD"
elif typeevent == 8:
comment = "OPTION_DEFINE_INPUT/MESSAGE_ACTION_LEFT_JOYPAD"
elif typeevent == 9:
comment = "OPTION_DEFINE_INPUT/MESSAGE_ACTION_RIGHT_JOYPAD"
elif typeevent == 10:
comment = "OPTION_DEFINE_INPUT/MESSAGE_ACTION_FORWARD_JOYPAD"
elif typeevent == 11:
comment = "OPTION_DEFINE_INPUT/MESSAGE_ACTION_BACK_JOYPAD"
else: else:
comment = "OPTION_DEFINE_INPUT/DISABLED" comment = "OPTION_DEFINE_INPUT/DISABLED"
type_event = typeevent type_event = typeevent
@ -56,7 +70,8 @@ func _on_cancel_pressed():
func _on_ok_pressed(): func _on_ok_pressed():
$Window.hide() $Window.hide()
Common.set_input_plus(action, last_event, last_last_event, self.type_event == 2) Common.msg_debug("type_event: " + str(self.type_event))
Common.set_input_plus(action, last_event, last_last_event, self.type_event == 2 or (self.type_event >= 4 and self.type_event <= 11))
emit_signal("refresh_control_define_input") emit_signal("refresh_control_define_input")
@ -66,7 +81,6 @@ func _on_window_window_input(event):
if focus_ok: if focus_ok:
return return
if (event is InputEventKey) && (self.type_event == 1): if (event is InputEventKey) && (self.type_event == 1):
#last_last_event = last_event
last_event = event last_event = event
$Window/v/result.set_text( Common.get_string_input(event) ) $Window/v/result.set_text( Common.get_string_input(event) )
elif event is InputEventMouseButton and self.type_event == 2: elif event is InputEventMouseButton and self.type_event == 2:
@ -89,23 +103,17 @@ func _on_window_window_input(event):
else: else:
$Window/v/result.set_text( tr(Common.get_string_input(event)) + " + " + tr(Common.get_string_input(last_last_event))) $Window/v/result.set_text( tr(Common.get_string_input(event)) + " + " + tr(Common.get_string_input(last_last_event)))
elif event is InputEventJoypadButton and self.type_event == 3: elif event is InputEventJoypadButton and self.type_event == 3:
#last_last_event = last_event
last_event = event last_event = event
$Window/v/result.set_text( Common.get_string_input(event) ) $Window/v/result.set_text( Common.get_string_input(event) )
elif event is InputEventJoypadMotion and self.type_event == 4: elif event is InputEventJoypadMotion and (self.type_event >= 4 and self.type_event <= 11):
#last_last_event = last_event if event.get_axis_value() < 0:
if not last_event: event.set_axis_value(-1.0)
last_event = event
elif last_event.get_axis() != event.get_axis():
last_last_event = last_event
last_event = event
if last_last_event != null:
$Window/v/result.set_text( "Axe:" + str(event.get_axis()) + " & " + str(last_last_event.get_axis()))
else: else:
$Window/v/result.set_text( "move all axes" ) event.set_axis_value(1.0)
last_event = event
$Window/v/result.set_text( Common.get_string_input(event) )
if last_event != null: if last_event != null:
if self.type_event != 4 or last_last_event != null: set_disabled(false)
set_disabled(false)
func _on_ok_mouse_entered(): func _on_ok_mouse_entered():

View file

@ -181,17 +181,24 @@ func get_input_plus(action:String):
func set_input(action:String, event, origin, eraselast:bool): func set_input(action:String, event, origin, eraselast:bool):
if eraselast: if eraselast:
for curaction in InputMap.get_actions(): # for curaction in InputMap.get_actions():
var text:String = curaction # var text:String = curaction
if text == action: # if text == action:
for z in InputMap.action_get_events(curaction): # for z in InputMap.action_get_events(curaction):
if origin is InputEventMouseButton and z is InputEventMouseButton: # if origin is InputEventMouseButton and z is InputEventMouseButton:
InputMap.action_erase_event(text, z) # InputMap.action_erase_event(text, z)
for z in InputMap.action_get_events(action):
if (origin is InputEventMouseButton and z is InputEventMouseButton) or \
(origin is InputEventJoypadMotion and z is InputEventJoypadMotion) or \
(origin is InputEventJoypadButton and z is InputEventJoypadButton):
InputMap.action_erase_event(action, z)
if event != null: if event != null:
Common.msg_debug("action: " + str(action) + " / event:" + str(event))
InputMap.action_add_event(action, event) InputMap.action_add_event(action, event)
func set_input_plus(action:String, event, eventplus, eraselast:bool): func set_input_plus(action:String, event, eventplus, eraselast:bool):
Common.msg_debug("set_input_plus: " + str(action) + " eraselast:" + str(eraselast))
set_input(action, event, event, eraselast) set_input(action, event, event, eraselast)
set_input(action + "_PLUS", eventplus, event, eraselast) set_input(action + "_PLUS", eventplus, event, eraselast)