<commit_before>/*************************************************************************/
/*  input_event.cpp                                                      */
/*************************************************************************/
/*                       This file is part of:                           */
/*                           GODOT ENGINE                                */
/*                      https://godotengine.org                          */
/*************************************************************************/
/* Copyright (c) 2007-2020 <NAME>, <NAME>.                 */
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md).   */
/*                                                                       */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the       */
/* "Software"), to deal in the Software without restriction, including   */
/* without limitation the rights to use, copy, modify, merge, publish,   */
/* distribute, sublicense, and/or sell copies of the Software, and to    */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions:                                             */
/*                                                                       */
/* The above copyright notice and this permission notice shall be        */
/* included in all copies or substantial portions of the Software.       */
/*                                                                       */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,       */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF    */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY  */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,  */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE     */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */
/*************************************************************************/

#include "input_event.h"

#include "core/input_map.h"
#include "core/os/keyboard.h"

const int InputEvent::DEVICE_ID_TOUCH_MOUSE = -1;
const int InputEvent::DEVICE_ID_INTERNAL = -2;

void InputEvent::set_device(int p_device) {
	device = p_device;
}

int InputEvent::get_device() const {
	return device;
}

bool InputEvent::is_action(const StringName &p_action) const {

	return InputMap::get_singleton()->event_is_action(Ref<InputEvent>((InputEvent *)this), p_action);
}

bool InputEvent::is_action_pressed(const StringName &p_action, bool p_allow_echo) const {

	bool pressed;
	bool valid = InputMap::get_singleton()->event_get_action_status(Ref<InputEvent>((InputEvent *)this), p_action, &pressed);
	return valid && pressed && (p_allow_echo || !is_echo());
}

bool InputEvent::is_action_released(const StringName &p_action) const {

	bool pressed;
	bool valid = InputMap::get_singleton()->event_get_action_status(Ref<InputEvent>((InputEvent *)this), p_action, &pressed);
	return valid && !pressed;
}

float InputEvent::get_action_strength(const StringName &p_action) const {

	bool pressed;
	float strength;
	bool valid = InputMap::get_singleton()->event_get_action_status(Ref<InputEvent>((InputEvent *)this), p_action, &pressed, &strength);
	return valid ? strength : 0.0f;
}

bool InputEvent::is_pressed() const {

	return false;
}

bool InputEvent::is_echo() const {

	return false;
}

Ref<InputEvent> InputEvent::xformed_by(const Transform2D &p_xform, const Vector2 &p_local_ofs) const {

	return Ref<InputEvent>((InputEvent *)this);
}

String InputEvent::as_text() const {

	return String();
}

bool InputEvent::action_match(const Ref<InputEvent> &p_event, bool *p_pressed, float *p_strength, float p_deadzone) const {

	return false;
}

bool InputEvent::shortcut_match(const Ref<InputEvent> &p_event) const {

	return false;
}

bool InputEvent::is_action_type() const {

	return false;
}

void InputEvent::_bind_methods() {

	ClassDB::bind_method(D_METHOD("set_device", "device"), &InputEvent::set_device);
	ClassDB::bind_method(D_METHOD("get_device"), &InputEvent::get_device);

	ClassDB::bind_method(D_METHOD("is_action", "action"), &InputEvent::is_action);
	ClassDB::bind_method(D_METHOD("is_action_pressed", "action", "allow_echo"), &InputEvent::is_action_pressed, DEFVAL(false));
	ClassDB::bind_method(D_METHOD("is_action_released", "action"), &InputEvent::is_action_released);
	ClassDB::bind_method(D_METHOD("get_action_strength", "action"), &InputEvent::get_action_strength);

	ClassDB::bind_method(D_METHOD("is_pressed"), &InputEvent::is_pressed);
	ClassDB::bind_method(D_METHOD("is_echo"), &InputEvent::is_echo);

	ClassDB::bind_method(D_METHOD("as_text"), &InputEvent::as_text);

	ClassDB::bind_method(D_METHOD("shortcut_match", "event"), &InputEvent::shortcut_match);

	ClassDB::bind_method(D_METHOD("is_action_type"), &InputEvent::is_action_type);

	ClassDB::bind_method(D_METHOD("accumulate", "with_event"), &InputEvent::accumulate);

	ClassDB::bind_method(D_METHOD("xformed_by", "xform", "local_ofs"), &InputEvent::xformed_by, DEFVAL(Vector2()));

	ADD_PROPERTY(PropertyInfo(Variant::INT, "device"), "set_device", "get_device");
}

InputEvent::InputEvent() {

	device = 0;
}

