Added helper methods to InputEvent

This commit is contained in:
Jaguar 2015-06-23 16:24:48 -04:00
parent e42aed6ed0
commit e6fb0cf970
3 changed files with 16 additions and 0 deletions

View file

@ -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;

View file

@ -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);