You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-26 15:46:23 +00:00
Merge pull request #67783 from EricEzaM/67715-input-event-action-as-text
Make InputEventAction as_text() return the text of the first valid event for the action.
This commit is contained in:
@@ -1499,7 +1499,18 @@ bool InputEventAction::action_match(const Ref<InputEvent> &p_event, bool p_exact
|
|||||||
}
|
}
|
||||||
|
|
||||||
String InputEventAction::as_text() const {
|
String InputEventAction::as_text() const {
|
||||||
return vformat(RTR("Input Action %s was %s"), action, pressed ? "pressed" : "released");
|
const List<Ref<InputEvent>> *events = InputMap::get_singleton()->action_get_events(action);
|
||||||
|
if (!events) {
|
||||||
|
return String();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const Ref<InputEvent> &E : *events) {
|
||||||
|
if (E.is_valid()) {
|
||||||
|
return E->as_text();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return String();
|
||||||
}
|
}
|
||||||
|
|
||||||
String InputEventAction::to_string() {
|
String InputEventAction::to_string() {
|
||||||
|
|||||||
Reference in New Issue
Block a user