add extra checks for getting controller button prompts
This commit is contained in:
parent
bfc3c214b7
commit
e54ea071fc
@ -97,10 +97,10 @@ func get_action_prompt(action: StringName) -> String:
|
||||
if event_bbcode:
|
||||
bbcode.append(event_bbcode)
|
||||
|
||||
if bbcode.size() != 0:
|
||||
if bbcode.size() > 0:
|
||||
return " / ".join(bbcode)
|
||||
|
||||
return _get_event_prompt(events[0]) if events.size() != 0 else "???"
|
||||
return _get_event_prompt(events[0]) if events.size() > 0 else "???"
|
||||
|
||||
|
||||
func _get_event_prompt_current_mode(event: InputEvent) -> String:
|
||||
@ -135,7 +135,17 @@ func _get_kb_mouse_prompt(event: InputEvent) -> String:
|
||||
func _get_controller_prompt(event: InputEvent) -> String:
|
||||
if event is InputEventJoypadButton:
|
||||
var button_event := event as InputEventJoypadButton
|
||||
return _get_prompt_sprite(button_event.button_index)
|
||||
if (
|
||||
(
|
||||
button_event.button_index >= JOY_BUTTON_A
|
||||
and button_event.button_index <= JOY_BUTTON_BACK
|
||||
)
|
||||
or (
|
||||
button_event.button_index >= JOY_BUTTON_START
|
||||
and button_event.button_index <= JOY_BUTTON_DPAD_RIGHT
|
||||
)
|
||||
):
|
||||
return _get_prompt_sprite(button_event.button_index)
|
||||
|
||||
if event is InputEventJoypadMotion:
|
||||
var motion_event := event as InputEventJoypadMotion
|
||||
|
||||
Loading…
Reference in New Issue
Block a user