Exemplo n.º 1
0
bool InputEventKey::shortcut_match(const Ref<InputEvent> &p_event) const {

	Ref<InputEventKey> key = p_event;
	if (key.is_null())
		return false;

	uint32_t code = get_scancode_with_modifiers();
	uint32_t event_code = key->get_scancode_with_modifiers();

	return code == event_code;
}
Exemplo n.º 2
0
bool InputEventKey::action_match(const Ref<InputEvent> &p_event) const {

	Ref<InputEventKey> key = p_event;
	if (key.is_null())
		return false;

	uint32_t code = get_scancode_with_modifiers();
	uint32_t event_code = key->get_scancode_with_modifiers();

	return get_scancode() == key->get_scancode() && (!key->is_pressed() || (code & event_code) == code);
}
Exemplo n.º 3
0
bool InputEventKey::action_match(const Ref<InputEvent> &p_event, bool *p_pressed, float *p_strength, float p_deadzone) const {

	Ref<InputEventKey> key = p_event;
	if (key.is_null())
		return false;

	uint32_t code = get_scancode_with_modifiers();
	uint32_t event_code = key->get_scancode_with_modifiers();

	bool match = get_scancode() == key->get_scancode() && (!key->is_pressed() || (code & event_code) == code);
	if (match) {
		if (p_pressed != NULL)
			*p_pressed = key->is_pressed();
		if (p_strength != NULL)
			*p_strength = (*p_pressed) ? 1.0f : 0.0f;
	}
	return match;
}