add extra checks for getting controller button prompts
This commit is contained in:
@@ -97,10 +97,10 @@ func get_action_prompt(action: StringName) -> String:
|
|||||||
if event_bbcode:
|
if event_bbcode:
|
||||||
bbcode.append(event_bbcode)
|
bbcode.append(event_bbcode)
|
||||||
|
|
||||||
if bbcode.size() != 0:
|
if bbcode.size() > 0:
|
||||||
return " / ".join(bbcode)
|
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:
|
func _get_event_prompt_current_mode(event: InputEvent) -> String:
|
||||||
@@ -135,6 +135,16 @@ func _get_kb_mouse_prompt(event: InputEvent) -> String:
|
|||||||
func _get_controller_prompt(event: InputEvent) -> String:
|
func _get_controller_prompt(event: InputEvent) -> String:
|
||||||
if event is InputEventJoypadButton:
|
if event is InputEventJoypadButton:
|
||||||
var button_event := event as InputEventJoypadButton
|
var button_event := event as InputEventJoypadButton
|
||||||
|
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)
|
return _get_prompt_sprite(button_event.button_index)
|
||||||
|
|
||||||
if event is InputEventJoypadMotion:
|
if event is InputEventJoypadMotion:
|
||||||
|
|||||||
Reference in New Issue
Block a user