mirror of
https://github.com/Relintai/sfw.git
synced 2024-12-20 21:06:49 +01:00
Removed Joy, Touch, and midi handling.
This commit is contained in:
parent
a6938d2d29
commit
ad11438d7d
@ -63,7 +63,6 @@ ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/render_core/texture.cpp -o sfw/ren
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/render_core/image.cpp -o sfw/render_core/image.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/render_core/render_state.cpp -o sfw/render_core/render_state.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/render_core/input/keyboard.cpp -o sfw/render_core/input/keyboard.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/render_core/input/default_controller_mappings.gen.cpp -o sfw/render_core/input/default_controller_mappings.gen.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/render_core/input/input_event.cpp -o sfw/render_core/input/input_event.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/render_core/input/input_map.cpp -o sfw/render_core/input/input_map.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/render_core/input/input.cpp -o sfw/render_core/input/input.o
|
||||
@ -101,7 +100,7 @@ ccache g++ -Wall -lm -ldl -lpthread -lX11 -D_REENTRANT -g sfw/core/aabb.o sfw/c
|
||||
sfw/render_core/mesh_utils.o sfw/render_core/texture.o \
|
||||
sfw/render_core/input/input_event.o sfw/render_core/input/input_map.o \
|
||||
sfw/render_core/input/input.o sfw/render_core/input/shortcut.o \
|
||||
sfw/render_core/input/keyboard.o sfw/render_core/input/default_controller_mappings.gen.o \
|
||||
sfw/render_core/input/keyboard.o \
|
||||
sfw/render_objects/camera_3d.o sfw/render_objects/object_3d.o sfw/render_objects/mesh_instance_3d.o \
|
||||
sfw/render_objects/object_2d.o \
|
||||
sfw/render_objects/sprite.o sfw/render_objects/tile_map.o \
|
||||
|
@ -1,23 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import input_builders
|
||||
from platform_methods import run_in_subprocess
|
||||
|
||||
Import("env")
|
||||
|
||||
env_input = env.Clone()
|
||||
|
||||
# Order matters here. Higher index controller database files write on top of lower index database files.
|
||||
controller_databases = [
|
||||
"gamecontrollerdb.txt",
|
||||
"pandemoniumcontrollerdb.txt",
|
||||
]
|
||||
|
||||
gensource = env_input.CommandNoCache(
|
||||
"default_controller_mappings.gen.cpp",
|
||||
controller_databases,
|
||||
run_in_subprocess(input_builders.make_default_controller_mappings),
|
||||
)
|
||||
|
||||
env_input.add_source_files(env.core_sources, "*.cpp")
|
||||
env_input.add_source_files(env.core_sources, gensource)
|
File diff suppressed because it is too large
Load Diff
@ -1,14 +0,0 @@
|
||||
#ifndef DEFAULT_CONTROLLER_MAPPINGS_H
|
||||
#define DEFAULT_CONTROLLER_MAPPINGS_H
|
||||
|
||||
/*************************************************************************/
|
||||
/* default_controller_mappings.h */
|
||||
/* From https://github.com/Relintai/pandemonium_engine (MIT) */
|
||||
/*************************************************************************/
|
||||
|
||||
class DefaultControllerMappings {
|
||||
public:
|
||||
static const char *mappings[];
|
||||
};
|
||||
|
||||
#endif // DEFAULT_CONTROLLER_MAPPINGS_H
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -83,7 +83,6 @@ public:
|
||||
virtual bool is_key_pressed(int p_scancode) const;
|
||||
virtual bool is_physical_key_pressed(int p_scancode) const;
|
||||
virtual bool is_mouse_button_pressed(int p_button) const;
|
||||
virtual bool is_joy_button_pressed(int p_device, int p_button) const;
|
||||
virtual bool is_action_pressed(const StringName &p_action, bool p_exact = false) const;
|
||||
virtual bool is_action_just_pressed(const StringName &p_action, bool p_exact = false) const;
|
||||
virtual bool is_action_just_released(const StringName &p_action, bool p_exact = false) const;
|
||||
@ -93,33 +92,6 @@ public:
|
||||
float get_axis(const StringName &p_negative_action, const StringName &p_positive_action) const;
|
||||
Vector2 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 = -1.0f) const;
|
||||
|
||||
virtual float get_joy_axis(int p_device, int p_axis) const;
|
||||
virtual String get_joy_name(int p_idx);
|
||||
virtual Array get_connected_joypads();
|
||||
virtual void joy_connection_changed(int p_idx, bool p_connected, String p_name, String p_guid);
|
||||
|
||||
virtual Vector2 get_joy_vibration_strength(int p_device);
|
||||
virtual float get_joy_vibration_duration(int p_device);
|
||||
virtual uint64_t get_joy_vibration_timestamp(int p_device);
|
||||
|
||||
virtual void add_joy_mapping(String p_mapping, bool p_update_existing = false);
|
||||
virtual void remove_joy_mapping(String p_guid);
|
||||
virtual bool is_joy_known(int p_device);
|
||||
virtual String get_joy_guid(int p_device) const;
|
||||
|
||||
virtual bool should_ignore_device(int p_vendor_id, int p_product_id) const;
|
||||
|
||||
virtual void start_joy_vibration(int p_device, float p_weak_magnitude, float p_strong_magnitude, float p_duration = 0);
|
||||
virtual void stop_joy_vibration(int p_device);
|
||||
virtual void vibrate_handheld(int p_duration_ms = 500);
|
||||
|
||||
void set_joy_axis(int p_device, int p_axis, float p_value);
|
||||
|
||||
void parse_mapping(String p_mapping);
|
||||
void joy_button(int p_device, int p_button, bool p_pressed);
|
||||
void joy_axis(int p_device, int p_axis, float p_value);
|
||||
void joy_hat(int p_device, int p_val);
|
||||
|
||||
virtual Point2 get_mouse_position() const;
|
||||
virtual Point2 get_last_mouse_speed();
|
||||
virtual int get_mouse_button_mask() const;
|
||||
@ -129,42 +101,14 @@ public:
|
||||
virtual void warp_mouse_position(const Vector2 &p_to);
|
||||
virtual Point2i warp_mouse_motion(const Ref<InputEventMouseMotion> &p_motion, const Rect2 &p_rect);
|
||||
|
||||
virtual Vector3 get_gravity() const;
|
||||
virtual Vector3 get_accelerometer() const;
|
||||
virtual Vector3 get_magnetometer() const;
|
||||
virtual Vector3 get_gyroscope() const;
|
||||
|
||||
virtual void set_gravity(const Vector3 &p_gravity);
|
||||
virtual void set_accelerometer(const Vector3 &p_accel);
|
||||
virtual void set_magnetometer(const Vector3 &p_magnetometer);
|
||||
virtual void set_gyroscope(const Vector3 &p_gyroscope);
|
||||
|
||||
virtual void action_press(const StringName &p_action, float p_strength = 1.f);
|
||||
virtual void action_release(const StringName &p_action);
|
||||
|
||||
void set_emulate_touch_from_mouse(bool p_emulate);
|
||||
virtual bool is_emulating_touch_from_mouse() const;
|
||||
void ensure_touch_mouse_raised();
|
||||
|
||||
void set_emulate_mouse_from_touch(bool p_emulate);
|
||||
virtual bool is_emulating_mouse_from_touch() const;
|
||||
|
||||
virtual CursorShape get_default_cursor_shape() const;
|
||||
virtual void set_default_cursor_shape(CursorShape p_shape);
|
||||
virtual CursorShape get_current_cursor_shape() const;
|
||||
virtual void set_custom_mouse_cursor(const Ref<Reference> &p_cursor, CursorShape p_shape = CURSOR_ARROW, const Vector2 &p_hotspot = Vector2());
|
||||
|
||||
virtual String get_joy_button_string(int p_button);
|
||||
virtual String get_joy_axis_string(int p_axis);
|
||||
virtual int get_joy_axis_index_from_string(String p_axis);
|
||||
virtual int get_joy_button_index_from_string(String p_button);
|
||||
|
||||
int get_unused_joy_id();
|
||||
|
||||
bool is_joy_mapped(int p_device);
|
||||
String get_joy_guid_remapped(int p_device) const;
|
||||
void set_fallback_mapping(String p_guid);
|
||||
|
||||
virtual void parse_input_event(const Ref<InputEvent> &p_event);
|
||||
|
||||
virtual void flush_buffered_events();
|
||||
@ -175,8 +119,6 @@ public:
|
||||
|
||||
virtual void release_pressed_events();
|
||||
|
||||
void get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options, const String "e_style) const;
|
||||
|
||||
void set_main_loop(Application *p_main_loop);
|
||||
void iteration(real_t p_step);
|
||||
|
||||
@ -203,60 +145,6 @@ protected:
|
||||
static void GLFWwindowfocusfunCallback(GLFWwindow *window, int focused);
|
||||
|
||||
protected:
|
||||
enum JoyType {
|
||||
TYPE_BUTTON,
|
||||
TYPE_AXIS,
|
||||
TYPE_HAT,
|
||||
TYPE_MAX,
|
||||
};
|
||||
|
||||
enum JoyAxisRange {
|
||||
NEGATIVE_HALF_AXIS = -1,
|
||||
FULL_AXIS = 0,
|
||||
POSITIVE_HALF_AXIS = 1
|
||||
};
|
||||
|
||||
struct JoyEvent {
|
||||
int type;
|
||||
int index;
|
||||
float value;
|
||||
};
|
||||
|
||||
struct JoyBinding {
|
||||
JoyType inputType;
|
||||
union {
|
||||
int button;
|
||||
|
||||
struct {
|
||||
int axis;
|
||||
JoyAxisRange range;
|
||||
bool invert;
|
||||
} axis;
|
||||
|
||||
struct {
|
||||
int hat;
|
||||
HatMask hat_mask;
|
||||
} hat;
|
||||
|
||||
} input;
|
||||
|
||||
JoyType outputType;
|
||||
union {
|
||||
JoystickList button;
|
||||
|
||||
struct {
|
||||
JoystickList axis;
|
||||
JoyAxisRange range;
|
||||
} axis;
|
||||
|
||||
} output;
|
||||
};
|
||||
|
||||
struct JoyDeviceMapping {
|
||||
String uid;
|
||||
String name;
|
||||
Vector<JoyBinding> bindings;
|
||||
};
|
||||
|
||||
struct SpeedTrack {
|
||||
uint64_t last_tick;
|
||||
@ -271,37 +159,6 @@ protected:
|
||||
SpeedTrack();
|
||||
};
|
||||
|
||||
struct Joypad {
|
||||
StringName name;
|
||||
StringName uid;
|
||||
bool connected;
|
||||
bool last_buttons[JOY_BUTTON_MAX + 12]; //apparently SDL specifies 35 possible buttons on android
|
||||
float last_axis[JOY_AXIS_MAX];
|
||||
int last_hat;
|
||||
int mapping;
|
||||
int hat_current;
|
||||
|
||||
Joypad() {
|
||||
for (int i = 0; i < JOY_AXIS_MAX; i++) {
|
||||
last_axis[i] = 0.0f;
|
||||
}
|
||||
for (int i = 0; i < JOY_BUTTON_MAX + 12; i++) {
|
||||
last_buttons[i] = false;
|
||||
}
|
||||
connected = false;
|
||||
last_hat = HAT_MASK_CENTER;
|
||||
mapping = -1;
|
||||
hat_current = 0;
|
||||
}
|
||||
};
|
||||
|
||||
struct VibrationInfo {
|
||||
float weak_magnitude;
|
||||
float strong_magnitude;
|
||||
float duration; // Duration in seconds
|
||||
uint64_t timestamp;
|
||||
};
|
||||
|
||||
struct Action {
|
||||
uint64_t pressed_idle_frame;
|
||||
uint64_t released_idle_frame;
|
||||
@ -320,14 +177,6 @@ protected:
|
||||
}
|
||||
};
|
||||
|
||||
JoyEvent _get_mapped_button_event(const JoyDeviceMapping &mapping, int p_button);
|
||||
JoyEvent _get_mapped_axis_event(const JoyDeviceMapping &mapping, int p_axis, float p_value);
|
||||
void _get_mapped_hat_events(const JoyDeviceMapping &mapping, int p_hat, JoyEvent r_events[HAT_MAX]);
|
||||
JoystickList _get_output_button(String output);
|
||||
JoystickList _get_output_axis(String output);
|
||||
void _button_event(int p_device, int p_index, bool p_pressed);
|
||||
void _axis_event(int p_device, int p_axis, float p_value);
|
||||
|
||||
void _parse_input_event_impl(const Ref<InputEvent> &p_event, bool p_is_emulated);
|
||||
|
||||
static String _hex_str(uint8_t p_byte);
|
||||
@ -340,13 +189,7 @@ protected:
|
||||
|
||||
RBSet<int> physical_keys_pressed;
|
||||
RBSet<int> keys_pressed;
|
||||
RBSet<int> joy_buttons_pressed;
|
||||
RBMap<int, float> _joy_axis;
|
||||
//Map<StringName,int> custom_action_press;
|
||||
Vector3 gravity;
|
||||
Vector3 accelerometer;
|
||||
Vector3 magnetometer;
|
||||
Vector3 gyroscope;
|
||||
|
||||
Vector2 mouse_pos;
|
||||
|
||||
Application *main_loop;
|
||||
@ -365,24 +208,10 @@ protected:
|
||||
|
||||
RBMap<StringName, Action> action_state;
|
||||
|
||||
bool emulate_touch_from_mouse;
|
||||
bool emulate_mouse_from_touch;
|
||||
|
||||
int mouse_from_touch_index;
|
||||
|
||||
SpeedTrack mouse_speed_track;
|
||||
RBMap<int, SpeedTrack> touch_speed_track;
|
||||
RBMap<int, Joypad> joy_names;
|
||||
int fallback_mapping;
|
||||
|
||||
CursorShape default_shape;
|
||||
|
||||
Vector<JoyDeviceMapping> map_db;
|
||||
|
||||
RBSet<uint32_t> ignored_device_ids;
|
||||
|
||||
RBMap<int, VibrationInfo> joy_vibration;
|
||||
|
||||
static Input *singleton;
|
||||
};
|
||||
|
||||
|
@ -1,69 +0,0 @@
|
||||
"""Functions used to generate source files during build time
|
||||
|
||||
All such functions are invoked in a subprocess on Windows to prevent build flakiness.
|
||||
|
||||
"""
|
||||
from platform_methods import subprocess_main
|
||||
from collections import OrderedDict
|
||||
|
||||
def make_default_controller_mappings(target, source, env):
|
||||
dst = target[0]
|
||||
g = open(dst, "w")
|
||||
|
||||
g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
|
||||
g.write('#include "core/typedefs.h"\n')
|
||||
g.write('#include "core/input/default_controller_mappings.h"\n')
|
||||
|
||||
# ensure mappings have a consistent order
|
||||
platform_mappings = OrderedDict()
|
||||
for src_path in source:
|
||||
with open(src_path, "r") as f:
|
||||
# read mapping file and skip header
|
||||
mapping_file_lines = f.readlines()[2:]
|
||||
|
||||
current_platform = None
|
||||
for line in mapping_file_lines:
|
||||
if not line:
|
||||
continue
|
||||
line = line.strip()
|
||||
if len(line) == 0:
|
||||
continue
|
||||
if line[0] == "#":
|
||||
current_platform = line[1:].strip()
|
||||
if current_platform not in platform_mappings:
|
||||
platform_mappings[current_platform] = {}
|
||||
elif current_platform:
|
||||
line_parts = line.split(",")
|
||||
guid = line_parts[0]
|
||||
if guid in platform_mappings[current_platform]:
|
||||
g.write(
|
||||
"// WARNING - DATABASE {} OVERWROTE PRIOR MAPPING: {} {}\n".format(
|
||||
src_path, current_platform, platform_mappings[current_platform][guid]
|
||||
)
|
||||
)
|
||||
platform_mappings[current_platform][guid] = line
|
||||
|
||||
platform_variables = {
|
||||
"Linux": "#if X11_ENABLED",
|
||||
"Windows": "#ifdef WINDOWS_ENABLED",
|
||||
"Mac OS X": "#ifdef OSX_ENABLED",
|
||||
"Android": "#if defined(__ANDROID__)",
|
||||
"iOS": "#ifdef IPHONE_ENABLED",
|
||||
"Javascript": "#ifdef JAVASCRIPT_ENABLED",
|
||||
"UWP": "#ifdef UWP_ENABLED",
|
||||
}
|
||||
|
||||
g.write("const char* DefaultControllerMappings::mappings[] = {\n")
|
||||
for platform, mappings in platform_mappings.items():
|
||||
variable = platform_variables[platform]
|
||||
g.write("{}\n".format(variable))
|
||||
for mapping in mappings.values():
|
||||
g.write('\t"{}",\n'.format(mapping))
|
||||
g.write("#endif\n")
|
||||
|
||||
g.write("\tNULL\n};\n")
|
||||
g.close()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
subprocess_main(globals())
|
@ -618,268 +618,6 @@ InputEventMouseMotion::InputEventMouseMotion() {
|
||||
pen_inverted = false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////
|
||||
|
||||
void InputEventJoypadMotion::set_axis(int p_axis) {
|
||||
axis = p_axis;
|
||||
}
|
||||
|
||||
int InputEventJoypadMotion::get_axis() const {
|
||||
return axis;
|
||||
}
|
||||
|
||||
void InputEventJoypadMotion::set_axis_value(float p_value) {
|
||||
axis_value = p_value;
|
||||
pressed = Math::abs(axis_value) >= 0.5f;
|
||||
}
|
||||
|
||||
float InputEventJoypadMotion::get_axis_value() const {
|
||||
return axis_value;
|
||||
}
|
||||
|
||||
bool InputEventJoypadMotion::action_match(const Ref<InputEvent> &p_event, bool p_exact_match, bool *p_pressed, float *p_strength, float *p_raw_strength, float p_deadzone) const {
|
||||
Ref<InputEventJoypadMotion> jm = p_event;
|
||||
if (jm.is_null()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Matches even if not in the same direction, but returns a "not pressed" event.
|
||||
bool match = (axis == jm->axis);
|
||||
if (p_exact_match) {
|
||||
match &= (axis_value < 0) == (jm->axis_value < 0);
|
||||
}
|
||||
if (match) {
|
||||
float jm_abs_axis_value = Math::abs(jm->get_axis_value());
|
||||
bool same_direction = (((axis_value < 0) == (jm->axis_value < 0)) || jm->axis_value == 0);
|
||||
bool pressed = same_direction ? jm_abs_axis_value >= p_deadzone : false;
|
||||
if (p_pressed != nullptr) {
|
||||
*p_pressed = pressed;
|
||||
}
|
||||
if (p_strength != nullptr) {
|
||||
if (pressed) {
|
||||
if (p_deadzone == 1.0f) {
|
||||
*p_strength = 1.0f;
|
||||
} else {
|
||||
*p_strength = CLAMP(Math::inverse_lerp(p_deadzone, 1.0f, jm_abs_axis_value), 0.0f, 1.0f);
|
||||
}
|
||||
} else {
|
||||
*p_strength = 0.0f;
|
||||
}
|
||||
}
|
||||
if (p_raw_strength != nullptr) {
|
||||
if (same_direction) { // NOT pressed, because we want to ignore the deadzone.
|
||||
*p_raw_strength = jm_abs_axis_value;
|
||||
} else {
|
||||
*p_raw_strength = 0.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
return match;
|
||||
}
|
||||
|
||||
bool InputEventJoypadMotion::shortcut_match(const Ref<InputEvent> &p_event, bool p_exact_match) const {
|
||||
Ref<InputEventJoypadMotion> jm = p_event;
|
||||
if (jm.is_null()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return axis == jm->axis &&
|
||||
(!p_exact_match || ((axis_value < 0) == (jm->axis_value < 0)));
|
||||
}
|
||||
|
||||
String InputEventJoypadMotion::as_text() const {
|
||||
return "InputEventJoypadMotion : axis=" + itos(axis) + ", axis_value=" + String(Variant(axis_value));
|
||||
}
|
||||
|
||||
InputEventJoypadMotion::InputEventJoypadMotion() {
|
||||
axis = 0;
|
||||
axis_value = 0;
|
||||
}
|
||||
/////////////////////////////////
|
||||
|
||||
void InputEventJoypadButton::set_button_index(int p_index) {
|
||||
button_index = p_index;
|
||||
}
|
||||
|
||||
int InputEventJoypadButton::get_button_index() const {
|
||||
return button_index;
|
||||
}
|
||||
|
||||
void InputEventJoypadButton::set_pressed(bool p_pressed) {
|
||||
pressed = p_pressed;
|
||||
}
|
||||
|
||||
void InputEventJoypadButton::set_pressure(float p_pressure) {
|
||||
pressure = p_pressure;
|
||||
}
|
||||
float InputEventJoypadButton::get_pressure() const {
|
||||
return pressure;
|
||||
}
|
||||
|
||||
bool InputEventJoypadButton::action_match(const Ref<InputEvent> &p_event, bool p_exact_match, bool *p_pressed, float *p_strength, float *p_raw_strength, float p_deadzone) const {
|
||||
Ref<InputEventJoypadButton> jb = p_event;
|
||||
if (jb.is_null()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool match = button_index == jb->button_index;
|
||||
if (match) {
|
||||
bool pressed = jb->is_pressed();
|
||||
if (p_pressed != nullptr) {
|
||||
*p_pressed = pressed;
|
||||
}
|
||||
float strength = pressed ? 1.0f : 0.0f;
|
||||
if (p_strength != nullptr) {
|
||||
*p_strength = strength;
|
||||
}
|
||||
if (p_raw_strength != nullptr) {
|
||||
*p_raw_strength = strength;
|
||||
}
|
||||
}
|
||||
|
||||
return match;
|
||||
}
|
||||
|
||||
bool InputEventJoypadButton::shortcut_match(const Ref<InputEvent> &p_event, bool p_exact_match) const {
|
||||
Ref<InputEventJoypadButton> button = p_event;
|
||||
if (button.is_null()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return button_index == button->button_index;
|
||||
}
|
||||
|
||||
String InputEventJoypadButton::as_text() const {
|
||||
return "InputEventJoypadButton : button_index=" + itos(button_index) + ", pressed=" + (is_pressed() ? "true" : "false") + ", pressure=" + String(Variant(pressure));
|
||||
}
|
||||
|
||||
InputEventJoypadButton::InputEventJoypadButton() {
|
||||
button_index = 0;
|
||||
pressure = 0;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////
|
||||
|
||||
void InputEventScreenTouch::set_index(int p_index) {
|
||||
index = p_index;
|
||||
}
|
||||
int InputEventScreenTouch::get_index() const {
|
||||
return index;
|
||||
}
|
||||
|
||||
void InputEventScreenTouch::set_position(const Vector2 &p_pos) {
|
||||
pos = p_pos;
|
||||
}
|
||||
Vector2 InputEventScreenTouch::get_position() const {
|
||||
return pos;
|
||||
}
|
||||
|
||||
void InputEventScreenTouch::set_pressed(bool p_pressed) {
|
||||
pressed = p_pressed;
|
||||
}
|
||||
void InputEventScreenTouch::set_canceled(bool p_canceled) {
|
||||
canceled = p_canceled;
|
||||
}
|
||||
|
||||
void InputEventScreenTouch::set_double_tap(bool p_double_tap) {
|
||||
double_tap = p_double_tap;
|
||||
}
|
||||
bool InputEventScreenTouch::is_double_tap() const {
|
||||
return double_tap;
|
||||
}
|
||||
|
||||
Ref<InputEvent> InputEventScreenTouch::xformed_by(const Transform2D &p_xform, const Vector2 &p_local_ofs) const {
|
||||
Ref<InputEventScreenTouch> st;
|
||||
st.instance();
|
||||
st->set_device(get_device());
|
||||
st->set_index(index);
|
||||
st->set_position(p_xform.xform(pos + p_local_ofs));
|
||||
st->set_pressed(pressed);
|
||||
st->set_canceled(canceled);
|
||||
st->set_double_tap(double_tap);
|
||||
|
||||
return st;
|
||||
}
|
||||
|
||||
String InputEventScreenTouch::as_text() const {
|
||||
return "InputEventScreenTouch : index=" + itos(index) + ", pressed=" + (pressed ? "true" : "false") + ", canceled=" + (canceled ? "true" : "false") + ", position=(" + String(get_position()) + "), double_tap=" + (double_tap ? "true" : "false");
|
||||
}
|
||||
|
||||
InputEventScreenTouch::InputEventScreenTouch() {
|
||||
index = 0;
|
||||
double_tap = false;
|
||||
}
|
||||
|
||||
/////////////////////////////
|
||||
|
||||
void InputEventScreenDrag::set_index(int p_index) {
|
||||
index = p_index;
|
||||
}
|
||||
|
||||
int InputEventScreenDrag::get_index() const {
|
||||
return index;
|
||||
}
|
||||
|
||||
void InputEventScreenDrag::set_position(const Vector2 &p_pos) {
|
||||
pos = p_pos;
|
||||
}
|
||||
Vector2 InputEventScreenDrag::get_position() const {
|
||||
return pos;
|
||||
}
|
||||
|
||||
void InputEventScreenDrag::set_relative(const Vector2 &p_relative) {
|
||||
relative = p_relative;
|
||||
}
|
||||
Vector2 InputEventScreenDrag::get_relative() const {
|
||||
return relative;
|
||||
}
|
||||
|
||||
void InputEventScreenDrag::set_speed(const Vector2 &p_speed) {
|
||||
speed = p_speed;
|
||||
}
|
||||
Vector2 InputEventScreenDrag::get_speed() const {
|
||||
return speed;
|
||||
}
|
||||
|
||||
Ref<InputEvent> InputEventScreenDrag::xformed_by(const Transform2D &p_xform, const Vector2 &p_local_ofs) const {
|
||||
Ref<InputEventScreenDrag> sd;
|
||||
|
||||
sd.instance();
|
||||
|
||||
sd->set_device(get_device());
|
||||
|
||||
sd->set_index(index);
|
||||
sd->set_position(p_xform.xform(pos + p_local_ofs));
|
||||
sd->set_relative(p_xform.basis_xform(relative));
|
||||
sd->set_speed(p_xform.basis_xform(speed));
|
||||
|
||||
return sd;
|
||||
}
|
||||
|
||||
String InputEventScreenDrag::as_text() const {
|
||||
return "InputEventScreenDrag : index=" + itos(index) + ", position=(" + String(get_position()) + "), relative=(" + String(get_relative()) + "), speed=(" + String(get_speed()) + ")";
|
||||
}
|
||||
|
||||
bool InputEventScreenDrag::accumulate(const Ref<InputEvent> &p_event) {
|
||||
Ref<InputEventScreenDrag> drag = p_event;
|
||||
if (drag.is_null()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (get_index() != drag->get_index()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
set_position(drag->get_position());
|
||||
set_speed(drag->get_speed());
|
||||
relative += drag->get_relative();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
InputEventScreenDrag::InputEventScreenDrag() {
|
||||
index = 0;
|
||||
}
|
||||
/////////////////////////////
|
||||
|
||||
void InputEventAction::set_action(const StringName &p_action) {
|
||||
@ -945,156 +683,6 @@ InputEventAction::InputEventAction() {
|
||||
}
|
||||
/////////////////////////////
|
||||
|
||||
void InputEventGesture::set_position(const Vector2 &p_pos) {
|
||||
pos = p_pos;
|
||||
}
|
||||
|
||||
Vector2 InputEventGesture::get_position() const {
|
||||
return pos;
|
||||
}
|
||||
/////////////////////////////
|
||||
|
||||
void InputEventMagnifyGesture::set_factor(real_t p_factor) {
|
||||
factor = p_factor;
|
||||
}
|
||||
|
||||
real_t InputEventMagnifyGesture::get_factor() const {
|
||||
return factor;
|
||||
}
|
||||
|
||||
Ref<InputEvent> InputEventMagnifyGesture::xformed_by(const Transform2D &p_xform, const Vector2 &p_local_ofs) const {
|
||||
Ref<InputEventMagnifyGesture> ev;
|
||||
ev.instance();
|
||||
|
||||
ev->set_device(get_device());
|
||||
ev->set_modifiers_from_event(this);
|
||||
|
||||
ev->set_position(p_xform.xform(get_position() + p_local_ofs));
|
||||
ev->set_factor(get_factor());
|
||||
|
||||
return ev;
|
||||
}
|
||||
|
||||
String InputEventMagnifyGesture::as_text() const {
|
||||
return "InputEventMagnifyGesture : factor=" + rtos(get_factor()) + ", position=(" + String(get_position()) + ")";
|
||||
}
|
||||
|
||||
InputEventMagnifyGesture::InputEventMagnifyGesture() {
|
||||
factor = 1.0;
|
||||
}
|
||||
/////////////////////////////
|
||||
|
||||
void InputEventPanGesture::set_delta(const Vector2 &p_delta) {
|
||||
delta = p_delta;
|
||||
}
|
||||
|
||||
Vector2 InputEventPanGesture::get_delta() const {
|
||||
return delta;
|
||||
}
|
||||
|
||||
Ref<InputEvent> InputEventPanGesture::xformed_by(const Transform2D &p_xform, const Vector2 &p_local_ofs) const {
|
||||
Ref<InputEventPanGesture> ev;
|
||||
ev.instance();
|
||||
|
||||
ev->set_device(get_device());
|
||||
ev->set_modifiers_from_event(this);
|
||||
|
||||
ev->set_position(p_xform.xform(get_position() + p_local_ofs));
|
||||
ev->set_delta(get_delta());
|
||||
|
||||
return ev;
|
||||
}
|
||||
|
||||
String InputEventPanGesture::as_text() const {
|
||||
return "InputEventPanGesture : delta=(" + String(get_delta()) + "), position=(" + String(get_position()) + ")";
|
||||
}
|
||||
|
||||
InputEventPanGesture::InputEventPanGesture() {
|
||||
delta = Vector2(0, 0);
|
||||
}
|
||||
/////////////////////////////
|
||||
|
||||
void InputEventMIDI::set_channel(const int p_channel) {
|
||||
channel = p_channel;
|
||||
}
|
||||
|
||||
int InputEventMIDI::get_channel() const {
|
||||
return channel;
|
||||
}
|
||||
|
||||
void InputEventMIDI::set_message(const int p_message) {
|
||||
message = p_message;
|
||||
}
|
||||
|
||||
int InputEventMIDI::get_message() const {
|
||||
return message;
|
||||
}
|
||||
|
||||
void InputEventMIDI::set_pitch(const int p_pitch) {
|
||||
pitch = p_pitch;
|
||||
}
|
||||
|
||||
int InputEventMIDI::get_pitch() const {
|
||||
return pitch;
|
||||
}
|
||||
|
||||
void InputEventMIDI::set_velocity(const int p_velocity) {
|
||||
velocity = p_velocity;
|
||||
}
|
||||
|
||||
int InputEventMIDI::get_velocity() const {
|
||||
return velocity;
|
||||
}
|
||||
|
||||
void InputEventMIDI::set_instrument(const int p_instrument) {
|
||||
instrument = p_instrument;
|
||||
}
|
||||
|
||||
int InputEventMIDI::get_instrument() const {
|
||||
return instrument;
|
||||
}
|
||||
|
||||
void InputEventMIDI::set_pressure(const int p_pressure) {
|
||||
pressure = p_pressure;
|
||||
}
|
||||
|
||||
int InputEventMIDI::get_pressure() const {
|
||||
return pressure;
|
||||
}
|
||||
|
||||
void InputEventMIDI::set_controller_number(const int p_controller_number) {
|
||||
controller_number = p_controller_number;
|
||||
}
|
||||
|
||||
int InputEventMIDI::get_controller_number() const {
|
||||
return controller_number;
|
||||
}
|
||||
|
||||
void InputEventMIDI::set_controller_value(const int p_controller_value) {
|
||||
controller_value = p_controller_value;
|
||||
}
|
||||
|
||||
int InputEventMIDI::get_controller_value() const {
|
||||
return controller_value;
|
||||
}
|
||||
|
||||
String InputEventMIDI::as_text() const {
|
||||
return "InputEventMIDI : channel=(" + itos(get_channel()) + "), message=(" + itos(get_message()) + ")";
|
||||
}
|
||||
|
||||
InputEventMIDI::InputEventMIDI() {
|
||||
channel = 0;
|
||||
message = 0;
|
||||
pitch = 0;
|
||||
velocity = 0;
|
||||
instrument = 0;
|
||||
pressure = 0;
|
||||
controller_number = 0;
|
||||
controller_value = 0;
|
||||
}
|
||||
|
||||
///////////////////////////////////
|
||||
|
||||
void InputEventShortCut::set_shortcut(Ref<ShortCut> p_shortcut) {
|
||||
shortcut = p_shortcut;
|
||||
emit_changed();
|
||||
|
@ -7,9 +7,9 @@
|
||||
/*************************************************************************/
|
||||
|
||||
#include "core/transform_2d.h"
|
||||
#include "object/resource.h"
|
||||
#include "core/ustring.h"
|
||||
#include "core/typedefs.h"
|
||||
#include "core/ustring.h"
|
||||
#include "object/resource.h"
|
||||
|
||||
/**
|
||||
* Input Event classes. These are used in the main loop.
|
||||
@ -35,137 +35,6 @@ enum ButtonList {
|
||||
BUTTON_MASK_XBUTTON2 = (1 << (BUTTON_XBUTTON2 - 1))
|
||||
};
|
||||
|
||||
enum JoystickList {
|
||||
|
||||
JOY_INVALID_OPTION = -1,
|
||||
|
||||
JOY_BUTTON_0 = 0,
|
||||
JOY_BUTTON_1 = 1,
|
||||
JOY_BUTTON_2 = 2,
|
||||
JOY_BUTTON_3 = 3,
|
||||
JOY_BUTTON_4 = 4,
|
||||
JOY_BUTTON_5 = 5,
|
||||
JOY_BUTTON_6 = 6,
|
||||
JOY_BUTTON_7 = 7,
|
||||
JOY_BUTTON_8 = 8,
|
||||
JOY_BUTTON_9 = 9,
|
||||
JOY_BUTTON_10 = 10,
|
||||
JOY_BUTTON_11 = 11,
|
||||
JOY_BUTTON_12 = 12,
|
||||
JOY_BUTTON_13 = 13,
|
||||
JOY_BUTTON_14 = 14,
|
||||
JOY_BUTTON_15 = 15,
|
||||
JOY_BUTTON_16 = 16,
|
||||
JOY_BUTTON_17 = 17,
|
||||
JOY_BUTTON_18 = 18,
|
||||
JOY_BUTTON_19 = 19,
|
||||
JOY_BUTTON_20 = 20,
|
||||
JOY_BUTTON_21 = 21,
|
||||
JOY_BUTTON_22 = 22,
|
||||
JOY_BUTTON_MAX = 128, // Android supports up to 36 buttons. DirectInput supports up to 128 buttons.
|
||||
|
||||
JOY_L = JOY_BUTTON_4,
|
||||
JOY_R = JOY_BUTTON_5,
|
||||
JOY_L2 = JOY_BUTTON_6,
|
||||
JOY_R2 = JOY_BUTTON_7,
|
||||
JOY_L3 = JOY_BUTTON_8,
|
||||
JOY_R3 = JOY_BUTTON_9,
|
||||
JOY_SELECT = JOY_BUTTON_10,
|
||||
JOY_START = JOY_BUTTON_11,
|
||||
JOY_DPAD_UP = JOY_BUTTON_12,
|
||||
JOY_DPAD_DOWN = JOY_BUTTON_13,
|
||||
JOY_DPAD_LEFT = JOY_BUTTON_14,
|
||||
JOY_DPAD_RIGHT = JOY_BUTTON_15,
|
||||
JOY_GUIDE = JOY_BUTTON_16,
|
||||
JOY_MISC1 = JOY_BUTTON_17,
|
||||
JOY_PADDLE1 = JOY_BUTTON_18,
|
||||
JOY_PADDLE2 = JOY_BUTTON_19,
|
||||
JOY_PADDLE3 = JOY_BUTTON_20,
|
||||
JOY_PADDLE4 = JOY_BUTTON_21,
|
||||
JOY_TOUCHPAD = JOY_BUTTON_22,
|
||||
|
||||
JOY_SONY_CIRCLE = JOY_BUTTON_1,
|
||||
JOY_SONY_X = JOY_BUTTON_0,
|
||||
JOY_SONY_SQUARE = JOY_BUTTON_2,
|
||||
JOY_SONY_TRIANGLE = JOY_BUTTON_3,
|
||||
|
||||
JOY_XBOX_A = JOY_BUTTON_0,
|
||||
JOY_XBOX_B = JOY_BUTTON_1,
|
||||
JOY_XBOX_X = JOY_BUTTON_2,
|
||||
JOY_XBOX_Y = JOY_BUTTON_3,
|
||||
|
||||
JOY_DS_A = JOY_BUTTON_1,
|
||||
JOY_DS_B = JOY_BUTTON_0,
|
||||
JOY_DS_X = JOY_BUTTON_3,
|
||||
JOY_DS_Y = JOY_BUTTON_2,
|
||||
|
||||
JOY_WII_C = JOY_BUTTON_5,
|
||||
JOY_WII_Z = JOY_BUTTON_6,
|
||||
|
||||
JOY_WII_MINUS = JOY_BUTTON_10,
|
||||
JOY_WII_PLUS = JOY_BUTTON_11,
|
||||
|
||||
JOY_VR_GRIP = JOY_BUTTON_2,
|
||||
JOY_VR_PAD = JOY_BUTTON_14,
|
||||
JOY_VR_TRIGGER = JOY_BUTTON_15,
|
||||
|
||||
JOY_OCULUS_AX = JOY_BUTTON_7,
|
||||
JOY_OCULUS_BY = JOY_BUTTON_1,
|
||||
JOY_OCULUS_MENU = JOY_BUTTON_3,
|
||||
|
||||
JOY_OPENVR_MENU = JOY_BUTTON_1,
|
||||
|
||||
// end of history
|
||||
|
||||
JOY_AXIS_0 = 0,
|
||||
JOY_AXIS_1 = 1,
|
||||
JOY_AXIS_2 = 2,
|
||||
JOY_AXIS_3 = 3,
|
||||
JOY_AXIS_4 = 4,
|
||||
JOY_AXIS_5 = 5,
|
||||
JOY_AXIS_6 = 6,
|
||||
JOY_AXIS_7 = 7,
|
||||
JOY_AXIS_8 = 8,
|
||||
JOY_AXIS_9 = 9,
|
||||
JOY_AXIS_MAX = 10,
|
||||
|
||||
JOY_ANALOG_LX = JOY_AXIS_0,
|
||||
JOY_ANALOG_LY = JOY_AXIS_1,
|
||||
|
||||
JOY_ANALOG_RX = JOY_AXIS_2,
|
||||
JOY_ANALOG_RY = JOY_AXIS_3,
|
||||
|
||||
JOY_ANALOG_L2 = JOY_AXIS_6,
|
||||
JOY_ANALOG_R2 = JOY_AXIS_7,
|
||||
|
||||
JOY_VR_ANALOG_TRIGGER = JOY_AXIS_2,
|
||||
JOY_VR_ANALOG_GRIP = JOY_AXIS_4,
|
||||
|
||||
JOY_OPENVR_TOUCHPADX = JOY_AXIS_0,
|
||||
JOY_OPENVR_TOUCHPADY = JOY_AXIS_1,
|
||||
};
|
||||
|
||||
enum MidiMessageList {
|
||||
MIDI_MESSAGE_NOTE_OFF = 0x8,
|
||||
MIDI_MESSAGE_NOTE_ON = 0x9,
|
||||
MIDI_MESSAGE_AFTERTOUCH = 0xA,
|
||||
MIDI_MESSAGE_CONTROL_CHANGE = 0xB,
|
||||
MIDI_MESSAGE_PROGRAM_CHANGE = 0xC,
|
||||
MIDI_MESSAGE_CHANNEL_PRESSURE = 0xD,
|
||||
MIDI_MESSAGE_PITCH_BEND = 0xE,
|
||||
MIDI_MESSAGE_SYSTEM_EXCLUSIVE = 0xF0,
|
||||
MIDI_MESSAGE_QUARTER_FRAME = 0xF1,
|
||||
MIDI_MESSAGE_SONG_POSITION_POINTER = 0xF2,
|
||||
MIDI_MESSAGE_SONG_SELECT = 0xF3,
|
||||
MIDI_MESSAGE_TUNE_REQUEST = 0xF6,
|
||||
MIDI_MESSAGE_TIMING_CLOCK = 0xF8,
|
||||
MIDI_MESSAGE_START = 0xFA,
|
||||
MIDI_MESSAGE_CONTINUE = 0xFB,
|
||||
MIDI_MESSAGE_STOP = 0xFC,
|
||||
MIDI_MESSAGE_ACTIVE_SENSING = 0xFE,
|
||||
MIDI_MESSAGE_SYSTEM_RESET = 0xFF,
|
||||
};
|
||||
|
||||
/**
|
||||
* Input Modifier Status
|
||||
* for keyboard/mouse events.
|
||||
@ -381,105 +250,6 @@ public:
|
||||
InputEventMouseMotion();
|
||||
};
|
||||
|
||||
class InputEventJoypadMotion : public InputEvent {
|
||||
SFW_OBJECT(InputEventJoypadMotion, InputEvent);
|
||||
|
||||
int axis; ///< Joypad axis
|
||||
float axis_value; ///< -1 to 1
|
||||
|
||||
public:
|
||||
void set_axis(int p_axis);
|
||||
int get_axis() const;
|
||||
|
||||
void set_axis_value(float p_value);
|
||||
float get_axis_value() const;
|
||||
|
||||
virtual bool action_match(const Ref<InputEvent> &p_event, bool p_exact_match, bool *p_pressed, float *p_strength, float *p_raw_strength, float p_deadzone) const;
|
||||
virtual bool shortcut_match(const Ref<InputEvent> &p_event, bool p_exact_match = true) const;
|
||||
|
||||
virtual bool is_action_type() const { return true; }
|
||||
virtual String as_text() const;
|
||||
|
||||
InputEventJoypadMotion();
|
||||
};
|
||||
|
||||
class InputEventJoypadButton : public InputEvent {
|
||||
SFW_OBJECT(InputEventJoypadButton, InputEvent);
|
||||
|
||||
int button_index;
|
||||
float pressure; //0 to 1
|
||||
|
||||
public:
|
||||
void set_button_index(int p_index);
|
||||
int get_button_index() const;
|
||||
|
||||
void set_pressed(bool p_pressed);
|
||||
|
||||
void set_pressure(float p_pressure);
|
||||
float get_pressure() const;
|
||||
|
||||
virtual bool action_match(const Ref<InputEvent> &p_event, bool p_exact_match, bool *p_pressed, float *p_strength, float *p_raw_strength, float p_deadzone) const;
|
||||
virtual bool shortcut_match(const Ref<InputEvent> &p_event, bool p_exact_match = true) const;
|
||||
|
||||
virtual bool is_action_type() const { return true; }
|
||||
virtual String as_text() const;
|
||||
|
||||
InputEventJoypadButton();
|
||||
};
|
||||
|
||||
class InputEventScreenTouch : public InputEvent {
|
||||
SFW_OBJECT(InputEventScreenTouch, InputEvent);
|
||||
int index;
|
||||
Vector2 pos;
|
||||
bool double_tap;
|
||||
|
||||
public:
|
||||
void set_index(int p_index);
|
||||
int get_index() const;
|
||||
|
||||
void set_position(const Vector2 &p_pos);
|
||||
Vector2 get_position() const;
|
||||
|
||||
void set_pressed(bool p_pressed);
|
||||
void set_canceled(bool p_canceled);
|
||||
|
||||
void set_double_tap(bool p_double_tap);
|
||||
bool is_double_tap() const;
|
||||
|
||||
virtual Ref<InputEvent> xformed_by(const Transform2D &p_xform, const Vector2 &p_local_ofs = Vector2()) const;
|
||||
virtual String as_text() const;
|
||||
|
||||
InputEventScreenTouch();
|
||||
};
|
||||
|
||||
class InputEventScreenDrag : public InputEvent {
|
||||
SFW_OBJECT(InputEventScreenDrag, InputEvent);
|
||||
int index;
|
||||
Vector2 pos;
|
||||
Vector2 relative;
|
||||
Vector2 speed;
|
||||
|
||||
public:
|
||||
void set_index(int p_index);
|
||||
int get_index() const;
|
||||
|
||||
void set_position(const Vector2 &p_pos);
|
||||
Vector2 get_position() const;
|
||||
|
||||
void set_relative(const Vector2 &p_relative);
|
||||
Vector2 get_relative() const;
|
||||
|
||||
void set_speed(const Vector2 &p_speed);
|
||||
Vector2 get_speed() const;
|
||||
|
||||
virtual Ref<InputEvent> xformed_by(const Transform2D &p_xform, const Vector2 &p_local_ofs = Vector2()) const;
|
||||
virtual String as_text() const;
|
||||
|
||||
virtual bool accumulate(const Ref<InputEvent> &p_event);
|
||||
|
||||
InputEventScreenDrag();
|
||||
};
|
||||
|
||||
class InputEventAction : public InputEvent {
|
||||
SFW_OBJECT(InputEventAction, InputEvent);
|
||||
|
||||
@ -506,86 +276,6 @@ public:
|
||||
InputEventAction();
|
||||
};
|
||||
|
||||
class InputEventGesture : public InputEventWithModifiers {
|
||||
SFW_OBJECT(InputEventGesture, InputEventWithModifiers);
|
||||
|
||||
Vector2 pos;
|
||||
|
||||
public:
|
||||
void set_position(const Vector2 &p_pos);
|
||||
Vector2 get_position() const;
|
||||
};
|
||||
|
||||
class InputEventMagnifyGesture : public InputEventGesture {
|
||||
SFW_OBJECT(InputEventMagnifyGesture, InputEventGesture);
|
||||
real_t factor;
|
||||
|
||||
public:
|
||||
void set_factor(real_t p_factor);
|
||||
real_t get_factor() const;
|
||||
|
||||
virtual Ref<InputEvent> xformed_by(const Transform2D &p_xform, const Vector2 &p_local_ofs = Vector2()) const;
|
||||
virtual String as_text() const;
|
||||
|
||||
InputEventMagnifyGesture();
|
||||
};
|
||||
|
||||
class InputEventPanGesture : public InputEventGesture {
|
||||
SFW_OBJECT(InputEventPanGesture, InputEventGesture);
|
||||
Vector2 delta;
|
||||
|
||||
public:
|
||||
void set_delta(const Vector2 &p_delta);
|
||||
Vector2 get_delta() const;
|
||||
|
||||
virtual Ref<InputEvent> xformed_by(const Transform2D &p_xform, const Vector2 &p_local_ofs = Vector2()) const;
|
||||
virtual String as_text() const;
|
||||
|
||||
InputEventPanGesture();
|
||||
};
|
||||
|
||||
class InputEventMIDI : public InputEvent {
|
||||
SFW_OBJECT(InputEventMIDI, InputEvent);
|
||||
|
||||
int channel;
|
||||
int message;
|
||||
int pitch;
|
||||
int velocity;
|
||||
int instrument;
|
||||
int pressure;
|
||||
int controller_number;
|
||||
int controller_value;
|
||||
|
||||
public:
|
||||
void set_channel(const int p_channel);
|
||||
int get_channel() const;
|
||||
|
||||
void set_message(const int p_message);
|
||||
int get_message() const;
|
||||
|
||||
void set_pitch(const int p_pitch);
|
||||
int get_pitch() const;
|
||||
|
||||
void set_velocity(const int p_velocity);
|
||||
int get_velocity() const;
|
||||
|
||||
void set_instrument(const int p_instrument);
|
||||
int get_instrument() const;
|
||||
|
||||
void set_pressure(const int p_pressure);
|
||||
int get_pressure() const;
|
||||
|
||||
void set_controller_number(const int p_controller_number);
|
||||
int get_controller_number() const;
|
||||
|
||||
void set_controller_value(const int p_controller_value);
|
||||
int get_controller_value() const;
|
||||
|
||||
virtual String as_text() const;
|
||||
|
||||
InputEventMIDI();
|
||||
};
|
||||
|
||||
class InputEventShortCut : public InputEvent {
|
||||
SFW_OBJECT(InputEventShortCut, InputEvent);
|
||||
|
||||
|
@ -1,38 +0,0 @@
|
||||
# Game Controller DB for Godot in SDL 2.0.16 format
|
||||
# Source: https://github.com/Relintai/pandemonium_engine
|
||||
|
||||
# Windows
|
||||
__XINPUT_DEVICE__,XInput Gamepad,a:b12,b:b13,x:b14,y:b15,start:b4,back:b5,leftstick:b6,rightstick:b7,leftshoulder:b8,rightshoulder:b9,dpup:b0,dpdown:b1,dpleft:b2,dpright:b3,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,platform:Windows,
|
||||
|
||||
# Android
|
||||
Default Android Gamepad,Default Controller,leftx:a0,lefty:a1,dpdown:h0.4,rightstick:b8,rightshoulder:b10,rightx:a2,start:b6,righty:a3,dpleft:h0.8,lefttrigger:a4,x:b2,dpup:h0.1,back:b4,leftstick:b7,leftshoulder:b9,y:b3,a:b0,dpright:h0.2,righttrigger:a5,b:b1,platform:Android,
|
||||
|
||||
# Javascript
|
||||
standard,Standard Gamepad Mapping,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b8,start:b9,leftstick:b10,rightstick:b11,dpup:b12,dpdown:b13,dpleft:b14,dpright:b15,guide:b16,leftstick:b10,rightstick:b11,platform:Javascript,
|
||||
Linux24c6581a,PowerA Xbox One Cabled,a:b0,b:b1,y:b3,x:b2,start:b7,guide:b8,back:b6,leftstick:b9,rightstick:b10,leftshoulder:b4,rightshoulder:b5,dpup:-a7,dpleft:-a6,dpdown:+a7,dpright:+a6,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,platform:Javascript,
|
||||
Linux0e6f0301,Logic 3 Controller (xbox compatible),a:b0,b:b1,y:b3,x:b2,start:b7,guide:b8,back:b6,leftstick:b9,rightstick:b10,leftshoulder:b4,rightshoulder:b5,dpup:-a7,dpleft:-a6,dpdown:+a7,dpright:+a6,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,platform:Javascript,
|
||||
Linux045e028e,Microsoft X-Box 360 pad,a:b0,b:b1,y:b3,x:b2,start:b7,guide:b8,back:b6,leftstick:b9,rightstick:b10,leftshoulder:b4,rightshoulder:b5,dpup:-a7,dpleft:-a6,dpdown:+a7,dpright:+a6,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,platform:Javascript,
|
||||
Linux045e02d1,Microsoft X-Box One pad,a:b0,b:b1,y:b3,x:b2,start:b7,guide:b8,back:b6,leftstick:b9,rightstick:b10,leftshoulder:b4,rightshoulder:b5,dpup:-a7,dpleft:-a6,dpdown:+a7,dpright:+a6,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,platform:Javascript,
|
||||
Linux045e02ea,Microsoft X-Box One S pad,a:b0,b:b1,y:b3,x:b2,start:b7,guide:b8,back:b6,leftstick:b9,rightstick:b10,leftshoulder:b4,rightshoulder:b5,dpup:-a7,dpleft:-a6,dpdown:+a7,dpright:+a6,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,platform:Javascript,
|
||||
Linux045e0b12,Microsoft X-Box Series X pad,a:b0,b:b1,y:b3,x:b2,start:b7,guide:b8,back:b6,leftstick:b9,rightstick:b10,leftshoulder:b4,rightshoulder:b5,dpup:-a7,dpleft:-a6,dpdown:+a7,dpright:+a6,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,platform:Javascript,
|
||||
Linux044fb315,Thrustmaster dual analog 3.2,a:b0,b:b2,y:b3,x:b1,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b6,dpup:-a5,dpleft:-a4,dpdown:+a5,dpright:+a4,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b5,righttrigger:b7,platform:Javascript,
|
||||
Linux0e8f0003,PS3 Controller,a:b2,b:b1,back:b8,dpdown:+a5,dpleft:-a4,dpright:+a4,dpup:-a5,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Javascript,
|
||||
MacOSX24c6581a,PowerA Xbox One Cabled,a:b11,b:b12,y:b14,x:b13,start:b4,back:b5,leftstick:b6,rightstick:b7,leftshoulder:b8,rightshoulder:b9,dpup:b0,dpleft:b2,dpdown:b1,dpright:b3,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,platform:Javascript
|
||||
MacOSX045e028e,Xbox 360 Wired Controller,a:b11,b:b12,y:b14,x:b13,start:b4,back:b5,leftstick:b6,rightstick:b7,leftshoulder:b8,rightshoulder:b9,dpup:b0,dpleft:b2,dpdown:b1,dpright:b3,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,platform:Javascript
|
||||
MacOSX045e02d1,Xbox One Controller,a:b11,b:b12,y:b14,x:b13,start:b4,back:b5,leftstick:b6,rightstick:b7,leftshoulder:b8,rightshoulder:b9,dpup:b0,dpleft:b2,dpdown:b1,dpright:b3,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,platform:Javascript
|
||||
MacOSX045e02ea,Xbox One S Controller,a:b11,b:b12,y:b14,x:b13,start:b4,back:b5,leftstick:b6,rightstick:b7,leftshoulder:b8,rightshoulder:b9,dpup:b0,dpleft:b2,dpdown:b1,dpright:b3,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,platform:Javascript
|
||||
MacOSX045e0b12,Xbox Series X Controller,a:b11,b:b12,y:b14,x:b13,start:b4,back:b5,leftstick:b6,rightstick:b7,leftshoulder:b8,rightshoulder:b9,dpup:b0,dpleft:b2,dpdown:b1,dpright:b3,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,platform:Javascript
|
||||
Linux15320a14,Razer Wolverine Ultimate,a:b0,b:b1,y:b3,x:b2,start:b7,back:b6,leftstick:b9,rightstick:b10,leftshoulder:b4,rightshoulder:b5,dpup:-a7,dpleft:-a6,dpdown:+a7,dpright:+a6,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,platform:Javascript
|
||||
Linux05832060,iBuffalo BSGP801,a:b1,b:b0,y:b2,x:b3,start:b7,back:b6,leftshoulder:b4,rightshoulder:b5,dpup:-a1,dpleft:-a0,dpdown:+a1,dpright:+a0,platform:Javascript
|
||||
MacOSX05832060,iBuffalo BSGP801,a:b1,b:b0,y:b2,x:b3,start:b7,back:b6,leftshoulder:b4,rightshoulder:b5,dpup:-a1,dpleft:-a0,dpdown:+a1,dpright:+a0,platform:Javascript
|
||||
Linux0e8f3013,HuiJia USB GamePad,a:b2,b:b1,y:b0,x:b3,start:b9,back:b8,leftshoulder:b6,rightshoulder:b7,dpup:-a1,dpleft:-a0,dpdown:+a1,dpright:+a0,platform:Javascript
|
||||
Windows0e8f3013,HuiJia USB GamePad,a:b2,b:b1,y:b0,x:b3,start:b9,back:b8,leftshoulder:b6,rightshoulder:b7,dpup:-a1,dpleft:-a0,dpdown:+a1,dpright:+a0,platform:Javascript
|
||||
MacOSX0e8f3013,HuiJia USB GamePad,a:b2,b:b1,y:b0,x:b3,start:b9,back:b8,leftshoulder:b6,rightshoulder:b7,dpup:-a4,dpleft:-a3,dpdown:+a4,dpright:+a3,platform:Javascript
|
||||
Linux046dc216,046d-c216-Logitech Logitech Dual Action,a:b1,b:b2,y:b3,x:b0,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:-a5,dpleft:-a4,dpdown:+a5,dpright:+a4,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,platform:Javascript
|
||||
Linux20d6a713,Bensussen Deutsch & Associates Inc.(BDA) NSW Wired controller,a:b1,b:b2,y:b3,x:b0,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:-a5,dpleft:-a4,dpdown:+a5,dpright:+a4,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,platform:Javascript
|
||||
Linux054c05c4,Sony Computer Entertainment Wireless Controller,a:b0,b:b1,y:b2,x:b3,start:b9,back:b8,leftstick:b11,rightstick:b12,leftshoulder:b4,rightshoulder:b5,dpup:-a7,dpleft:-a6,dpdown:+a7,dpright:+a6,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,platform:Javascript
|
||||
Linux18d19400,18d1-9400-Google LLC Stadia Controller rev. A,a:b0,b:b1,y:b3,x:b2,start:b7,back:b6,leftstick:b9,rightstick:b10,leftshoulder:b4,rightshoulder:b5,dpup:-a7,dpleft:-a6,dpdown:+a7,dpright:+a6,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a5,righttrigger:a4,platform:Javascript
|
||||
Linux054c0268,054c-0268-Sony PLAYSTATION(R)3 Controller,a:b0,b:b1,y:b2,x:b3,start:b9,guide:b10,back:b8,leftstick:b11,rightstick:b12,leftshoulder:b4,rightshoulder:b5,dpup:b13,dpleft:b15,dpdown:b14,dpright:b16,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,platform:Javascript
|
||||
|
||||
# UWP
|
||||
__UWP_GAMEPAD__,Xbox Controller,a:b2,b:b3,x:b4,y:b5,start:b0,back:b1,leftstick:b12,rightstick:b13,leftshoulder:b10,rightshoulder:b11,dpup:b6,dpdown:b7,dpleft:b8,dpright:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,platform:UWP,
|
Loading…
Reference in New Issue
Block a user