godot/core/input/input.cpp

/**************************************************************************/
/*  input.cpp                                                             */
/**************************************************************************/
/*                         This file is part of:                          */
/*                             GODOT ENGINE                               */
/*                        https://godotengine.org                         */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur.                  */
/*                                                                        */
/* 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.h"
#include "input.compat.inc"

#include "core/config/project_settings.h"
#include "core/input/default_controller_mappings.h"
#include "core/input/input_map.h"
#include "core/os/os.h"

#ifdef DEV_ENABLED
#include "core/os/thread.h"
#endif

static const char *_joy_buttons[(size_t)JoyButton::SDL_MAX] =;

static const char *_joy_axes[(size_t)JoyAxis::SDL_MAX] =;

Input *Input::singleton =;

void (*Input::set_mouse_mode_func)(Input::MouseMode) =;
Input::MouseMode (*Input::get_mouse_mode_func)() =;
void (*Input::warp_mouse_func)(const Vector2 &p_position) =;
Input::CursorShape (*Input::get_current_cursor_shape_func)() =;
void (*Input::set_custom_mouse_cursor_func)(const Ref<Resource> &, Input::CursorShape, const Vector2 &) =;

Input *Input::get_singleton() {}

void Input::set_mouse_mode(MouseMode p_mode) {}

Input::MouseMode Input::get_mouse_mode() const {}

void Input::set_mouse_mode_override_enabled(bool p_enabled) {}

void Input::set_mouse_mode_override(MouseMode p_mode) {}

void Input::_bind_methods() {}

#ifdef TOOLS_ENABLED
void Input::get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const {}
#endif

void Input::VelocityTrack::update(const Vector2 &p_delta_p, const Vector2 &p_screen_delta_p) {}

void Input::VelocityTrack::reset() {}

Input::VelocityTrack::VelocityTrack() {}

bool Input::is_anything_pressed() const {}

bool Input::is_key_pressed(Key p_keycode) const {}

bool Input::is_physical_key_pressed(Key p_keycode) const {}

bool Input::is_key_label_pressed(Key p_keycode) const {}

bool Input::is_mouse_button_pressed(MouseButton p_button) const {}

static JoyAxis _combine_device(JoyAxis p_value, int p_device) {}

static JoyButton _combine_device(JoyButton p_value, int p_device) {}

bool Input::is_joy_button_pressed(int p_device, JoyButton p_button) const {}

bool Input::is_action_pressed(const StringName &p_action, bool p_exact) const {}

bool Input::is_action_just_pressed(const StringName &p_action, bool p_exact) const {}

bool Input::is_action_just_released(const StringName &p_action, bool p_exact) const {}

float Input::get_action_strength(const StringName &p_action, bool p_exact) const {}

float Input::get_action_raw_strength(const StringName &p_action, bool p_exact) const {}

float Input::get_axis(const StringName &p_negative_action, const StringName &p_positive_action) const {}

Vector2 Input::get_vector(const StringName &p_negative_x, const StringName &p_positive_x, const StringName &p_negative_y, const StringName &p_positive_y, float p_deadzone) const {}

float Input::get_joy_axis(int p_device, JoyAxis p_axis) const {}

String Input::get_joy_name(int p_idx) {}

Vector2 Input::get_joy_vibration_strength(int p_device) {}

uint64_t Input::get_joy_vibration_timestamp(int p_device) {}

float Input::get_joy_vibration_duration(int p_device) {}

static String _hex_str(uint8_t p_byte) {}

void Input::joy_connection_changed(int p_idx, bool p_connected, const String &p_name, const String &p_guid, const Dictionary &p_joypad_info) {}

Vector3 Input::get_gravity() const {}

Vector3 Input::get_accelerometer() const {}

Vector3 Input::get_magnetometer() const {}

Vector3 Input::get_gyroscope() const {}

void Input::_parse_input_event_impl(const Ref<InputEvent> &p_event, bool p_is_emulated) {}

void Input::set_joy_axis(int p_device, JoyAxis p_axis, float p_value) {}

void Input::start_joy_vibration(int p_device, float p_weak_magnitude, float p_strong_magnitude, float p_duration) {}

void Input::stop_joy_vibration(int p_device) {}

void Input::vibrate_handheld(int p_duration_ms, float p_amplitude) {}

void Input::set_gravity(const Vector3 &p_gravity) {}

void Input::set_accelerometer(const Vector3 &p_accel) {}

void Input::set_magnetometer(const Vector3 &p_magnetometer) {}

void Input::set_gyroscope(const Vector3 &p_gyroscope) {}

void Input::set_mouse_position(const Point2 &p_posf) {}

Point2 Input::get_mouse_position() const {}

Point2 Input::get_last_mouse_velocity() {}

Point2 Input::get_last_mouse_screen_velocity() {}

BitField<MouseButtonMask> Input::get_mouse_button_mask() const {}

void Input::warp_mouse(const Vector2 &p_position) {}

Point2 Input::warp_mouse_motion(const Ref<InputEventMouseMotion> &p_motion, const Rect2 &p_rect) {}

void Input::action_press(const StringName &p_action, float p_strength) {}

void Input::action_release(const StringName &p_action) {}

void Input::set_emulate_touch_from_mouse(bool p_emulate) {}

bool Input::is_emulating_touch_from_mouse() const {}

// Calling this whenever the game window is focused helps unsticking the "touch mouse"
// if the OS or its abstraction class hasn't properly reported that touch pointers raised
void Input::ensure_touch_mouse_raised() {}

void Input::set_emulate_mouse_from_touch(bool p_emulate) {}

bool Input::is_emulating_mouse_from_touch() const {}

Input::CursorShape Input::get_default_cursor_shape() const {}

void Input::set_default_cursor_shape(CursorShape p_shape) {}

Input::CursorShape Input::get_current_cursor_shape() const {}

void Input::set_custom_mouse_cursor(const Ref<Resource> &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot) {}

void Input::parse_input_event(const Ref<InputEvent> &p_event) {}

#ifdef DEBUG_ENABLED
void Input::flush_frame_parsed_events() {}
#endif

void Input::flush_buffered_events() {}

bool Input::is_agile_input_event_flushing() {}

void Input::set_agile_input_event_flushing(bool p_enable) {}

void Input::set_use_accumulated_input(bool p_enable) {}

bool Input::is_using_accumulated_input() {}

void Input::release_pressed_events() {}

void Input::set_event_dispatch_function(EventDispatchFunc p_function) {}

void Input::joy_button(int p_device, JoyButton p_button, bool p_pressed) {}

void Input::joy_axis(int p_device, JoyAxis p_axis, float p_value) {}

void Input::joy_hat(int p_device, BitField<HatMask> p_val) {}

void Input::_button_event(int p_device, JoyButton p_index, bool p_pressed) {}

void Input::_axis_event(int p_device, JoyAxis p_axis, float p_value) {}

void Input::_update_action_cache(const StringName &p_action_name, ActionState &r_action_state) {}

Input::JoyEvent Input::_get_mapped_button_event(const JoyDeviceMapping &mapping, JoyButton p_button) {}

Input::JoyEvent Input::_get_mapped_axis_event(const JoyDeviceMapping &mapping, JoyAxis p_axis, float p_value, JoyAxisRange &r_range) {}

void Input::_get_mapped_hat_events(const JoyDeviceMapping &mapping, HatDir p_hat, JoyEvent r_events[(size_t)HatDir::MAX]) {}

JoyButton Input::_get_output_button(const String &output) {}

JoyAxis Input::_get_output_axis(const String &output) {}

void Input::parse_mapping(const String &p_mapping) {}

void Input::add_joy_mapping(const String &p_mapping, bool p_update_existing) {}

void Input::remove_joy_mapping(const String &p_guid) {}

void Input::set_fallback_mapping(const String &p_guid) {}

//platforms that use the remapping system can override and call to these ones
bool Input::is_joy_known(int p_device) {}

String Input::get_joy_guid(int p_device) const {}

Dictionary Input::get_joy_info(int p_device) const {}

bool Input::should_ignore_device(int p_vendor_id, int p_product_id) const {}

TypedArray<int> Input::get_connected_joypads() {}

int Input::get_unused_joy_id() {}

void Input::set_disable_input(bool p_disable) {}

bool Input::is_input_disabled() const {}

Input::Input() {}

Input::~Input() {}

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