//////////////////

void InputEventWithModifiers::set_shift(bool p_enabled) {

	shift = p_enabled;
}

bool InputEventWithModifiers::get_shift() const {

	return shift;
}

void InputEventWithModifiers::set_alt(bool p_enabled) {

	alt = p_enabled;
}
bool InputEventWithModifiers::get_alt() const {

	return alt;
}

void InputEventWithModifiers::set_control(bool p_enabled) {

	control = p_enabled;
}
bool InputEventWithModifiers::get_control() const {

	return control;
}

void InputEventWithModifiers::set_metakey(bool p_enabled) {

	meta = p_enabled;
}
bool InputEventWithModifiers::get_metakey() const {

	return meta;
}

void InputEventWithModifiers::set_command(bool p_enabled) {

	command = p_enabled;
}
bool InputEventWithModifiers::get_command() const {

	return command;
}

void InputEventWithModifiers::set_modifiers_from_event(const InputEventWithModifiers *event) {

	set_alt(event->get_alt());
	set_shift(event->get_shift());
	set_control(event->get_control());
	set_metakey(event->get_metakey());
}

void InputEventWithModifiers::_bind_methods() {

	ClassDB::bind_method(D_METHOD("set_alt", "enable"), &InputEventWithModifiers::set_alt);
	ClassDB::bind_method(D_METHOD("get_alt"), &InputEventWithModifiers::get_alt);

	ClassDB::bind_method(D_METHOD("set_shift", "enable"), &InputEventWithModifiers::set_shift);
	ClassDB::bind_method(D_METHOD("get_shift"), &InputEventWithModifiers::get_shift);

	ClassDB::bind_method(D_METHOD("set_control", "enable"), &InputEventWithModifiers::set_control);
	ClassDB::bind_method(D_METHOD("get_control"), &InputEventWithModifiers::get_control);

	ClassDB::bind_method(D_METHOD("set_metakey", "enable"), &InputEventWithModifiers::set_metakey);
	ClassDB::bind_method(D_METHOD("get_metakey"), &InputEventWithModifiers::get_metakey);

	ClassDB::bind_method(D_METHOD("set_command", "enable"), &InputEventWithModifiers::set_command);
	ClassDB::bind_method(D_METHOD("get_command"), &InputEventWithModifiers::get_command);

	ADD_PROPERTY(PropertyInfo(Variant::BOOL, "alt"), "set_alt", "get_alt");
	ADD_PROPERTY(PropertyInfo(Variant::BOOL, "shift"), "set_shift", "get_shift");
	ADD_PROPERTY(PropertyInfo(Variant::BOOL, "control"), "set_control", "get_control");
	ADD_PROPERTY(PropertyInfo(Variant::BOOL, "meta"), "set_metakey", "get_metakey");
	ADD_PROPERTY(PropertyInfo(Variant::BOOL, "command"), "set_command", "get_command");
}

InputEventWithModifiers::InputEventWithModifiers() {

	alt = false;
	shift = false;
	control = false;
	meta = false;
}

//////////////////////////////////

void InputEventKey::set_pressed(bool p_pressed) {

	pressed = p_pressed;
}

bool InputEventKey::is_pressed() const {

	return pressed;
}

void InputEventKey::set_scancode(uint32_t p_scancode) {

	scancode = p_scancode;
}
uint32_t InputEventKey::get_scancode() const {

	return scancode;
}

void InputEventKey::set_unicode(uint32_t p_unicode) {

	unicode = p_unicode;
}
uint32_t InputEventKey::get_unicode() const {

	return unicode;
}

void InputEventKey::set_echo(bool p_enable) {

	echo = p_enable;
}
bool InputEventKey::is_echo() const {

	return echo;
}

uint32_t InputEventKey::get_scancode_with_modifiers() const {

	uint32_t sc = scancode;
	if (get_control())
		sc |= KEY_MASK_CTRL;
	if (get_alt())
		sc |= KEY_MASK_ALT;
	if (get_shift())
		sc |= KEY_MASK_SHIFT;
	if (get_metakey())
		sc |= KEY_MASK_META;

	return sc;
}

String InputEventKey::as_text() const {

	String kc = keycode_get_string(scancode);
	if (kc == String())
		return kc;

	if (get_metakey()) {
		kc = find_keycode_name(KEY_META) + ("+" + kc);
	}
	if (get_alt()) {
		kc = find_keycode_name(KEY_ALT) + ("+" + kc);
	}
	if (get_shift()) {
		kc = find_keycode_name(KEY_SHIFT) + ("+" + kc);
	}
	if (get_control()) {
		kc = find_keycode_name(KEY_CONTROL) + ("+" + kc);
	}
	return kc;
}

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 != NULL && *p_pressed) ? 1.0f : 0.0f;
	}
	return match;
}

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

void InputEventKey::_bind_methods() {

	ClassDB::bind_method(D_METHOD("set_pressed", "pressed"), &InputEventKey::set_pressed);

	ClassDB::bind_method(D_METHOD("set_scancode", "scancode"), &InputEventKey::set_scancode);
	ClassDB::bind_method(D_METHOD("get_scancode"), &InputEventKey::get_scancode);

	ClassDB::bind_method(D_METHOD("set_unicode", "unicode"), &InputEventKey::set_unicode);
	ClassDB::bind_method(D_METHOD("get_unicode"), &InputEventKey::get_unicode);

	ClassDB::bind_method(D_METHOD("set_echo", "echo"), &InputEventKey::set_echo);

	ClassDB::bind_method(D_METHOD("get_scancode_with_modifiers"), &InputEventKey::get_scancode_with_modifiers);

	ADD_PROPERTY(PropertyInfo(Variant::BOOL, "pressed"), "set_pressed", "is_pressed");
	ADD_PROPERTY(PropertyInfo(Variant::INT, "scancode"), "set_scancode", "get_scancode");
	ADD_PROPERTY(PropertyInfo(Variant::INT, "unicode"), "set_unicode", "get_unicode");
	ADD_PROPERTY(PropertyInfo(Variant::INT, "echo"), "set_echo", "is_echo");
}

InputEventKey::InputEventKey() {

	pressed = false;
	scancode = 0;
	unicode = 0; ///unicode
	echo = false;
}

////////////////////////////////////////

void InputEventMouse::set_button_mask(int p_mask) {

	button_mask = p_mask;
}
int InputEventMouse::get_button_mask() const {

	return button_mask;
}

void InputEventMouse::set_position(const Vector2 &p_pos) {

	pos = p_pos;
}
Vector2 InputEventMouse::get_position() const {

	return pos;
}

void InputEventMouse::set_global_position(const Vector2 &p_global_pos) {<commit_msg>Fix InputEventKey::echo type from INT to BOOL<commit_after>/*************************************************************************/
/*  input_event.cpp                                                      */
/*************************************************************************/
/*                       This file is part of:                           */
/*                           GODOT ENGINE                                */
/*                      https://godotengine.org                          */
/*************************************************************************/
/* Copyright (c) 2007-2020 <NAME>, <NAME>.                 */
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md).   */
/*                                                                       */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the       */
/* "Software"), to deal in the Software without restriction, including   */
/* without limitation the rights to use, copy, modify, merge, publish,   */
/* distribute, sublicense, and/or sell copies of the Software, and to    */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions:                                             */
/*                                                                       */
/* The above copyright notice and this permission notice shall be        */
/* included in all copies or substantial portions of the Software.       */
/*                                                                       */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,       */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF    */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY  */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,  */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE     */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */
/*************************************************************************/

#include "input_event.h"

#include "core/input_map.h"
#include "core/os/keyboard.h"

const int InputEvent::DEVICE_ID_TOUCH_MOUSE = -1;
const int InputEvent::DEVICE_ID_INTERNAL = -2;

void InputEvent::set_device(int p_device) {
	device = p_device;
}

int InputEvent::get_device() const {
	return device;
}

bool InputEvent::is_action(const StringName &p_action) const {

	return InputMap::get_singleton()->event_is_action(Ref<InputEvent>((InputEvent *)this), p_action);
}

bool InputEvent::is_action_pressed(const StringName &p_action, bool p_allow_echo) const {

	bool pressed;
	bool valid = InputMap::get_singleton()->event_get_action_status(Ref<InputEvent>((InputEvent *)this), p_action, &pressed);
	return valid && pressed && (p_allow_echo || !is_echo());
}

bool InputEvent::is_action_released(const StringName &p_action) const {

	bool pressed;
	bool valid = InputMap::get_singleton()->event_get_action_status(Ref<InputEvent>((InputEvent *)this), p_action, &pressed);
	return valid && !pressed;
}

float InputEvent::get_action_strength(const StringName &p_action) const {

	bool pressed;
	float strength;
	bool valid = InputMap::get_singleton()->event_get_action_status(Ref<InputEvent>((InputEvent *)this), p_action, &pressed, &strength);
	return valid ? strength : 0.0f;
}

bool InputEvent::is_pressed() const {

	return false;
}

bool InputEvent::is_echo() const {

	return false;
}

Ref<InputEvent> InputEvent::xformed_by(const Transform2D &p_xform, const Vector2 &p_local_ofs) const {

	return Ref<InputEvent>((InputEvent *)this);
}

String InputEvent::as_text() const {

	return String();
}

bool InputEvent::action_match(const Ref<InputEvent> &p_event, bool *p_pressed, float *p_strength, float p_deadzone) const {

	return false;
}

bool InputEvent::shortcut_match(const Ref<InputEvent> &p_event) const {

	return false;
}

bool InputEvent::is_action_type() const {

	return false;
}

void InputEvent::_bind_methods() {

	ClassDB::bind_method(D_METHOD("set_device", "device"), &InputEvent::set_device);
	ClassDB::bind_method(D_METHOD("get_device"), &InputEvent::get_device);

	ClassDB::bind_method(D_METHOD("is_action", "action"), &InputEvent::is_action);
	ClassDB::bind_method(D_METHOD("is_action_pressed", "action", "allow_echo"), &InputEvent::is_action_pressed, DEFVAL(false));
	ClassDB::bind_method(D_METHOD("is_action_released", "action"), &InputEvent::is_action_released);
	ClassDB::bind_method(D_METHOD("get_action_strength", "action"), &InputEvent::get_action_strength);

	ClassDB::bind_method(D_METHOD("is_pressed"), &InputEvent::is_pressed);
	ClassDB::bind_method(D_METHOD("is_echo"), &InputEvent::is_echo);

	ClassDB::bind_method(D_METHOD("as_text"), &InputEvent::as_text);

	ClassDB::bind_method(D_METHOD("shortcut_match", "event"), &InputEvent::shortcut_match);

	ClassDB::bind_method(D_METHOD("is_action_type"), &InputEvent::is_action_type);

	ClassDB::bind_method(D_METHOD("accumulate", "with_event"), &InputEvent::accumulate);

	ClassDB::bind_method(D_METHOD("xformed_by", "xform", "local_ofs"), &InputEvent::xformed_by, DEFVAL(Vector2()));

	ADD_PROPERTY(PropertyInfo(Variant::INT, "device"), "set_device", "get_device");
}

InputEvent::InputEvent() {

	device = 0;
}

//////////////////

void InputEventWithModifiers::set_shift(bool p_enabled) {

	shift = p_enabled;
}

bool InputEventWithModifiers::get_shift() const {

	return shift;
}

void InputEventWithModifiers::set_alt(bool p_enabled) {

	alt = p_enabled;
}
bool InputEventWithModifiers::get_alt() const {

	return alt;
}

void InputEventWithModifiers::set_control(bool p_enabled) {

	control = p_enabled;
}
bool InputEventWithModifiers::get_control() const {

	return control;
}

void InputEventWithModifiers::set_metakey(bool p_enabled) {

	meta = p_enabled;
}
bool InputEventWithModifiers::get_metakey() const {

	return meta;
}

void InputEventWithModifiers::set_command(bool p_enabled) {

	command = p_enabled;
}
bool InputEventWithModifiers::get_command() const {

	return command;
}

void InputEventWithModifiers::set_modifiers_from_event(const InputEventWithModifiers *event) {

	set_alt(event->get_alt());
	set_shift(event->get_shift());
	set_control(event->get_control());
	set_metakey(event->get_metakey());
}

void InputEventWithModifiers::_bind_methods() {

	ClassDB::bind_method(D_METHOD("set_alt", "enable"), &InputEventWithModifiers::set_alt);
	ClassDB::bind_method(D_METHOD("get_alt"), &InputEventWithModifiers::get_alt);

	ClassDB::bind_method(D_METHOD("set_shift", "enable"), &InputEventWithModifiers::set_shift);
	ClassDB::bind_method(D_METHOD("get_shift"), &InputEventWithModifiers::get_shift);

	ClassDB::bind_method(D_METHOD("set_control", "enable"), &InputEventWithModifiers::set_control);
	ClassDB::bind_method(D_METHOD("get_control"), &InputEventWithModifiers::get_control);

	ClassDB::bind_method(D_METHOD("set_metakey", "enable"), &InputEventWithModifiers::set_metakey);
	ClassDB::bind_method(D_METHOD("get_metakey"), &InputEventWithModifiers::get_metakey);

	ClassDB::bind_method(D_METHOD("set_command", "enable"), &InputEventWithModifiers::set_command);
	ClassDB::bind_method(D_METHOD("get_command"), &InputEventWithModifiers::get_command);

	ADD_PROPERTY(PropertyInfo(Variant::BOOL, "alt"), "set_alt", "get_alt");
	ADD_PROPERTY(PropertyInfo(Variant::BOOL, "shift"), "set_shift", "get_shift");
	ADD_PROPERTY(PropertyInfo(Variant::BOOL, "control"), "set_control", "get_control");
	ADD_PROPERTY(PropertyInfo(Variant::BOOL, "meta"), "set_metakey", "get_metakey");
	ADD_PROPERTY(PropertyInfo(Variant::BOOL, "command"), "set_command", "get_command");
}

InputEventWithModifiers::InputEventWithModifiers() {

	alt = false;
	shift = false;
	control = false;
	meta = false;
}

//////////////////////////////////

void InputEventKey::set_pressed(bool p_pressed) {

	pressed = p_pressed;
}

bool InputEventKey::is_pressed() const {

	return pressed;
}

void InputEventKey::set_scancode(uint32_t p_scancode) {

	scancode = p_scancode;
}
uint32_t InputEventKey::get_scancode() const {

	return scancode;
}

void InputEventKey::set_unicode(uint32_t p_unicode) {

	unicode = p_unicode;
}
uint32_t InputEventKey::get_unicode() const {

	return unicode;
}

void InputEventKey::set_echo(bool p_enable) {

	echo = p_enable;
}
bool InputEventKey::is_echo() const {

	return echo;
}

uint32_t InputEventKey::get_scancode_with_modifiers() const {

	uint32_t sc = scancode;
	if (get_control())
		sc |= KEY_MASK_CTRL;
	if (get_alt())
		sc |= KEY_MASK_ALT;
	if (get_shift())
		sc |= KEY_MASK_SHIFT;
	if (get_metakey())
		sc |= KEY_MASK_META;

	return sc;
}

String InputEventKey::as_text() const {

	String kc = keycode_get_string(scancode);
	if (kc == String())
		return kc;

	if (get_metakey()) {
		kc = find_keycode_name(KEY_META) + ("+" + kc);
	}
	if (get_alt()) {
		kc = find_keycode_name(KEY_ALT) + ("+" + kc);
	}
	if (get_shift()) {
		kc = find_keycode_name(KEY_SHIFT) + ("+" + kc);
	}
	if (get_control()) {
		kc = find_keycode_name(KEY_CONTROL) + ("+" + kc);
	}
	return kc;
}

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 != NULL && *p_pressed) ? 1.0f : 0.0f;
	}
	return match;
}

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

void InputEventKey::_bind_methods() {

	ClassDB::bind_method(D_METHOD("set_pressed", "pressed"), &InputEventKey::set_pressed);

	ClassDB::bind_method(D_METHOD("set_scancode", "scancode"), &InputEventKey::set_scancode);
	ClassDB::bind_method(D_METHOD("get_scancode"), &InputEventKey::get_scancode);

	ClassDB::bind_method(D_METHOD("set_unicode", "unicode"), &InputEventKey::set_unicode);
	ClassDB::bind_method(D_METHOD("get_unicode"), &InputEventKey::get_unicode);

	ClassDB::bind_method(D_METHOD("set_echo", "echo"), &InputEventKey::set_echo);

	ClassDB::bind_method(D_METHOD("get_scancode_with_modifiers"), &InputEventKey::get_scancode_with_modifiers);

	ADD_PROPERTY(PropertyInfo(Variant::BOOL, "pressed"), "set_pressed", "is_pressed");
	ADD_PROPERTY(PropertyInfo(Variant::INT, "scancode"), "set_scancode", "get_scancode");
	ADD_PROPERTY(PropertyInfo(Variant::INT, "unicode"), "set_unicode", "get_unicode");
	ADD_PROPERTY(PropertyInfo(Variant::BOOL, "echo"), "set_echo", "is_echo");
}

InputEventKey::InputEventKey() {

	pressed = false;
	scancode = 0;
	unicode = 0; ///unicode
	echo = false;
}

////////////////////////////////////////

void InputEventMouse::set_button_mask(int p_mask) {

	button_mask = p_mask;
}
int InputEventMouse::get_button_mask() const {

	return button_mask;
}

void InputEventMouse::set_position(const Vector2 &p_pos) {

	pos = p_pos;
}
Vector2 InputEventMouse::get_position() const {

	return pos;
}

void InputEventMouse::set_global_position(const Vector2 &p_global_pos) {
{'fraction_non_alphanumeric': 0.16595579682047304, 'fraction_numerical': 0.004566800224031709, 'mean_word_length': 4.932021466905188, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 57, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 26, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4191019', 'n_tokens_mistral': 7726, 'n_tokens_neox': 7384, 'n_words': 1456}