Added helper methods to InputEvent
This commit is contained in:
parent
e42aed6ed0
commit
e6fb0cf970
3 changed files with 16 additions and 0 deletions
|
|
@ -173,6 +173,16 @@ bool InputEvent::is_action(const String& p_action) const {
|
|||
return InputMap::get_singleton()->event_is_action(*this,p_action);
|
||||
}
|
||||
|
||||
bool InputEvent::is_action_pressed(const String& p_action) const {
|
||||
|
||||
return is_action(p_action) && is_pressed() && !is_echo();
|
||||
}
|
||||
|
||||
bool InputEvent::is_action_released(const String& p_action) const {
|
||||
|
||||
return is_action(p_action) && !is_pressed();
|
||||
}
|
||||
|
||||
uint32_t InputEventKey::get_scancode_with_modifiers() const {
|
||||
|
||||
uint32_t sc=scancode;
|
||||
|
|
|
|||
|
|
@ -287,6 +287,8 @@ struct InputEvent {
|
|||
|
||||
bool is_pressed() const;
|
||||
bool is_action(const String& p_action) const;
|
||||
bool is_action_pressed(const String& p_action) const;
|
||||
bool is_action_released(const String& p_action) const;
|
||||
bool is_echo() const;
|
||||
void set_as_action(const String& p_action, bool p_pressed);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue