summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/global_constants.cpp2
-rw-r--r--core/globals.cpp10
-rw-r--r--core/input_map.cpp4
-rw-r--r--core/io/marshalls.cpp8
-rw-r--r--core/os/input.cpp2
-rw-r--r--core/os/input.h2
-rw-r--r--core/os/input_event.cpp16
-rw-r--r--core/os/input_event.h14
-rw-r--r--core/os/os.cpp2
-rw-r--r--core/tests/test_physics.cpp2
-rw-r--r--core/variant_call.cpp4
-rw-r--r--core/variant_op.cpp12
-rw-r--r--core/variant_parser.cpp12
-rw-r--r--main/input_default.cpp40
-rw-r--r--main/input_default.h10
-rw-r--r--modules/cscript/godot_c.h14
-rw-r--r--modules/gdscript/gd_editor.cpp4
-rw-r--r--modules/visual_script/visual_script_flow_control.cpp40
-rw-r--r--modules/visual_script/visual_script_func_nodes.cpp4
-rw-r--r--modules/visual_script/visual_script_nodes.cpp2
-rw-r--r--platform/android/java_glue.cpp10
-rw-r--r--platform/android/os_android.cpp2
-rw-r--r--platform/android/os_android.h4
-rw-r--r--platform/iphone/os_iphone.cpp6
-rw-r--r--platform/javascript/os_javascript.cpp4
-rw-r--r--platform/javascript/os_javascript.h2
-rw-r--r--platform/osx/joystick_osx.cpp96
-rw-r--r--platform/osx/joystick_osx.h36
-rw-r--r--platform/osx/os_osx.h4
-rw-r--r--platform/uwp/joystick_uwp.cpp24
-rw-r--r--platform/uwp/joystick_uwp.h12
-rw-r--r--platform/uwp/os_uwp.cpp8
-rw-r--r--platform/uwp/os_uwp.h6
-rw-r--r--platform/windows/joystick.cpp160
-rw-r--r--platform/windows/joystick.h38
-rw-r--r--platform/windows/os_windows.cpp10
-rw-r--r--platform/windows/os_windows.h4
-rw-r--r--platform/x11/joystick_linux.cpp104
-rw-r--r--platform/x11/joystick_linux.h44
-rw-r--r--platform/x11/os_x11.cpp6
-rw-r--r--platform/x11/os_x11.h2
-rw-r--r--scene/gui/base_button.cpp2
-rw-r--r--scene/gui/input_action.cpp8
-rw-r--r--scene/gui/menu_button.cpp2
-rw-r--r--scene/main/scene_main_loop.cpp2
-rw-r--r--scene/main/viewport.cpp4
-rw-r--r--tools/doc/doc_data.cpp2
-rw-r--r--tools/editor/project_settings.cpp24
-rw-r--r--tools/editor/property_selector.cpp4
49 files changed, 417 insertions, 417 deletions
diff --git a/core/global_constants.cpp b/core/global_constants.cpp
index c5c2081b5c..320f649400 100644
--- a/core/global_constants.cpp
+++ b/core/global_constants.cpp
@@ -329,7 +329,7 @@ static _GlobalConstant _global_constants[]={
BIND_GLOBAL_CONSTANT( BUTTON_MASK_RIGHT ),
BIND_GLOBAL_CONSTANT( BUTTON_MASK_MIDDLE ),
- //joysticks
+ //joypads
BIND_GLOBAL_CONSTANT( JOY_BUTTON_0 ),
BIND_GLOBAL_CONSTANT( JOY_BUTTON_1 ),
BIND_GLOBAL_CONSTANT( JOY_BUTTON_2 ),
diff --git a/core/globals.cpp b/core/globals.cpp
index b6498c62e4..0b5fe4a82e 100644
--- a/core/globals.cpp
+++ b/core/globals.cpp
@@ -616,7 +616,7 @@ static Variant _decode_variant(const String& p_string) {
ERR_FAIL_COND_V(params.size()!=2,Variant());
InputEvent ie;
- ie.type=InputEvent::JOYSTICK_BUTTON;
+ ie.type=InputEvent::JOYPAD_BUTTON;
ie.device=params[0].to_int();
ie.joy_button.button_index=params[1].to_int();
@@ -628,7 +628,7 @@ static Variant _decode_variant(const String& p_string) {
ERR_FAIL_COND_V(params.size()!=2,Variant());
InputEvent ie;
- ie.type=InputEvent::JOYSTICK_MOTION;
+ ie.type=InputEvent::JOYPAD_MOTION;
ie.device=params[0].to_int();
int axis = params[1].to_int();;
ie.joy_motion.axis=axis>>1;
@@ -1031,11 +1031,11 @@ static String _encode_variant(const Variant& p_variant) {
return "mbutton("+itos(ev.device)+", "+itos(ev.mouse_button.button_index)+")";
} break;
- case InputEvent::JOYSTICK_BUTTON: {
+ case InputEvent::JOYPAD_BUTTON: {
return "jbutton("+itos(ev.device)+", "+itos(ev.joy_button.button_index)+")";
} break;
- case InputEvent::JOYSTICK_MOTION: {
+ case InputEvent::JOYPAD_MOTION: {
return "jaxis("+itos(ev.device)+", "+itos(ev.joy_motion.axis * 2 + (ev.joy_motion.axis_value<0?0:1))+")";
} break;
@@ -1463,7 +1463,7 @@ GlobalConfig::GlobalConfig() {
InputEvent key;
key.type=InputEvent::KEY;
InputEvent joyb;
- joyb.type=InputEvent::JOYSTICK_BUTTON;
+ joyb.type=InputEvent::JOYPAD_BUTTON;
GLOBAL_DEF("application/name","" );
diff --git a/core/input_map.cpp b/core/input_map.cpp
index 27cd0f5596..0379131dd3 100644
--- a/core/input_map.cpp
+++ b/core/input_map.cpp
@@ -125,7 +125,7 @@ List<InputEvent>::Element *InputMap::_find_event(List<InputEvent> &p_list,const
same=(e.key.scancode==p_event.key.scancode && (p_mod_ignore || e.key.mod == p_event.key.mod));
} break;
- case InputEvent::JOYSTICK_BUTTON: {
+ case InputEvent::JOYPAD_BUTTON: {
same=(e.joy_button.button_index==p_event.joy_button.button_index);
@@ -135,7 +135,7 @@ List<InputEvent>::Element *InputMap::_find_event(List<InputEvent> &p_list,const
same=(e.mouse_button.button_index==p_event.mouse_button.button_index);
} break;
- case InputEvent::JOYSTICK_MOTION: {
+ case InputEvent::JOYPAD_MOTION: {
same=(e.joy_motion.axis==p_event.joy_motion.axis && (e.joy_motion.axis_value < 0) == (p_event.joy_motion.axis_value < 0));
diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp
index e10e4413bc..b65ca9a696 100644
--- a/core/io/marshalls.cpp
+++ b/core/io/marshalls.cpp
@@ -423,7 +423,7 @@ Error decode_variant(Variant& r_variant,const uint8_t *p_buffer, int p_len,int *
(*r_len)+=4;
} break;
- case InputEvent::JOYSTICK_BUTTON: {
+ case InputEvent::JOYPAD_BUTTON: {
ie.joy_button.button_index=decode_uint32(&buf[12]);
if (r_len)
@@ -435,7 +435,7 @@ Error decode_variant(Variant& r_variant,const uint8_t *p_buffer, int p_len,int *
if (r_len)
(*r_len)+=4;
} break;
- case InputEvent::JOYSTICK_MOTION: {
+ case InputEvent::JOYPAD_MOTION: {
ie.joy_motion.axis=decode_uint32(&buf[12]);
ie.joy_motion.axis_value=decode_float(&buf[16]);
@@ -1130,7 +1130,7 @@ Error encode_variant(const Variant& p_variant, uint8_t *r_buffer, int &r_len) {
}
llen+=4;
} break;
- case InputEvent::JOYSTICK_BUTTON: {
+ case InputEvent::JOYPAD_BUTTON: {
if (buf) {
@@ -1146,7 +1146,7 @@ Error encode_variant(const Variant& p_variant, uint8_t *r_buffer, int &r_len) {
}
llen+=4;
} break;
- case InputEvent::JOYSTICK_MOTION: {
+ case InputEvent::JOYPAD_MOTION: {
if (buf) {
diff --git a/core/os/input.cpp b/core/os/input.cpp
index 259108802f..d2bd433ed9 100644
--- a/core/os/input.cpp
+++ b/core/os/input.cpp
@@ -61,7 +61,7 @@ void Input::_bind_methods() {
ClassDB::bind_method(_MD("get_joy_axis","device","axis"),&Input::get_joy_axis);
ClassDB::bind_method(_MD("get_joy_name","device"),&Input::get_joy_name);
ClassDB::bind_method(_MD("get_joy_guid","device"),&Input::get_joy_guid);
- ClassDB::bind_method(_MD("get_connected_joysticks"),&Input::get_connected_joysticks);
+ ClassDB::bind_method(_MD("get_connected_joypads"),&Input::get_connected_joypads);
ClassDB::bind_method(_MD("get_joy_vibration_strength", "device"), &Input::get_joy_vibration_strength);
ClassDB::bind_method(_MD("get_joy_vibration_duration", "device"), &Input::get_joy_vibration_duration);
ClassDB::bind_method(_MD("get_joy_button_string", "button_index"), &Input::get_joy_button_string);
diff --git a/core/os/input.h b/core/os/input.h
index a137820972..c365894f46 100644
--- a/core/os/input.h
+++ b/core/os/input.h
@@ -64,7 +64,7 @@ public:
virtual float get_joy_axis(int p_device,int p_axis) const=0;
virtual String get_joy_name(int p_idx)=0;
- virtual Array get_connected_joysticks()=0;
+ virtual Array get_connected_joypads()=0;
virtual void joy_connection_changed(int p_idx, bool p_connected, String p_name, String p_guid)=0;
virtual void add_joy_mapping(String p_mapping, bool p_update_existing=false)=0;
virtual void remove_joy_mapping(String p_guid)=0;
diff --git a/core/os/input_event.cpp b/core/os/input_event.cpp
index b0008a0481..5c681f1a82 100644
--- a/core/os/input_event.cpp
+++ b/core/os/input_event.cpp
@@ -61,10 +61,10 @@ bool InputEvent::operator==(const InputEvent &p_event) const {
&& mouse_button.button_index == p_event.mouse_button.button_index
&& mouse_button.button_mask == p_event.mouse_button.button_mask
&& key.mod == p_event.key.mod;
- case JOYSTICK_MOTION:
+ case JOYPAD_MOTION:
return joy_motion.axis == p_event.joy_motion.axis
&& joy_motion.axis_value == p_event.joy_motion.axis_value;
- case JOYSTICK_BUTTON:
+ case JOYPAD_BUTTON:
return joy_button.pressed == p_event.joy_button.pressed
&& joy_button.button_index == p_event.joy_button.button_index
&& joy_button.pressure == p_event.joy_button.pressure;
@@ -155,14 +155,14 @@ InputEvent::operator String() const {
return str;
} break;
- case JOYSTICK_MOTION: {
- str+= "Event: JoystickMotion ";
+ case JOYPAD_MOTION: {
+ str+= "Event: JoypadMotion ";
str=str+"Axis: "+itos(joy_motion.axis)+" Value: " +rtos(joy_motion.axis_value);
return str;
} break;
- case JOYSTICK_BUTTON: {
- str+= "Event: JoystickButton ";
+ case JOYPAD_BUTTON: {
+ str+= "Event: JoypadButton ";
str=str+"Pressed: "+itos(joy_button.pressed)+" Index: " +itos(joy_button.button_index)+" pressure "+rtos(joy_button.pressure);
return str;
@@ -203,9 +203,9 @@ bool InputEvent::is_pressed() const {
case KEY: return key.pressed;
case MOUSE_BUTTON: return mouse_button.pressed;
- case JOYSTICK_BUTTON: return joy_button.pressed;
+ case JOYPAD_BUTTON: return joy_button.pressed;
case SCREEN_TOUCH: return screen_touch.pressed;
- case JOYSTICK_MOTION: return ABS(joy_motion.axis_value) > 0.5;
+ case JOYPAD_MOTION: return ABS(joy_motion.axis_value) > 0.5;
case ACTION: return action.pressed;
default: {}
}
diff --git a/core/os/input_event.h b/core/os/input_event.h
index 8fe033aa3c..a557de2bd7 100644
--- a/core/os/input_event.h
+++ b/core/os/input_event.h
@@ -225,13 +225,13 @@ struct InputEventMouseMotion : public InputEventMouse {
float speed_x,speed_y;
};
-struct InputEventJoystickMotion {
+struct InputEventJoypadMotion {
- int axis; ///< Joystick axis
+ int axis; ///< Joypad axis
float axis_value; ///< -1 to 1
};
-struct InputEventJoystickButton {
+struct InputEventJoypadButton {
int button_index;
bool pressed;
@@ -267,8 +267,8 @@ struct InputEvent {
KEY,
MOUSE_MOTION,
MOUSE_BUTTON,
- JOYSTICK_MOTION,
- JOYSTICK_BUTTON,
+ JOYPAD_MOTION,
+ JOYPAD_BUTTON,
SCREEN_TOUCH,
SCREEN_DRAG,
ACTION,
@@ -282,8 +282,8 @@ struct InputEvent {
union {
InputEventMouseMotion mouse_motion;
InputEventMouseButton mouse_button;
- InputEventJoystickMotion joy_motion;
- InputEventJoystickButton joy_button;
+ InputEventJoypadMotion joy_motion;
+ InputEventJoypadButton joy_button;
InputEventKey key;
InputEventScreenTouch screen_touch;
InputEventScreenDrag screen_drag;
diff --git a/core/os/os.cpp b/core/os/os.cpp
index 82500f5423..677bf63e69 100644
--- a/core/os/os.cpp
+++ b/core/os/os.cpp
@@ -533,7 +533,7 @@ bool OS::is_joy_known(int p_device) {
}
String OS::get_joy_guid(int p_device) const {
- return "Default Joystick";
+ return "Default Joypad";
}
void OS::set_context(int p_context) {
diff --git a/core/tests/test_physics.cpp b/core/tests/test_physics.cpp
index 15dc40a4fd..b1a7af8dad 100644
--- a/core/tests/test_physics.cpp
+++ b/core/tests/test_physics.cpp
@@ -301,7 +301,7 @@ public:
}
- if (p_event.type == InputEvent::JOYSTICK_MOTION) {
+ if (p_event.type == InputEvent::JOYPAD_MOTION) {
if (p_event.joy_motion.axis == 0) {
diff --git a/core/variant_call.cpp b/core/variant_call.cpp
index a9adc744b6..a54737faf8 100644
--- a/core/variant_call.cpp
+++ b/core/variant_call.cpp
@@ -1777,8 +1777,8 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl
_VariantCall::add_constant(Variant::INPUT_EVENT,"KEY",InputEvent::KEY);
_VariantCall::add_constant(Variant::INPUT_EVENT,"MOUSE_MOTION",InputEvent::MOUSE_MOTION);
_VariantCall::add_constant(Variant::INPUT_EVENT,"MOUSE_BUTTON",InputEvent::MOUSE_BUTTON);
- _VariantCall::add_constant(Variant::INPUT_EVENT,"JOYSTICK_MOTION",InputEvent::JOYSTICK_MOTION);
- _VariantCall::add_constant(Variant::INPUT_EVENT,"JOYSTICK_BUTTON",InputEvent::JOYSTICK_BUTTON);
+ _VariantCall::add_constant(Variant::INPUT_EVENT,"JOYPAD_MOTION",InputEvent::JOYPAD_MOTION);
+ _VariantCall::add_constant(Variant::INPUT_EVENT,"JOYPAD_BUTTON",InputEvent::JOYPAD_BUTTON);
_VariantCall::add_constant(Variant::INPUT_EVENT,"SCREEN_TOUCH",InputEvent::SCREEN_TOUCH);
_VariantCall::add_constant(Variant::INPUT_EVENT,"SCREEN_DRAG",InputEvent::SCREEN_DRAG);
_VariantCall::add_constant(Variant::INPUT_EVENT,"ACTION",InputEvent::ACTION);
diff --git a/core/variant_op.cpp b/core/variant_op.cpp
index a8495a4913..84edb51c73 100644
--- a/core/variant_op.cpp
+++ b/core/variant_op.cpp
@@ -1744,7 +1744,7 @@ void Variant::set(const Variant& p_index, const Variant& p_value, bool *r_valid)
}
- if (ie.type==InputEvent::JOYSTICK_BUTTON) {
+ if (ie.type==InputEvent::JOYPAD_BUTTON) {
if (str=="button_index") {
if (p_value.type!=Variant::REAL && p_value.type!=Variant::INT)
@@ -1769,7 +1769,7 @@ void Variant::set(const Variant& p_index, const Variant& p_value, bool *r_valid)
}
- if (ie.type==InputEvent::JOYSTICK_MOTION) {
+ if (ie.type==InputEvent::JOYPAD_MOTION) {
if (str=="axis") {
if (p_value.type!=Variant::REAL && p_value.type!=Variant::INT)
@@ -2367,7 +2367,7 @@ Variant Variant::get(const Variant& p_index, bool *r_valid) const {
}
- if (ie.type==InputEvent::JOYSTICK_BUTTON) {
+ if (ie.type==InputEvent::JOYPAD_BUTTON) {
if (str=="button_index") {
valid=true;
@@ -2382,7 +2382,7 @@ Variant Variant::get(const Variant& p_index, bool *r_valid) const {
}
- if (ie.type==InputEvent::JOYSTICK_MOTION) {
+ if (ie.type==InputEvent::JOYPAD_MOTION) {
if (str=="axis") {
valid=true;
@@ -2863,7 +2863,7 @@ void Variant::get_property_list(List<PropertyInfo> *p_list) const {
}
- if (ie.type==InputEvent::JOYSTICK_BUTTON) {
+ if (ie.type==InputEvent::JOYPAD_BUTTON) {
p_list->push_back( PropertyInfo(Variant::INT,"button_index") );
p_list->push_back( PropertyInfo(Variant::BOOL,"pressed") );
@@ -2871,7 +2871,7 @@ void Variant::get_property_list(List<PropertyInfo> *p_list) const {
}
- if (ie.type==InputEvent::JOYSTICK_MOTION) {
+ if (ie.type==InputEvent::JOYPAD_MOTION) {
p_list->push_back( PropertyInfo(Variant::INT,"axis") );
p_list->push_back( PropertyInfo(Variant::REAL,"value") );
diff --git a/core/variant_parser.cpp b/core/variant_parser.cpp
index 325c998ec5..1a11eb80d5 100644
--- a/core/variant_parser.cpp
+++ b/core/variant_parser.cpp
@@ -1083,7 +1083,7 @@ Error VariantParser::parse_value(Token& token,Variant &value,Stream *p_stream,in
return ERR_PARSE_ERROR;
}
- ie.type=InputEvent::JOYSTICK_BUTTON;
+ ie.type=InputEvent::JOYPAD_BUTTON;
get_token(p_stream,token,line,r_err_str);
if (token.type!=TK_NUMBER) {
@@ -1107,7 +1107,7 @@ Error VariantParser::parse_value(Token& token,Variant &value,Stream *p_stream,in
return ERR_PARSE_ERROR;
}
- ie.type=InputEvent::JOYSTICK_MOTION;
+ ie.type=InputEvent::JOYPAD_MOTION;
get_token(p_stream,token,line,r_err_str);
if (token.type!=TK_NUMBER) {
@@ -1387,7 +1387,7 @@ Error VariantParser::parse_value(Token& token,Variant &value,Stream *p_stream,in
return err;
ERR_FAIL_COND_V(params.size()!=2,ERR_PARSE_ERROR);
InputEvent ie;
- ie.type=InputEvent::JOYSTICK_BUTTON;
+ ie.type=InputEvent::JOYPAD_BUTTON;
ie.device=params[0].to_int();
ie.joy_button.button_index=params[1].to_int();
@@ -1403,7 +1403,7 @@ Error VariantParser::parse_value(Token& token,Variant &value,Stream *p_stream,in
ERR_FAIL_COND_V(params.size()!=2,ERR_PARSE_ERROR);
InputEvent ie;
- ie.type=InputEvent::JOYSTICK_MOTION;
+ ie.type=InputEvent::JOYPAD_MOTION;
ie.device=params[0].to_int();
int axis=params[1].to_int();
ie.joy_motion.axis=axis>>1;
@@ -2065,11 +2065,11 @@ Error VariantWriter::write(const Variant& p_variant, StoreStringFunc p_store_str
str+="MBUTTON,"+itos(ev.mouse_button.button_index);
} break;
- case InputEvent::JOYSTICK_BUTTON: {
+ case InputEvent::JOYPAD_BUTTON: {
str+="JBUTTON,"+itos(ev.joy_button.button_index);
} break;
- case InputEvent::JOYSTICK_MOTION: {
+ case InputEvent::JOYPAD_MOTION: {
str+="JAXIS,"+itos(ev.joy_motion.axis)+","+itos(ev.joy_motion.axis_value);
} break;
case InputEvent::NONE: {
diff --git a/main/input_default.cpp b/main/input_default.cpp
index df77f0a4b8..b9839ed80d 100644
--- a/main/input_default.cpp
+++ b/main/input_default.cpp
@@ -126,16 +126,16 @@ bool InputDefault::is_action_pressed(const StringName& p_action) const{
if(mouse_button_mask&(1<<iemb.button_index))
return true;
} break;
- case InputEvent::JOYSTICK_BUTTON: {
+ case InputEvent::JOYPAD_BUTTON: {
- const InputEventJoystickButton &iejb=E->get().joy_button;
+ const InputEventJoypadButton &iejb=E->get().joy_button;
int c = _combine_device(iejb.button_index,device);
if (joy_buttons_pressed.has(c))
return true;
} break;
- case InputEvent::JOYSTICK_MOTION: {
+ case InputEvent::JOYPAD_MOTION: {
- const InputEventJoystickMotion &iejm=E->get().joy_motion;
+ const InputEventJoypadMotion &iejm=E->get().joy_motion;
int c = _combine_device(iejm.axis,device);
if (_joy_axis.has(c)) {
if (iejm.axis_value < 0) {
@@ -235,7 +235,7 @@ static String _hex_str(uint8_t p_byte) {
void InputDefault::joy_connection_changed(int p_idx, bool p_connected, String p_name, String p_guid) {
_THREAD_SAFE_METHOD_
- Joystick js;
+ Joypad js;
js.name = p_connected ? p_name : "";
js.uid = p_connected ? p_guid : "";
js.mapping = -1;
@@ -356,7 +356,7 @@ void InputDefault::parse_input_event(const InputEvent& p_event) {
}
} break;
- case InputEvent::JOYSTICK_BUTTON: {
+ case InputEvent::JOYPAD_BUTTON: {
int c = _combine_device(p_event.joy_button.button_index,p_event.device);
@@ -365,7 +365,7 @@ void InputDefault::parse_input_event(const InputEvent& p_event) {
else
joy_buttons_pressed.erase(c);
} break;
- case InputEvent::JOYSTICK_MOTION: {
+ case InputEvent::JOYPAD_MOTION: {
set_joy_axis(p_event.device, p_event.joy_motion.axis, p_event.joy_motion.axis_value);
} break;
@@ -580,7 +580,7 @@ static const char *s_ControllerMappings [] =
"4f0400b3000000000000504944564944,Thrustmaster Firestorm Dual Power,a:b0,b:b2,y:b3,x:b1,start:b10,guide:b8,back:b9,leftstick:b11,rightstick:b12,leftshoulder:b4,rightshoulder:b6,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b5,righttrigger:b7,",
"4f0415b3000000000000504944564944,Thrustmaster Dual Analog 3.2,x:b1,a:b0,b:b2,y:b3,back:b8,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b5,rightshoulder:b6,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,",
"4f0423b3000000000000504944564944,Dual Trigger 3-in-1,a:b1,b:b2,x:b0,y:b3,back:b8,start:b9,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a5,lefttrigger:b6,righttrigger:b7",
- "63252305000000000000504944564944,USB Vibration Joystick (BM),x:b3,a:b2,b:b1,y:b0,back:b8,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,",
+ "63252305000000000000504944564944,USB Vibration Joypad (BM),x:b3,a:b2,b:b1,y:b0,back:b8,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,",
"6d0416c2000000000000504944564944,Generic DirectInput Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
"6d0418c2000000000000504944564944,Logitech RumblePad 2 USB,x:b0,a:b1,b:b2,y:b3,back:b8,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,",
"6d0419c2000000000000504944564944,Logitech F710 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
@@ -596,7 +596,7 @@ static const char *s_ControllerMappings [] =
"8f0e1200000000000000504944564944,Acme,x:b2,a:b0,b:b1,y:b3,back:b8,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b5,rightshoulder:b6,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a3,righty:a2,",
"9000318000000000000504944564944,Mayflash Wiimote PC Adapter,a:b2,b:h0.4,x:b0,y:b1,back:b4,start:b5,guide:b11,leftshoulder:b6,rightshoulder:b3,leftx:a0,lefty:a1,",
"a3060cff000000000000504944564944,Saitek P2500,a:b2,b:b3,y:b1,x:b0,start:b4,guide:b10,back:b5,leftstick:b8,rightstick:b9,leftshoulder:b6,rightshoulder:b7,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,",
- "c0111352000000000000504944564944,Battalife Joystick,x:b4,a:b6,b:b7,y:b5,back:b2,start:b3,leftshoulder:b0,rightshoulder:b1,leftx:a0,lefty:a1,",
+ "c0111352000000000000504944564944,Battalife Joypad,x:b4,a:b6,b:b7,y:b5,back:b2,start:b3,leftshoulder:b0,rightshoulder:b1,leftx:a0,lefty:a1,",
"c911f055000000000000504944564944,GAMEPAD,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
"d6206dca000000000000504944564944,PowerA Pro Ex,a:b1,b:b2,x:b0,y:b3,back:b8,guide:b12,start:b9,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.0,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,",
"ff113133000000000000504944564944,Gembird JPD-DualForce,a:b2,b:b3,x:b0,y:b1,start:b9,back:b8,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a4,lefttrigger:b6,righttrigger:b7,leftstick:b10,rightstick:b11,",
@@ -613,7 +613,7 @@ static const char *s_ControllerMappings [] =
"0d0f0000000000006600000000000000,HORIPAD FPS PLUS 4,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a5,lefttrigger:b6,righttrigger:a4,",
"10280000000000000900000000000000,8Bitdo SFC30 GamePad,a:b1,b:b0,x:b4,y:b3,back:b10,start:b11,leftshoulder:b6,rightshoulder:b7,leftx:a0,lefty:a1,",
"2509000000000000e803000000000000,Mayflash Wii Classic Controller,a:b1,b:b0,x:b3,y:b2,back:b8,guide:b10,start:b9,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:b11,dpdown:b13,dpleft:b12,dpright:b14,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,",
- "351200000000000021ab000000000000,SFC30 Joystick,a:b1,b:b0,x:b4,y:b3,back:b10,start:b11,leftshoulder:b6,rightshoulder:b7,leftx:a0,lefty:a1,",
+ "351200000000000021ab000000000000,SFC30 Joypad,a:b1,b:b0,x:b4,y:b3,back:b10,start:b11,leftshoulder:b6,rightshoulder:b7,leftx:a0,lefty:a1,",
"4c050000000000006802000000000000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,",
"4c05000000000000c405000000000000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
"4f0400000000000000b3000000000000,Thrustmaster Firestorm Dual Power,a:b0,b:b2,y:b3,x:b1,start:b10,guide:b8,back:b9,leftstick:b11,rightstick:,leftshoulder:b4,rightshoulder:b6,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b5,righttrigger:b7,",
@@ -684,13 +684,13 @@ static const char *s_ControllerMappings [] =
"030000006f0e00003001000001010000,EA Sports PS3 Controller,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,",
"030000006f0e00003901000020060000,Afterglow Wired Controller for Xbox One,x:b2,a:b0,b:b1,y:b3,back:b6,guide:b8,start:b7,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a3,righty:a4,",
"030000006f0e00004601000001010000,Rock Candy Wired Controller for Xbox One,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,guide:b8,leftstick:b9,rightstick:b10,lefttrigger:a2,righttrigger:a5,leftx:a0,lefty:a1,rightx:a3,righty:a4,",
- "03000000790000000600000010010000,DragonRise Inc. Generic USB Joystick,x:b3,a:b2,b:b1,y:b0,back:b8,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a3,righty:a4,",
+ "03000000790000000600000010010000,DragonRise Inc. Generic USB Joypad,x:b3,a:b2,b:b1,y:b0,back:b8,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a3,righty:a4,",
"03000000790000001100000010010000,RetroLink Saturn Classic Controller,x:b3,a:b0,b:b1,y:b4,back:b5,guide:b2,start:b8,leftshoulder:b6,rightshoulder:b7,leftx:a0,lefty:a1,",
"03000000830500006020000010010000,iBuffalo USB 2-axis 8-button Gamepad,a:b1,b:b0,x:b3,y:b2,back:b6,start:b7,leftshoulder:b4,rightshoulder:b5,leftx:a0,lefty:a1,",
"030000008916000000fd000024010000,Razer Onza Tournament,a:b0,b:b1,y:b3,x:b2,start:b7,guide:b8,back:b6,leftstick:b9,rightstick:b10,leftshoulder:b4,rightshoulder:b5,dpup:b13,dpleft:b11,dpdown:b14,dpright:b12,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,",
"030000008916000001fd000024010000,Razer Onza Classic Edition,x:b2,a:b0,b:b1,y:b3,back:b6,guide:b8,start:b7,dpleft:b11,dpdown:b14,dpright:b12,dpup:b13,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a3,righty:a4,",
- "030000008f0e00000300000010010000,GreenAsia Inc. USB Joystick,x:b3,a:b2,b:b1,y:b0,back:b8,start:b9,dpleft:h0.8,dpdown:h0.0,dpdown:h0.4,dpright:h0.0,dpright:h0.2,dpup:h0.0,dpup:h0.1,leftshoulder:h0.0,leftshoulder:b6,lefttrigger:b4,rightshoulder:b7,righttrigger:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a3,righty:a2,",
- "030000008f0e00001200000010010000,GreenAsia Inc. USB Joystick,x:b2,a:b0,b:b1,y:b3,back:b8,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b5,rightshoulder:b6,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a3,righty:a2,",
+ "030000008f0e00000300000010010000,GreenAsia Inc. USB Joypad,x:b3,a:b2,b:b1,y:b0,back:b8,start:b9,dpleft:h0.8,dpdown:h0.0,dpdown:h0.4,dpright:h0.0,dpright:h0.2,dpup:h0.0,dpup:h0.1,leftshoulder:h0.0,leftshoulder:b6,lefttrigger:b4,rightshoulder:b7,righttrigger:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a3,righty:a2,",
+ "030000008f0e00001200000010010000,GreenAsia Inc. USB Joypad,x:b2,a:b0,b:b1,y:b3,back:b8,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b5,rightshoulder:b6,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a3,righty:a2,",
"03000000a30600000901000000010000,Saitek P880,a:b2,b:b3,y:b1,x:b0,leftstick:b8,rightstick:b9,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a3,righty:a2,lefttrigger:b6,righttrigger:b7,",
"03000000a30600000c04000011010000,Saitek P2900 Wireless Pad,a:b1,b:b2,y:b3,x:b0,start:b12,guide:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b6,rightshoulder:b7,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a3,righty:a2,lefttrigger:b4,righttrigger:b5,",
"03000000a306000018f5000010010000,Saitek PLC Saitek P3200 Rumble Pad,x:b0,a:b1,b:b2,y:b3,back:b8,start:b9,dpleft:h0.8,dpdown:h0.0,dpdown:h0.4,dpright:h0.0,dpright:h0.2,dpup:h0.0,dpup:h0.1,leftshoulder:h0.0,leftshoulder:b4,lefttrigger:a2,rightshoulder:b6,rightshoulder:b5,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a3,righty:a4,",
@@ -791,7 +791,7 @@ InputDefault::InputDefault() {
uint32_t InputDefault::joy_button(uint32_t p_last_id, int p_device, int p_button, bool p_pressed) {
_THREAD_SAFE_METHOD_;
- Joystick& joy = joy_names[p_device];
+ Joypad& joy = joy_names[p_device];
//printf("got button %i, mapping is %i\n", p_button, joy.mapping);
if (joy.last_buttons[p_button] == p_pressed) {
return p_last_id;
@@ -831,7 +831,7 @@ uint32_t InputDefault::joy_axis(uint32_t p_last_id, int p_device, int p_axis, co
_THREAD_SAFE_METHOD_;
- Joystick& joy = joy_names[p_device];
+ Joypad& joy = joy_names[p_device];
if (joy.last_axis[p_axis] == p_value.value) {
return p_last_id;
@@ -935,7 +935,7 @@ uint32_t InputDefault::joy_axis(uint32_t p_last_id, int p_device, int p_axis, co
uint32_t InputDefault::joy_hat(uint32_t p_last_id, int p_device, int p_val) {
_THREAD_SAFE_METHOD_;
- const Joystick& joy = joy_names[p_device];
+ const Joypad& joy = joy_names[p_device];
JoyEvent* map;
@@ -969,7 +969,7 @@ uint32_t InputDefault::joy_hat(uint32_t p_last_id, int p_device, int p_val) {
uint32_t InputDefault::_button_event(uint32_t p_last_id, int p_device, int p_index, bool p_pressed) {
InputEvent ievent;
- ievent.type = InputEvent::JOYSTICK_BUTTON;
+ ievent.type = InputEvent::JOYPAD_BUTTON;
ievent.device = p_device;
ievent.ID = ++p_last_id;
ievent.joy_button.button_index = p_index;
@@ -983,7 +983,7 @@ uint32_t InputDefault::_button_event(uint32_t p_last_id, int p_device, int p_ind
uint32_t InputDefault::_axis_event(uint32_t p_last_id, int p_device, int p_axis, float p_value) {
InputEvent ievent;
- ievent.type = InputEvent::JOYSTICK_MOTION;
+ ievent.type = InputEvent::JOYPAD_MOTION;
ievent.device = p_device;
ievent.ID = ++p_last_id;
ievent.joy_motion.axis = p_axis;
@@ -1148,9 +1148,9 @@ String InputDefault::get_joy_guid_remapped(int p_device) const {
return joy_names[p_device].uid;
}
-Array InputDefault::get_connected_joysticks() {
+Array InputDefault::get_connected_joypads() {
Array ret;
- Map<int, Joystick>::Element *elem = joy_names.front();
+ Map<int, Joypad>::Element *elem = joy_names.front();
while (elem) {
if (elem->get().connected) {
ret.push_back(elem->key());
diff --git a/main/input_default.h b/main/input_default.h
index eb160cbc23..33a852ab10 100644
--- a/main/input_default.h
+++ b/main/input_default.h
@@ -84,7 +84,7 @@ class InputDefault : public Input {
SpeedTrack();
};
- struct Joystick {
+ struct Joypad {
StringName name;
StringName uid;
bool connected;
@@ -95,7 +95,7 @@ class InputDefault : public Input {
int mapping;
int hat_current;
- Joystick() {
+ Joypad() {
for (int i = 0; i < JOY_AXIS_MAX; i++) {
@@ -114,7 +114,7 @@ class InputDefault : public Input {
};
SpeedTrack mouse_speed_track;
- Map<int, Joystick> joy_names;
+ Map<int, Joypad> joy_names;
int fallback_mapping;
RES custom_cursor;
public:
@@ -184,12 +184,12 @@ public:
virtual float get_joy_axis(int p_device,int p_axis) const;
String get_joy_name(int p_idx);
- virtual Array get_connected_joysticks();
+ virtual Array get_connected_joypads();
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);
void joy_connection_changed(int p_idx, bool p_connected, String p_name, String p_guid = "");
- void parse_joystick_mapping(String p_mapping, bool p_update_existing);
+ void parse_joypad_mapping(String p_mapping, bool p_update_existing);
virtual Vector3 get_accelerometer() const;
virtual Vector3 get_magnetometer() const;
diff --git a/modules/cscript/godot_c.h b/modules/cscript/godot_c.h
index b0465d8524..3bf86d1aeb 100644
--- a/modules/cscript/godot_c.h
+++ b/modules/cscript/godot_c.h
@@ -123,8 +123,8 @@ void GDAPI godot_array_free(godot_array p_array);
#define INPUT_EVENT_TYPE_KEY 1
#define INPUT_EVENT_TYPE_MOUSE_MOTION 2
#define INPUT_EVENT_TYPE_MOUSE_BUTTON 3
-#define INPUT_EVENT_TYPE_JOYSTICK_MOTION 4
-#define INPUT_EVENT_TYPE_JOYSTICK_BUTTON 5
+#define INPUT_EVENT_TYPE_JOYPAD_MOTION 4
+#define INPUT_EVENT_TYPE_JOYPAD_BUTTON 5
#define INPUT_EVENT_TYPE_SCREEN_TOUCH 6
#define INPUT_EVENT_TYPE_SCREEN_DRAG 7
#define INPUT_EVENT_TYPE_ACTION 8
@@ -166,12 +166,12 @@ int GDAPI godot_input_event_mouse_motion_get_relative_y(godot_input_event p_even
int GDAPI godot_input_event_mouse_motion_get_speed_x(godot_input_event p_event);
int GDAPI godot_input_event_mouse_motion_get_speed_y(godot_input_event p_event);
-int GDAPI godot_input_event_joystick_motion_get_axis(godot_input_event p_event);
-float GDAPI godot_input_event_joystick_motion_get_axis_value(godot_input_event p_event);
+int GDAPI godot_input_event_joypad_motion_get_axis(godot_input_event p_event);
+float GDAPI godot_input_event_joypad_motion_get_axis_value(godot_input_event p_event);
-int GDAPI godot_input_event_joystick_button_get_button_index(godot_input_event p_event);
-godot_bool GDAPI godot_input_event_joystick_button_is_pressed(godot_input_event p_event);
-float GDAPI godot_input_event_joystick_button_get_pressure(godot_input_event p_event);
+int GDAPI godot_input_event_joypad_button_get_button_index(godot_input_event p_event);
+godot_bool GDAPI godot_input_event_joypad_button_is_pressed(godot_input_event p_event);
+float GDAPI godot_input_event_joypad_button_get_pressure(godot_input_event p_event);
int GDAPI godot_input_event_screen_touch_get_index(godot_input_event p_event);
diff --git a/modules/gdscript/gd_editor.cpp b/modules/gdscript/gd_editor.cpp
index ebb753d129..d3c3dac1fd 100644
--- a/modules/gdscript/gd_editor.cpp
+++ b/modules/gdscript/gd_editor.cpp
@@ -2391,8 +2391,8 @@ Error GDScriptLanguage::complete_code(const String& p_code, const String& p_base
"# Key",
"# MouseMotion",
"# MouseButton",
- "# JoystickMotion",
- "# JoystickButton",
+ "# JoypadMotion",
+ "# JoypadButton",
"# ScreenTouch",
"# ScreenDrag",
"# Action"
diff --git a/modules/visual_script/visual_script_flow_control.cpp b/modules/visual_script/visual_script_flow_control.cpp
index bc980d5b25..0e526f8a42 100644
--- a/modules/visual_script/visual_script_flow_control.cpp
+++ b/modules/visual_script/visual_script_flow_control.cpp
@@ -871,9 +871,9 @@ String VisualScriptInputFilter::get_output_sequence_port_text(int p_port) const
} break;
- case InputEvent::JOYSTICK_MOTION: {
+ case InputEvent::JOYPAD_MOTION: {
- InputEventJoystickMotion jm = filters[p_port].joy_motion;
+ InputEventJoypadMotion jm = filters[p_port].joy_motion;
text="JoyMotion Axis "+itos(jm.axis>>1);
if (jm.axis&1)
@@ -882,8 +882,8 @@ String VisualScriptInputFilter::get_output_sequence_port_text(int p_port) const
text+=" < "+rtos(-jm.axis_value);
} break;
- case InputEvent::JOYSTICK_BUTTON: {
- InputEventJoystickButton jb = filters[p_port].joy_button;
+ case InputEvent::JOYPAD_BUTTON: {
+ InputEventJoypadButton jb = filters[p_port].joy_button;
text="JoyButton "+itos(jb.button_index);
if (jb.pressed)
@@ -985,13 +985,13 @@ bool VisualScriptInputFilter::_set(const StringName& p_name, const Variant& p_va
if (what=="type") {
filters[idx]=InputEvent();
filters[idx].type=InputEvent::Type(int(p_value));
- if (filters[idx].type==InputEvent::JOYSTICK_MOTION) {
+ if (filters[idx].type==InputEvent::JOYPAD_MOTION) {
filters[idx].joy_motion.axis_value=0.5; //for treshold
} else if (filters[idx].type==InputEvent::KEY) {
filters[idx].key.pressed=true; //put these as true to make it more user friendly
} else if (filters[idx].type==InputEvent::MOUSE_BUTTON) {
filters[idx].mouse_button.pressed=true;
- } else if (filters[idx].type==InputEvent::JOYSTICK_BUTTON) {
+ } else if (filters[idx].type==InputEvent::JOYPAD_BUTTON) {
filters[idx].joy_button.pressed=true;
} else if (filters[idx].type==InputEvent::SCREEN_TOUCH) {
filters[idx].screen_touch.pressed=true;
@@ -1108,7 +1108,7 @@ bool VisualScriptInputFilter::_set(const StringName& p_name, const Variant& p_va
return true;
} break;
- case InputEvent::JOYSTICK_MOTION: {
+ case InputEvent::JOYPAD_MOTION: {
if (what=="axis") {
filters[idx].joy_motion.axis=int(p_value)<<1|filters[idx].joy_motion.axis;
@@ -1124,7 +1124,7 @@ bool VisualScriptInputFilter::_set(const StringName& p_name, const Variant& p_va
} break;
- case InputEvent::JOYSTICK_BUTTON: {
+ case InputEvent::JOYPAD_BUTTON: {
if (what=="button_index") {
filters[idx].joy_button.button_index=p_value;
@@ -1326,7 +1326,7 @@ bool VisualScriptInputFilter::_get(const StringName& p_name,Variant &r_ret) cons
return true;
} break;
- case InputEvent::JOYSTICK_MOTION: {
+ case InputEvent::JOYPAD_MOTION: {
if (what=="axis_index") {
r_ret=filters[idx].joy_motion.axis>>1;
@@ -1341,7 +1341,7 @@ bool VisualScriptInputFilter::_get(const StringName& p_name,Variant &r_ret) cons
} break;
- case InputEvent::JOYSTICK_BUTTON: {
+ case InputEvent::JOYPAD_BUTTON: {
if (what=="button_index") {
r_ret=filters[idx].joy_button.button_index;
@@ -1417,8 +1417,8 @@ static const char* event_type_names[InputEvent::TYPE_MAX]={
"Key",
"MouseMotion",
"MouseButton",
- "JoystickMotion",
- "JoystickButton",
+ "JoypadMotion",
+ "JoypadButton",
"ScreenTouch",
"ScreenDrag",
"Action"
@@ -1489,13 +1489,13 @@ void VisualScriptInputFilter::_get_property_list( List<PropertyInfo> *p_list) co
p_list->push_back(PropertyInfo(Variant::BOOL,base+"mod_meta"));
} break;
- case InputEvent::JOYSTICK_MOTION: {
+ case InputEvent::JOYPAD_MOTION: {
p_list->push_back(PropertyInfo(Variant::INT,base+"axis_index"));
p_list->push_back(PropertyInfo(Variant::INT,base+"mode",PROPERTY_HINT_ENUM,"Min,Max"));
p_list->push_back(PropertyInfo(Variant::REAL,base+"treshold",PROPERTY_HINT_RANGE,"0,1,0.01"));
} break;
- case InputEvent::JOYSTICK_BUTTON: {
+ case InputEvent::JOYPAD_BUTTON: {
p_list->push_back(PropertyInfo(Variant::INT,base+"button_index"));
p_list->push_back(PropertyInfo(Variant::BOOL,base+"pressed"));
@@ -1632,10 +1632,10 @@ public:
} break;
- case InputEvent::JOYSTICK_MOTION: {
+ case InputEvent::JOYPAD_MOTION: {
- InputEventJoystickMotion jm = ie.joy_motion;
- InputEventJoystickMotion jm2 = event.joy_motion;
+ InputEventJoypadMotion jm = ie.joy_motion;
+ InputEventJoypadMotion jm2 = event.joy_motion;
int axis = jm.axis>>1;
@@ -1656,9 +1656,9 @@ public:
} break;
- case InputEvent::JOYSTICK_BUTTON: {
- InputEventJoystickButton jb = ie.joy_button;
- InputEventJoystickButton jb2 = event.joy_button;
+ case InputEvent::JOYPAD_BUTTON: {
+ InputEventJoypadButton jb = ie.joy_button;
+ InputEventJoypadButton jb2 = event.joy_button;
if ( jb.button_index==jb2.button_index &&
jb.pressed == jb2.pressed
diff --git a/modules/visual_script/visual_script_func_nodes.cpp b/modules/visual_script/visual_script_func_nodes.cpp
index bf2b4016c7..9f3ba8a8cb 100644
--- a/modules/visual_script/visual_script_func_nodes.cpp
+++ b/modules/visual_script/visual_script_func_nodes.cpp
@@ -971,8 +971,8 @@ static const char* event_type_names[InputEvent::TYPE_MAX]={
"Key",
"MouseMotion",
"MouseButton",
- "JoystickMotion",
- "JoystickButton",
+ "JoypadMotion",
+ "JoypadButton",
"ScreenTouch",
"ScreenDrag",
"Action"
diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp
index e442cd48e7..0ccdfedb81 100644
--- a/modules/visual_script/visual_script_nodes.cpp
+++ b/modules/visual_script/visual_script_nodes.cpp
@@ -3848,7 +3848,7 @@ void VisualScriptDeconstruct::_bind_methods() {
argt+=","+Variant::get_type_name(Variant::Type(i));
}
- String iet="None,Key,MouseMotion,MouseButton,JoystickMotion,JoystickButton,ScreenTouch,ScreenDrag,Action";
+ String iet="None,Key,MouseMotion,MouseButton,JoypadMotion,JoypadButton,ScreenTouch,ScreenDrag,Action";
ADD_PROPERTY( PropertyInfo(Variant::INT,"type",PROPERTY_HINT_ENUM,argt),_SCS("set_deconstruct_type"),_SCS("get_deconstruct_type"));
ADD_PROPERTY( PropertyInfo(Variant::INT,"input_type",PROPERTY_HINT_ENUM,iet),_SCS("set_deconstruct_input_type"),_SCS("get_deconstruct_input_type"));
diff --git a/platform/android/java_glue.cpp b/platform/android/java_glue.cpp
index 6d47946263..3e8ce35910 100644
--- a/platform/android/java_glue.cpp
+++ b/platform/android/java_glue.cpp
@@ -642,7 +642,7 @@ struct JAndroidPointerEvent {
static List<JAndroidPointerEvent> pointer_events;
static List<InputEvent> key_events;
-static List<OS_Android::JoystickEvent> joy_events;
+static List<OS_Android::JoypadEvent> joy_events;
static bool initialized=false;
static Mutex *input_mutex=NULL;
static Mutex *suspend_mutex=NULL;
@@ -1090,7 +1090,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_step(JNIEnv * env, jo
while (joy_events.size()) {
- OS_Android::JoystickEvent event = joy_events.front()->get();
+ OS_Android::JoypadEvent event = joy_events.front()->get();
os_android->process_joy_event(event);
joy_events.pop_front();
@@ -1415,7 +1415,7 @@ static unsigned int android_get_keysym(unsigned int p_code) {
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joybutton(JNIEnv * env, jobject obj, jint p_device, jint p_button, jboolean p_pressed) {
- OS_Android::JoystickEvent jevent;
+ OS_Android::JoypadEvent jevent;
jevent.device = p_device;
jevent.type = OS_Android::JOY_EVENT_BUTTON;
jevent.index = p_button;
@@ -1428,7 +1428,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joybutton(JNIEnv * en
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joyaxis(JNIEnv * env, jobject obj, jint p_device, jint p_axis, jfloat p_value) {
- OS_Android::JoystickEvent jevent;
+ OS_Android::JoypadEvent jevent;
jevent.device = p_device;
jevent.type = OS_Android::JOY_EVENT_AXIS;
jevent.index = p_axis;
@@ -1440,7 +1440,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joyaxis(JNIEnv * env,
}
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joyhat(JNIEnv * env, jobject obj, jint p_device, jint p_hat_x, jint p_hat_y) {
- OS_Android::JoystickEvent jevent;
+ OS_Android::JoypadEvent jevent;
jevent.device = p_device;
jevent.type = OS_Android::JOY_EVENT_HAT;
int hat = 0;
diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp
index 093064104a..e625c0d7ec 100644
--- a/platform/android/os_android.cpp
+++ b/platform/android/os_android.cpp
@@ -370,7 +370,7 @@ void OS_Android::main_loop_focusin(){
}
-void OS_Android::process_joy_event(OS_Android::JoystickEvent p_event) {
+void OS_Android::process_joy_event(OS_Android::JoypadEvent p_event) {
switch (p_event.type) {
case JOY_EVENT_BUTTON:
diff --git a/platform/android/os_android.h b/platform/android/os_android.h
index 68b50b2087..5e1fc10fd6 100644
--- a/platform/android/os_android.h
+++ b/platform/android/os_android.h
@@ -91,7 +91,7 @@ public:
JOY_EVENT_HAT = 2
};
- struct JoystickEvent {
+ struct JoypadEvent {
int device;
int type;
@@ -249,7 +249,7 @@ public:
void process_magnetometer(const Vector3& p_magnetometer);
void process_gyroscope(const Vector3& p_gyroscope);
void process_touch(int p_what,int p_pointer, const Vector<TouchPos>& p_points);
- void process_joy_event(JoystickEvent p_event);
+ void process_joy_event(JoypadEvent p_event);
void process_event(InputEvent p_event);
void init_video_mode(int p_video_width,int p_video_height);
diff --git a/platform/iphone/os_iphone.cpp b/platform/iphone/os_iphone.cpp
index e4d99cc502..1d12501aea 100644
--- a/platform/iphone/os_iphone.cpp
+++ b/platform/iphone/os_iphone.cpp
@@ -331,7 +331,7 @@ void OSIPhone::update_accelerometer(float p_x, float p_y, float p_z) {
if (p_x != last_accel.x) {
//printf("updating accel x %f\n", p_x);
InputEvent ev;
- ev.type = InputEvent::JOYSTICK_MOTION;
+ ev.type = InputEvent::JOYPAD_MOTION;
ev.device = 0;
ev.joy_motion.axis = JOY_ANALOG_0_X;
ev.joy_motion.axis_value = (p_x / (float)ACCEL_RANGE);
@@ -342,7 +342,7 @@ void OSIPhone::update_accelerometer(float p_x, float p_y, float p_z) {
if (p_y != last_accel.y) {
//printf("updating accel y %f\n", p_y);
InputEvent ev;
- ev.type = InputEvent::JOYSTICK_MOTION;
+ ev.type = InputEvent::JOYPAD_MOTION;
ev.device = 0;
ev.joy_motion.axis = JOY_ANALOG_0_Y;
ev.joy_motion.axis_value = (p_y / (float)ACCEL_RANGE);
@@ -353,7 +353,7 @@ void OSIPhone::update_accelerometer(float p_x, float p_y, float p_z) {
if (p_z != last_accel.z) {
//printf("updating accel z %f\n", p_z);
InputEvent ev;
- ev.type = InputEvent::JOYSTICK_MOTION;
+ ev.type = InputEvent::JOYPAD_MOTION;
ev.device = 0;
ev.joy_motion.axis = JOY_ANALOG_1_X;
ev.joy_motion.axis_value = ( (1.0 - p_z) / (float)ACCEL_RANGE);
diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp
index 3553bdc7a6..47c8ea89d7 100644
--- a/platform/javascript/os_javascript.cpp
+++ b/platform/javascript/os_javascript.cpp
@@ -519,7 +519,7 @@ bool OS_JavaScript::main_loop_iterate() {
}
- process_joysticks();
+ process_joypads();
return Main::iteration();
}
@@ -824,7 +824,7 @@ void OS_JavaScript::_close_notification_funcs(const String& p_file,int p_flags)
}
}
-void OS_JavaScript::process_joysticks() {
+void OS_JavaScript::process_joypads() {
int joy_count = emscripten_get_num_gamepads();
for (int i = 0; i < joy_count; i++) {
diff --git a/platform/javascript/os_javascript.h b/platform/javascript/os_javascript.h
index 4cdc88f4f9..370322e93d 100644
--- a/platform/javascript/os_javascript.h
+++ b/platform/javascript/os_javascript.h
@@ -93,7 +93,7 @@ private:
static void _close_notification_funcs(const String& p_file,int p_flags);
- void process_joysticks();
+ void process_joypads();
public:
diff --git a/platform/osx/joystick_osx.cpp b/platform/osx/joystick_osx.cpp
index 740c349fe1..18c714e922 100644
--- a/platform/osx/joystick_osx.cpp
+++ b/platform/osx/joystick_osx.cpp
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* joystick_osx.cpp */
+/* joypad_osx.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -26,14 +26,14 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "joystick_osx.h"
+#include "joypad_osx.h"
#include <machine/endian.h>
-#define GODOT_JOY_LOOP_RUN_MODE CFSTR("GodotJoystick")
+#define GODOT_JOY_LOOP_RUN_MODE CFSTR("GodotJoypad")
-static JoystickOSX* self = NULL;
+static JoypadOSX* self = NULL;
-joystick::joystick() {
+joypad::joypad() {
device_ref = NULL;
ff_device = NULL;
ff_axes = NULL;
@@ -56,7 +56,7 @@ joystick::joystick() {
ff_effect.dwSize = sizeof(ff_effect);
}
-void joystick::free() {
+void joypad::free() {
if (device_ref) {
IOHIDDeviceUnscheduleFromRunLoop(device_ref, CFRunLoopGetCurrent(), GODOT_JOY_LOOP_RUN_MODE);
}
@@ -68,7 +68,7 @@ void joystick::free() {
}
}
-bool joystick::has_element(IOHIDElementCookie p_cookie, Vector<rec_element> *p_list) const {
+bool joypad::has_element(IOHIDElementCookie p_cookie, Vector<rec_element> *p_list) const {
for (int i = 0; i < p_list->size(); i++) {
if (p_cookie == p_list->get(i).cookie) {
return true;
@@ -77,7 +77,7 @@ bool joystick::has_element(IOHIDElementCookie p_cookie, Vector<rec_element> *p_l
return false;
}
-int joystick::get_hid_element_state(rec_element *p_element) const {
+int joypad::get_hid_element_state(rec_element *p_element) const {
int value = 0;
if (p_element && p_element->ref) {
IOHIDValueRef valueRef;
@@ -95,7 +95,7 @@ int joystick::get_hid_element_state(rec_element *p_element) const {
}
return value;
}
-void joystick::add_hid_element(IOHIDElementRef p_element) {
+void joypad::add_hid_element(IOHIDElementRef p_element) {
const CFTypeID elementTypeID = p_element ? CFGetTypeID(p_element) : 0;
if (p_element && (elementTypeID == IOHIDElementGetTypeID())) {
@@ -198,26 +198,26 @@ void joystick::add_hid_element(IOHIDElementRef p_element) {
}
static void hid_element_added(const void *p_value, void *p_parameter) {
- joystick *joy = (joystick*) p_parameter;
+ joypad *joy = (joypad*) p_parameter;
joy->add_hid_element((IOHIDElementRef) p_value);
}
-void joystick::add_hid_elements(CFArrayRef p_array) {
+void joypad::add_hid_elements(CFArrayRef p_array) {
CFRange range = { 0, CFArrayGetCount(p_array) };
CFArrayApplyFunction(p_array, range,hid_element_added,this);
}
-static void joystick_removed_callback(void *ctx, IOReturn result, void *sender) {
+static void joypad_removed_callback(void *ctx, IOReturn result, void *sender) {
int id = (intptr_t) ctx;
self->_device_removed(id);
}
-static void joystick_added_callback(void *ctx, IOReturn res, void *sender, IOHIDDeviceRef ioHIDDeviceObject) {
+static void joypad_added_callback(void *ctx, IOReturn res, void *sender, IOHIDDeviceRef ioHIDDeviceObject) {
self->_device_added(res, ioHIDDeviceObject);
}
-static bool is_joystick(IOHIDDeviceRef p_device_ref) {
+static bool is_joypad(IOHIDDeviceRef p_device_ref) {
CFTypeRef refCF = NULL;
int usage_page = 0;
int usage = 0;
@@ -233,7 +233,7 @@ static bool is_joystick(IOHIDDeviceRef p_device_ref) {
if (refCF) {
CFNumberGetValue((CFNumberRef) refCF, kCFNumberSInt32Type, &usage);
}
- if ((usage != kHIDUsage_GD_Joystick &&
+ if ((usage != kHIDUsage_GD_Joypad &&
usage != kHIDUsage_GD_GamePad &&
usage != kHIDUsage_GD_MultiAxisController)) {
return false;
@@ -241,32 +241,32 @@ static bool is_joystick(IOHIDDeviceRef p_device_ref) {
return true;
}
-void JoystickOSX::_device_added(IOReturn p_res, IOHIDDeviceRef p_device) {
+void JoypadOSX::_device_added(IOReturn p_res, IOHIDDeviceRef p_device) {
if (p_res != kIOReturnSuccess || have_device(p_device)) {
return;
}
- joystick new_joystick;
- if (is_joystick(p_device)) {
- configure_joystick(p_device, &new_joystick);
+ joypad new_joypad;
+ if (is_joypad(p_device)) {
+ configure_joypad(p_device, &new_joypad);
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
if (IOHIDDeviceGetService != NULL) {
#endif
const io_service_t ioservice = IOHIDDeviceGetService(p_device);
- if ((ioservice) && (FFIsForceFeedback(ioservice) == FF_OK) && new_joystick.config_force_feedback(ioservice)) {
- new_joystick.ffservice = ioservice;
+ if ((ioservice) && (FFIsForceFeedback(ioservice) == FF_OK) && new_joypad.config_force_feedback(ioservice)) {
+ new_joypad.ffservice = ioservice;
}
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
}
#endif
- device_list.push_back(new_joystick);
+ device_list.push_back(new_joypad);
}
- IOHIDDeviceRegisterRemovalCallback(p_device, joystick_removed_callback, (void*) (intptr_t) new_joystick.id);
+ IOHIDDeviceRegisterRemovalCallback(p_device, joypad_removed_callback, (void*) (intptr_t) new_joypad.id);
IOHIDDeviceScheduleWithRunLoop(p_device, CFRunLoopGetCurrent(), GODOT_JOY_LOOP_RUN_MODE);
}
-void JoystickOSX::_device_removed(int p_id) {
+void JoypadOSX::_device_removed(int p_id) {
int device = get_joy_index(p_id);
ERR_FAIL_COND(device == -1);
@@ -289,7 +289,7 @@ static String _hex_str(uint8_t p_byte) {
return ret;
}
-bool JoystickOSX::configure_joystick(IOHIDDeviceRef p_device_ref, joystick* p_joy) {
+bool JoypadOSX::configure_joypad(IOHIDDeviceRef p_device_ref, joypad* p_joy) {
CFTypeRef refCF = NULL;
@@ -302,7 +302,7 @@ bool JoystickOSX::configure_joystick(IOHIDDeviceRef p_device_ref, joystick* p_jo
refCF = IOHIDDeviceGetProperty(p_device_ref, CFSTR(kIOHIDManufacturerKey));
}
if ((!refCF) || (!CFStringGetCString((CFStringRef) refCF, c_name, sizeof (c_name), kCFStringEncodingUTF8))) {
- name = "Unidentified Joystick";
+ name = "Unidentified Joypad";
}
name = c_name;
@@ -345,7 +345,7 @@ bool JoystickOSX::configure_joystick(IOHIDDeviceRef p_device_ref, joystick* p_jo
}
#define FF_ERR() { if (ret != FF_OK) { FFReleaseDevice(ff_device); return false; } }
-bool joystick::config_force_feedback(io_service_t p_service) {
+bool joypad::config_force_feedback(io_service_t p_service) {
HRESULT ret = FFCreateDevice(p_service, &ff_device);
ERR_FAIL_COND_V(ret != FF_OK, false);
@@ -367,7 +367,7 @@ bool joystick::config_force_feedback(io_service_t p_service) {
#undef FF_ERR
#define TEST_FF(ff) (features.supportedEffects & (ff))
-bool joystick::check_ff_features() {
+bool joypad::check_ff_features() {
FFCAPABILITIES features;
HRESULT ret = FFDeviceGetForceFeedbackCapabilities(ff_device, &features);
@@ -432,7 +432,7 @@ static int process_hat_value(int p_min, int p_max, int p_value) {
return hat_value;
}
-void JoystickOSX::poll_joysticks() const {
+void JoypadOSX::poll_joypads() const {
while (CFRunLoopRunInMode(GODOT_JOY_LOOP_RUN_MODE,0,TRUE) == kCFRunLoopRunHandledSource) {
/* no-op. Pending callbacks will fire. */
}
@@ -454,11 +454,11 @@ static const InputDefault::JoyAxis axis_correct(int p_value, int p_min, int p_ma
return jx;
}
-uint32_t JoystickOSX::process_joysticks(uint32_t p_last_id){
- poll_joysticks();
+uint32_t JoypadOSX::process_joypads(uint32_t p_last_id){
+ poll_joypads();
for (int i = 0; i < device_list.size(); i++) {
- joystick &joy = device_list[i];
+ joypad &joy = device_list[i];
for (int j = 0; j < joy.axis_elements.size(); j++) {
rec_element &elem = joy.axis_elements[j];
@@ -482,11 +482,11 @@ uint32_t JoystickOSX::process_joysticks(uint32_t p_last_id){
Vector2 strength = input->get_joy_vibration_strength(joy.id);
float duration = input->get_joy_vibration_duration(joy.id);
if (strength.x == 0 && strength.y == 0) {
- joystick_vibration_stop(joy.id, timestamp);
+ joypad_vibration_stop(joy.id, timestamp);
}
else {
float gain = MAX(strength.x, strength.y);
- joystick_vibration_start(joy.id, gain, duration, timestamp);
+ joypad_vibration_start(joy.id, gain, duration, timestamp);
}
}
}
@@ -494,8 +494,8 @@ uint32_t JoystickOSX::process_joysticks(uint32_t p_last_id){
return p_last_id;
}
-void JoystickOSX::joystick_vibration_start(int p_id, float p_magnitude, float p_duration, uint64_t p_timestamp) {
- joystick *joy = &device_list[get_joy_index(p_id)];
+void JoypadOSX::joypad_vibration_start(int p_id, float p_magnitude, float p_duration, uint64_t p_timestamp) {
+ joypad *joy = &device_list[get_joy_index(p_id)];
joy->ff_timestamp = p_timestamp;
joy->ff_effect.dwDuration = p_duration * FF_SECONDS;
joy->ff_effect.dwGain = p_magnitude * FF_FFNOMINALMAX;
@@ -503,14 +503,14 @@ void JoystickOSX::joystick_vibration_start(int p_id, float p_magnitude, float p_
FFEffectStart(joy->ff_object, 1, 0);
}
-void JoystickOSX::joystick_vibration_stop(int p_id, uint64_t p_timestamp) {
- joystick* joy = &device_list[get_joy_index(p_id)];
+void JoypadOSX::joypad_vibration_stop(int p_id, uint64_t p_timestamp) {
+ joypad* joy = &device_list[get_joy_index(p_id)];
joy->ff_timestamp = p_timestamp;
FFEffectStop(joy->ff_object);
}
-int JoystickOSX::get_free_joy_id() {
- for (int i = 0; i < JOYSTICKS_MAX; i++) {
+int JoypadOSX::get_free_joy_id() {
+ for (int i = 0; i < JOYPADS_MAX; i++) {
if (!attached_devices[i]) {
attached_devices[i] = true;
return i;
@@ -519,14 +519,14 @@ int JoystickOSX::get_free_joy_id() {
return -1;
}
-int JoystickOSX::get_joy_index(int p_id) const {
+int JoypadOSX::get_joy_index(int p_id) const {
for (int i = 0; i < device_list.size(); i++) {
if (device_list[i].id == p_id) return i;
}
return -1;
}
-bool JoystickOSX::have_device(IOHIDDeviceRef p_device) const {
+bool JoypadOSX::have_device(IOHIDDeviceRef p_device) const {
for (int i = 0; i < device_list.size(); i++) {
if (device_list[i].device_ref == p_device) {
return true;
@@ -561,14 +561,14 @@ static CFDictionaryRef create_match_dictionary(const UInt32 page, const UInt32 u
return retval;
}
-void JoystickOSX::config_hid_manager(CFArrayRef p_matching_array) const {
+void JoypadOSX::config_hid_manager(CFArrayRef p_matching_array) const {
CFRunLoopRef runloop = CFRunLoopGetCurrent();
IOReturn ret = IOHIDManagerOpen(hid_manager, kIOHIDOptionsTypeNone);
ERR_FAIL_COND(ret != kIOReturnSuccess);
IOHIDManagerSetDeviceMatchingMultiple(hid_manager, p_matching_array);
- IOHIDManagerRegisterDeviceMatchingCallback(hid_manager, joystick_added_callback, NULL);
+ IOHIDManagerRegisterDeviceMatchingCallback(hid_manager, joypad_added_callback, NULL);
IOHIDManagerScheduleWithRunLoop(hid_manager, runloop, GODOT_JOY_LOOP_RUN_MODE);
while (CFRunLoopRunInMode(GODOT_JOY_LOOP_RUN_MODE,0,TRUE) == kCFRunLoopRunHandledSource) {
@@ -576,18 +576,18 @@ void JoystickOSX::config_hid_manager(CFArrayRef p_matching_array) const {
}
}
-JoystickOSX::JoystickOSX()
+JoypadOSX::JoypadOSX()
{
self = this;
input = (InputDefault*)Input::get_singleton();
- for (int i = 0; i < JOYSTICKS_MAX; i++) {
+ for (int i = 0; i < JOYPADS_MAX; i++) {
attached_devices[i] = false;
}
int okay = 1;
const void *vals[] = {
- (void *) create_match_dictionary(kHIDPage_GenericDesktop, kHIDUsage_GD_Joystick, &okay),
+ (void *) create_match_dictionary(kHIDPage_GenericDesktop, kHIDUsage_GD_Joypad, &okay),
(void *) create_match_dictionary(kHIDPage_GenericDesktop, kHIDUsage_GD_GamePad, &okay),
(void *) create_match_dictionary(kHIDPage_GenericDesktop, kHIDUsage_GD_MultiAxisController, &okay),
};
@@ -609,7 +609,7 @@ JoystickOSX::JoystickOSX()
}
}
-JoystickOSX::~JoystickOSX() {
+JoypadOSX::~JoypadOSX() {
for (int i = 0; i < device_list.size(); i++) {
device_list[i].free();
diff --git a/platform/osx/joystick_osx.h b/platform/osx/joystick_osx.h
index ec745fe5d1..aafd82880d 100644
--- a/platform/osx/joystick_osx.h
+++ b/platform/osx/joystick_osx.h
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* joystick_osx.h */
+/* joypad_osx.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -26,8 +26,8 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef JOYSTICKOSX_H
-#define JOYSTICKOSX_H
+#ifndef JOYPADOSX_H
+#define JOYPADOSX_H
#ifdef MACOS_10_0_4
#include <IOKit/hidsystem/IOHIDUsageTables.h>
@@ -54,7 +54,7 @@ struct rec_element {
};
};
-struct joystick {
+struct joypad {
IOHIDDeviceRef device_ref;
Vector<rec_element> axis_elements;
@@ -82,44 +82,44 @@ struct joystick {
int get_hid_element_state(rec_element *p_element) const;
void free();
- joystick();
+ joypad();
};
-class JoystickOSX {
+class JoypadOSX {
enum {
- JOYSTICKS_MAX = 16,
+ JOYPADS_MAX = 16,
};
private:
InputDefault *input;
IOHIDManagerRef hid_manager;
- bool attached_devices[JOYSTICKS_MAX];
- Vector<joystick> device_list;
+ bool attached_devices[JOYPADS_MAX];
+ Vector<joypad> device_list;
bool have_device(IOHIDDeviceRef p_device) const;
- bool configure_joystick(IOHIDDeviceRef p_device_ref, joystick *p_joy);
+ bool configure_joypad(IOHIDDeviceRef p_device_ref, joypad *p_joy);
int get_free_joy_id();
int get_joy_index(int p_id) const;
- void poll_joysticks() const;
- void setup_joystick_objects();
+ void poll_joypads() const;
+ void setup_joypad_objects();
void config_hid_manager(CFArrayRef p_matching_array) const;
- void joystick_vibration_start(int p_id, float p_magnitude, float p_duration, uint64_t p_timestamp);
- void joystick_vibration_stop(int p_id, uint64_t p_timestamp);
+ void joypad_vibration_start(int p_id, float p_magnitude, float p_duration, uint64_t p_timestamp);
+ void joypad_vibration_stop(int p_id, uint64_t p_timestamp);
public:
- uint32_t process_joysticks(uint32_t p_last_id);
+ uint32_t process_joypads(uint32_t p_last_id);
void _device_added(IOReturn p_res, IOHIDDeviceRef p_device);
void _device_removed(int p_id);
- JoystickOSX();
- ~JoystickOSX();
+ JoypadOSX();
+ ~JoypadOSX();
};
-#endif // JOYSTICKOSX_H
+#endif // JOYPADOSX_H
diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h
index a547e318c8..fc64c2b867 100644
--- a/platform/osx/os_osx.h
+++ b/platform/osx/os_osx.h
@@ -31,7 +31,7 @@
#include "os/input.h"
-#include "joystick_osx.h"
+#include "joypad_osx.h"
#include "drivers/unix/os_unix.h"
#include "main/input_default.h"
#include "servers/visual_server.h"
@@ -78,7 +78,7 @@ public:
SpatialSound2DServerSW *spatial_sound_2d_server;
InputDefault *input;
- JoystickOSX *joystick_osx;
+ JoypadOSX *joypad_osx;
/* objc */
diff --git a/platform/uwp/joystick_uwp.cpp b/platform/uwp/joystick_uwp.cpp
index 8ed6473c37..e26b81bb6d 100644
--- a/platform/uwp/joystick_uwp.cpp
+++ b/platform/uwp/joystick_uwp.cpp
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* joystick_uwp.cpp */
+/* joypad_uwp.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -27,20 +27,20 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "joystick_uwp.h"
+#include "joypad_uwp.h"
using namespace Windows::Gaming::Input;
using namespace Windows::Foundation;
-void JoystickUWP::register_events() {
+void JoypadUWP::register_events() {
Gamepad::GamepadAdded +=
- ref new EventHandler<Gamepad^>(this, &JoystickUWP::OnGamepadAdded);
+ ref new EventHandler<Gamepad^>(this, &JoypadUWP::OnGamepadAdded);
Gamepad::GamepadRemoved +=
- ref new EventHandler<Gamepad^>(this, &JoystickUWP::OnGamepadRemoved);
+ ref new EventHandler<Gamepad^>(this, &JoypadUWP::OnGamepadRemoved);
}
-uint32_t JoystickUWP::process_controllers(uint32_t p_last_id) {
+uint32_t JoypadUWP::process_controllers(uint32_t p_last_id) {
for (int i = 0; i < MAX_CONTROLLERS; i++) {
@@ -74,20 +74,20 @@ uint32_t JoystickUWP::process_controllers(uint32_t p_last_id) {
return p_last_id;
}
-JoystickUWP::JoystickUWP() {
+JoypadUWP::JoypadUWP() {
for (int i = 0; i < MAX_CONTROLLERS; i++)
controllers[i].id = i;
}
-JoystickUWP::JoystickUWP(InputDefault * p_input) {
+JoypadUWP::JoypadUWP(InputDefault * p_input) {
input = p_input;
- JoystickUWP();
+ JoypadUWP();
}
-void JoystickUWP::OnGamepadAdded(Platform::Object ^ sender, Windows::Gaming::Input::Gamepad ^ value) {
+void JoypadUWP::OnGamepadAdded(Platform::Object ^ sender, Windows::Gaming::Input::Gamepad ^ value) {
short idx = -1;
@@ -109,7 +109,7 @@ void JoystickUWP::OnGamepadAdded(Platform::Object ^ sender, Windows::Gaming::Inp
input->joy_connection_changed(controllers[idx].id, true, "Xbox Controller", "__UWP_GAMEPAD__");
}
-void JoystickUWP::OnGamepadRemoved(Platform::Object ^ sender, Windows::Gaming::Input::Gamepad ^ value) {
+void JoypadUWP::OnGamepadRemoved(Platform::Object ^ sender, Windows::Gaming::Input::Gamepad ^ value) {
short idx = -1;
@@ -136,7 +136,7 @@ void JoystickUWP::OnGamepadRemoved(Platform::Object ^ sender, Windows::Gaming::I
input->joy_connection_changed(idx, false, "Xbox Controller");
}
-InputDefault::JoyAxis JoystickUWP::axis_correct(double p_val, bool p_negate, bool p_trigger) const {
+InputDefault::JoyAxis JoypadUWP::axis_correct(double p_val, bool p_negate, bool p_trigger) const {
InputDefault::JoyAxis jx;
diff --git a/platform/uwp/joystick_uwp.h b/platform/uwp/joystick_uwp.h
index f854f0b471..7e15e5ddb1 100644
--- a/platform/uwp/joystick_uwp.h
+++ b/platform/uwp/joystick_uwp.h
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* joystick_uwp.h */
+/* joypad_uwp.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -26,20 +26,20 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef JOYSTICK_UWP_H
-#define JOYSTICK_UWP_H
+#ifndef JOYPAD_UWP_H
+#define JOYPAD_UWP_H
#include "main/input_default.h"
-ref class JoystickUWP sealed {
+ref class JoypadUWP sealed {
internal:
void register_events();
uint32_t process_controllers(uint32_t p_last_id);
- JoystickUWP();
- JoystickUWP(InputDefault* p_input);
+ JoypadUWP();
+ JoypadUWP(InputDefault* p_input);
private:
diff --git a/platform/uwp/os_uwp.cpp b/platform/uwp/os_uwp.cpp
index 387cfe579f..34977bc048 100644
--- a/platform/uwp/os_uwp.cpp
+++ b/platform/uwp/os_uwp.cpp
@@ -285,8 +285,8 @@ void OSUWP::initialize(const VideoMode& p_desired,int p_video_driver,int p_audio
input = memnew( InputDefault );
- joystick = ref new JoystickUWP(input);
- joystick->register_events();
+ joypad = ref new JoypadUWP(input);
+ joypad->register_events();
AudioDriverManagerSW::get_driver(p_audio_driver)->set_singleton();
@@ -429,7 +429,7 @@ void OSUWP::finalize() {
physics_2d_server->finish();
memdelete(physics_2d_server);
- joystick = nullptr;
+ joypad = nullptr;
}
void OSUWP::finalize_core() {
@@ -725,7 +725,7 @@ uint64_t OSUWP::get_ticks_usec() const {
void OSUWP::process_events() {
- last_id = joystick->process_controllers(last_id);
+ last_id = joypad->process_controllers(last_id);
process_key_events();
}
diff --git a/platform/uwp/os_uwp.h b/platform/uwp/os_uwp.h
index c50d34aca2..82376dd2f6 100644
--- a/platform/uwp/os_uwp.h
+++ b/platform/uwp/os_uwp.h
@@ -55,7 +55,7 @@
#include <stdio.h>
#include "main/input_default.h"
-#include "joystick_uwp.h"
+#include "joypad_uwp.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
@@ -85,7 +85,7 @@ public:
private:
enum {
- JOYSTICKS_MAX = 8,
+ JOYPADS_MAX = 8,
JOY_AXIS_COUNT = 6,
MAX_JOY_AXIS = 32768, // I've no idea
KEY_EVENT_BUFFER_SIZE=512
@@ -137,7 +137,7 @@ private:
InputDefault *input;
- JoystickUWP^ joystick;
+ JoypadUWP^ joypad;
Windows::System::Display::DisplayRequest^ display_request;
diff --git a/platform/windows/joystick.cpp b/platform/windows/joystick.cpp
index 3fdf20a472..9324031142 100644
--- a/platform/windows/joystick.cpp
+++ b/platform/windows/joystick.cpp
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* joystick.cpp */
+/* joypad.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -27,7 +27,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
//author: Andreas Haas <hondres, liugam3@gmail.com>
-#include "joystick.h"
+#include "joypad.h"
#include <iostream>
#include <wbemidl.h>
#include <oleauto.h>
@@ -39,15 +39,15 @@
DWORD WINAPI _xinput_get_state(DWORD dwUserIndex, XINPUT_STATE* pState) { return ERROR_DEVICE_NOT_CONNECTED; }
DWORD WINAPI _xinput_set_state(DWORD dwUserIndex, XINPUT_VIBRATION* pVibration) { return ERROR_DEVICE_NOT_CONNECTED; }
-joystick_windows::joystick_windows() {
+joypad_windows::joypad_windows() {
}
-joystick_windows::joystick_windows(InputDefault* _input, HWND* hwnd) {
+joypad_windows::joypad_windows(InputDefault* _input, HWND* hwnd) {
input = _input;
hWnd = hwnd;
- joystick_count = 0;
+ joypad_count = 0;
dinput = NULL;
xinput_dll = NULL;
xinput_get_state = NULL;
@@ -55,8 +55,8 @@ joystick_windows::joystick_windows(InputDefault* _input, HWND* hwnd) {
load_xinput();
- for (int i = 0; i < JOYSTICKS_MAX; i++)
- attached_joysticks[i] = false;
+ for (int i = 0; i < JOYPADS_MAX; i++)
+ attached_joypads[i] = false;
HRESULT result;
@@ -64,35 +64,35 @@ joystick_windows::joystick_windows(InputDefault* _input, HWND* hwnd) {
if (FAILED(result)) {
printf("failed init DINPUT: %ld\n", result);
}
- probe_joysticks();
+ probe_joypads();
}
-joystick_windows::~joystick_windows() {
+joypad_windows::~joypad_windows() {
- close_joystick();
+ close_joypad();
dinput->Release();
unload_xinput();
}
-bool joystick_windows::have_device(const GUID &p_guid) {
+bool joypad_windows::have_device(const GUID &p_guid) {
- for (int i = 0; i < JOYSTICKS_MAX; i++) {
+ for (int i = 0; i < JOYPADS_MAX; i++) {
- if (d_joysticks[i].guid == p_guid) {
+ if (d_joypads[i].guid == p_guid) {
- d_joysticks[i].confirmed = true;
+ d_joypads[i].confirmed = true;
return true;
}
}
return false;
}
-int joystick_windows::check_free_joy_slot() const {
+int joypad_windows::check_free_joy_slot() const {
- for (int i = 0; i < JOYSTICKS_MAX; i++) {
+ for (int i = 0; i < JOYPADS_MAX; i++) {
- if (!attached_joysticks[i])
+ if (!attached_joypads[i])
return i;
}
return -1;
@@ -100,7 +100,7 @@ int joystick_windows::check_free_joy_slot() const {
// adapted from SDL2, works a lot better than the MSDN version
-bool joystick_windows::is_xinput_device(const GUID *p_guid) {
+bool joypad_windows::is_xinput_device(const GUID *p_guid) {
static GUID IID_ValveStreamingGamepad = { MAKELONG(0x28DE, 0x11FF), 0x0000, 0x0000, { 0x00, 0x00, 0x50, 0x49, 0x44, 0x56, 0x49, 0x44 } };
static GUID IID_X360WiredGamepad = { MAKELONG(0x045E, 0x02A1), 0x0000, 0x0000, { 0x00, 0x00, 0x50, 0x49, 0x44, 0x56, 0x49, 0x44 } };
@@ -144,7 +144,7 @@ bool joystick_windows::is_xinput_device(const GUID *p_guid) {
return false;
}
-bool joystick_windows::setup_dinput_joystick(const DIDEVICEINSTANCE* instance) {
+bool joypad_windows::setup_dinput_joypad(const DIDEVICEINSTANCE* instance) {
HRESULT hr;
int num = check_free_joy_slot();
@@ -152,12 +152,12 @@ bool joystick_windows::setup_dinput_joystick(const DIDEVICEINSTANCE* instance) {
if (have_device(instance->guidInstance) || num == -1)
return false;
- d_joysticks[joystick_count] = dinput_gamepad();
- dinput_gamepad* joy = &d_joysticks[joystick_count];
+ d_joypads[joypad_count] = dinput_gamepad();
+ dinput_gamepad* joy = &d_joypads[joypad_count];
const DWORD devtype = (instance->dwDevType & 0xFF);
- if ((devtype != DI8DEVTYPE_JOYSTICK) && (devtype != DI8DEVTYPE_GAMEPAD) && (devtype != DI8DEVTYPE_1STPERSON)) {
+ if ((devtype != DI8DEVTYPE_JOYPAD) && (devtype != DI8DEVTYPE_GAMEPAD) && (devtype != DI8DEVTYPE_1STPERSON)) {
//printf("ignore device %s, type %x\n", instance->tszProductName, devtype);
return false;
}
@@ -177,9 +177,9 @@ bool joystick_windows::setup_dinput_joystick(const DIDEVICEINSTANCE* instance) {
guid.Data4[0], guid.Data4[1], guid.Data4[2], guid.Data4[3],
guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7]);
- id_to_change = joystick_count;
+ id_to_change = joypad_count;
- joy->di_joy->SetDataFormat(&c_dfDIJoystick2);
+ joy->di_joy->SetDataFormat(&c_dfDIJoypad2);
joy->di_joy->SetCooperativeLevel(*hWnd, DISCL_FOREGROUND);
joy->di_joy->EnumObjects(objectsCallback, this, NULL);
joy->joy_axis.sort();
@@ -188,13 +188,13 @@ bool joystick_windows::setup_dinput_joystick(const DIDEVICEINSTANCE* instance) {
input->joy_connection_changed(num, true, instance->tszProductName, uid);
joy->attached = true;
joy->id = num;
- attached_joysticks[num] = true;
+ attached_joypads[num] = true;
joy->confirmed = true;
- joystick_count++;
+ joypad_count++;
return true;
}
-void joystick_windows::setup_joystick_object(const DIDEVICEOBJECTINSTANCE *ob, int p_joy_id) {
+void joypad_windows::setup_joypad_object(const DIDEVICEOBJECTINSTANCE *ob, int p_joy_id) {
if (ob->dwType & DIDFT_AXIS) {
@@ -225,7 +225,7 @@ void joystick_windows::setup_joystick_object(const DIDEVICEOBJECTINSTANCE *ob, i
prop_range.lMin = -MAX_JOY_AXIS;
prop_range.lMax = +MAX_JOY_AXIS;
- dinput_gamepad &joy = d_joysticks[p_joy_id];
+ dinput_gamepad &joy = d_joypads[p_joy_id];
res = IDirectInputDevice8_SetProperty(joy.di_joy, DIPROP_RANGE, &prop_range.diph);
@@ -246,100 +246,100 @@ void joystick_windows::setup_joystick_object(const DIDEVICEOBJECTINSTANCE *ob, i
}
}
-BOOL CALLBACK joystick_windows::enumCallback(const DIDEVICEINSTANCE* instance, void* pContext) {
+BOOL CALLBACK joypad_windows::enumCallback(const DIDEVICEINSTANCE* instance, void* pContext) {
- joystick_windows* self = (joystick_windows*)pContext;
+ joypad_windows* self = (joypad_windows*)pContext;
if (self->is_xinput_device(&instance->guidProduct)) {;
return DIENUM_CONTINUE;
}
- self->setup_dinput_joystick(instance);
+ self->setup_dinput_joypad(instance);
return DIENUM_CONTINUE;
}
-BOOL CALLBACK joystick_windows::objectsCallback(const DIDEVICEOBJECTINSTANCE *instance, void *context) {
+BOOL CALLBACK joypad_windows::objectsCallback(const DIDEVICEOBJECTINSTANCE *instance, void *context) {
- joystick_windows* self = (joystick_windows*)context;
- self->setup_joystick_object(instance, self->id_to_change);
+ joypad_windows* self = (joypad_windows*)context;
+ self->setup_joypad_object(instance, self->id_to_change);
return DIENUM_CONTINUE;
}
-void joystick_windows::close_joystick(int id) {
+void joypad_windows::close_joypad(int id) {
if (id == -1) {
- for (int i = 0; i < JOYSTICKS_MAX; i++) {
+ for (int i = 0; i < JOYPADS_MAX; i++) {
- close_joystick(i);
+ close_joypad(i);
}
return;
}
- if (!d_joysticks[id].attached) return;
+ if (!d_joypads[id].attached) return;
- d_joysticks[id].di_joy->Unacquire();
- d_joysticks[id].di_joy->Release();
- d_joysticks[id].attached = false;
- attached_joysticks[d_joysticks[id].id] = false;
- d_joysticks[id].guid.Data1 = d_joysticks[id].guid.Data2 = d_joysticks[id].guid.Data3 = 0;
- input->joy_connection_changed(d_joysticks[id].id, false, "");
- joystick_count--;
+ d_joypads[id].di_joy->Unacquire();
+ d_joypads[id].di_joy->Release();
+ d_joypads[id].attached = false;
+ attached_joypads[d_joypads[id].id] = false;
+ d_joypads[id].guid.Data1 = d_joypads[id].guid.Data2 = d_joypads[id].guid.Data3 = 0;
+ input->joy_connection_changed(d_joypads[id].id, false, "");
+ joypad_count--;
}
-void joystick_windows::probe_joysticks() {
+void joypad_windows::probe_joypads() {
DWORD dwResult;
for (DWORD i = 0; i < XUSER_MAX_COUNT; i++) {
- ZeroMemory(&x_joysticks[i].state, sizeof(XINPUT_STATE));
+ ZeroMemory(&x_joypads[i].state, sizeof(XINPUT_STATE));
- dwResult = xinput_get_state(i, &x_joysticks[i].state);
+ dwResult = xinput_get_state(i, &x_joypads[i].state);
if ( dwResult == ERROR_SUCCESS) {
int id = check_free_joy_slot();
- if (id != -1 && !x_joysticks[i].attached) {
-
- x_joysticks[i].attached = true;
- x_joysticks[i].id = id;
- x_joysticks[i].ff_timestamp = 0;
- x_joysticks[i].ff_end_timestamp = 0;
- x_joysticks[i].vibrating = false;
- attached_joysticks[id] = true;
+ if (id != -1 && !x_joypads[i].attached) {
+
+ x_joypads[i].attached = true;
+ x_joypads[i].id = id;
+ x_joypads[i].ff_timestamp = 0;
+ x_joypads[i].ff_end_timestamp = 0;
+ x_joypads[i].vibrating = false;
+ attached_joypads[id] = true;
input->joy_connection_changed(id, true, "XInput Gamepad","__XINPUT_DEVICE__");
}
}
- else if (x_joysticks[i].attached) {
+ else if (x_joypads[i].attached) {
- x_joysticks[i].attached = false;
- attached_joysticks[x_joysticks[i].id] = false;
- input->joy_connection_changed(x_joysticks[i].id, false, "");
+ x_joypads[i].attached = false;
+ attached_joypads[x_joypads[i].id] = false;
+ input->joy_connection_changed(x_joypads[i].id, false, "");
}
}
- for (int i = 0; i < joystick_count; i++) {
+ for (int i = 0; i < joypad_count; i++) {
- d_joysticks[i].confirmed = false;
+ d_joypads[i].confirmed = false;
}
dinput->EnumDevices(DI8DEVCLASS_GAMECTRL, enumCallback, this, DIEDFL_ATTACHEDONLY);
- for (int i = 0; i < joystick_count; i++) {
+ for (int i = 0; i < joypad_count; i++) {
- if (!d_joysticks[i].confirmed) {
+ if (!d_joypads[i].confirmed) {
- close_joystick(i);
+ close_joypad(i);
}
}
}
-unsigned int joystick_windows::process_joysticks(unsigned int p_last_id) {
+unsigned int joypad_windows::process_joypads(unsigned int p_last_id) {
HRESULT hr;
for (int i = 0; i < XUSER_MAX_COUNT; i++) {
- xinput_gamepad &joy = x_joysticks[i];
+ xinput_gamepad &joy = x_joypads[i];
if (!joy.attached) {
continue;
}
@@ -368,20 +368,20 @@ unsigned int joystick_windows::process_joysticks(unsigned int p_last_id) {
Vector2 strength = input->get_joy_vibration_strength(joy.id);
float duration = input->get_joy_vibration_duration(joy.id);
if (strength.x == 0 && strength.y == 0) {
- joystick_vibration_stop_xinput(i, timestamp);
+ joypad_vibration_stop_xinput(i, timestamp);
} else {
- joystick_vibration_start_xinput(i, strength.x, strength.y, duration, timestamp);
+ joypad_vibration_start_xinput(i, strength.x, strength.y, duration, timestamp);
}
} else if (joy.vibrating && joy.ff_end_timestamp != 0) {
uint64_t current_time = OS::get_singleton()->get_ticks_usec();
if (current_time >= joy.ff_end_timestamp)
- joystick_vibration_stop_xinput(i, current_time);
+ joypad_vibration_stop_xinput(i, current_time);
}
}
- for (int i = 0; i < JOYSTICKS_MAX; i++) {
+ for (int i = 0; i < JOYPADS_MAX; i++) {
- dinput_gamepad* joy = &d_joysticks[i];
+ dinput_gamepad* joy = &d_joypads[i];
if (!joy->attached)
continue;
@@ -438,7 +438,7 @@ unsigned int joystick_windows::process_joysticks(unsigned int p_last_id) {
return p_last_id;
}
-unsigned int joystick_windows::post_hat(unsigned int p_last_id, int p_device, DWORD p_dpad) {
+unsigned int joypad_windows::post_hat(unsigned int p_last_id, int p_device, DWORD p_dpad) {
int dpad_val = 0;
@@ -487,7 +487,7 @@ unsigned int joystick_windows::post_hat(unsigned int p_last_id, int p_device, DW
return input->joy_hat(p_last_id, p_device, dpad_val);
};
-InputDefault::JoyAxis joystick_windows::axis_correct(int p_val, bool p_xinput, bool p_trigger, bool p_negate) const {
+InputDefault::JoyAxis joypad_windows::axis_correct(int p_val, bool p_xinput, bool p_trigger, bool p_negate) const {
InputDefault::JoyAxis jx;
if (Math::abs(p_val) < MIN_JOY_AXIS) {
@@ -519,8 +519,8 @@ InputDefault::JoyAxis joystick_windows::axis_correct(int p_val, bool p_xinput, b
return jx;
}
-void joystick_windows::joystick_vibration_start_xinput(int p_device, float p_weak_magnitude, float p_strong_magnitude, float p_duration, uint64_t p_timestamp) {
- xinput_gamepad &joy = x_joysticks[p_device];
+void joypad_windows::joypad_vibration_start_xinput(int p_device, float p_weak_magnitude, float p_strong_magnitude, float p_duration, uint64_t p_timestamp) {
+ xinput_gamepad &joy = x_joypads[p_device];
if (joy.attached) {
XINPUT_VIBRATION effect;
effect.wLeftMotorSpeed = (65535 * p_strong_magnitude);
@@ -533,8 +533,8 @@ void joystick_windows::joystick_vibration_start_xinput(int p_device, float p_wea
}
}
-void joystick_windows::joystick_vibration_stop_xinput(int p_device, uint64_t p_timestamp) {
- xinput_gamepad &joy = x_joysticks[p_device];
+void joypad_windows::joypad_vibration_stop_xinput(int p_device, uint64_t p_timestamp) {
+ xinput_gamepad &joy = x_joypads[p_device];
if (joy.attached) {
XINPUT_VIBRATION effect;
effect.wLeftMotorSpeed = 0;
@@ -547,7 +547,7 @@ void joystick_windows::joystick_vibration_stop_xinput(int p_device, uint64_t p_t
}
-void joystick_windows::load_xinput() {
+void joypad_windows::load_xinput() {
xinput_get_state = &_xinput_get_state;
xinput_set_state = &_xinput_set_state;
@@ -576,7 +576,7 @@ void joystick_windows::load_xinput() {
xinput_set_state = set_func;
}
-void joystick_windows::unload_xinput() {
+void joypad_windows::unload_xinput() {
if (xinput_dll) {
diff --git a/platform/windows/joystick.h b/platform/windows/joystick.h
index 6de05bf108..8875e6d0cf 100644
--- a/platform/windows/joystick.h
+++ b/platform/windows/joystick.h
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* joystick.h */
+/* joypad.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -27,8 +27,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
//author: Andreas Haas <hondres, liugam3@gmail.com>
-#ifndef JOYSTICK_H
-#define JOYSTICK_H
+#ifndef JOYPAD_H
+#define JOYPAD_H
#include "os_windows.h"
#define DIRECTINPUT_VERSION 0x0800
@@ -48,19 +48,19 @@ if(x != NULL) \
#define XUSER_MAX_COUNT 4
#endif
-class joystick_windows
+class joypad_windows
{
public:
- joystick_windows();
- joystick_windows(InputDefault* _input, HWND* hwnd);
- ~joystick_windows();
+ joypad_windows();
+ joypad_windows(InputDefault* _input, HWND* hwnd);
+ ~joypad_windows();
- void probe_joysticks();
- unsigned int process_joysticks(unsigned int p_last_id);
+ void probe_joypads();
+ unsigned int process_joypads(unsigned int p_last_id);
private:
enum {
- JOYSTICKS_MAX = 16,
+ JOYPADS_MAX = 16,
JOY_AXIS_COUNT = 6,
MIN_JOY_AXIS = 10,
MAX_JOY_AXIS = 32768,
@@ -120,16 +120,16 @@ private:
InputDefault* input;
int id_to_change;
- int joystick_count;
- bool attached_joysticks[JOYSTICKS_MAX];
- dinput_gamepad d_joysticks[JOYSTICKS_MAX];
- xinput_gamepad x_joysticks[XUSER_MAX_COUNT];
+ int joypad_count;
+ bool attached_joypads[JOYPADS_MAX];
+ dinput_gamepad d_joypads[JOYPADS_MAX];
+ xinput_gamepad x_joypads[XUSER_MAX_COUNT];
static BOOL CALLBACK enumCallback(const DIDEVICEINSTANCE* p_instance, void* p_context);
static BOOL CALLBACK objectsCallback(const DIDEVICEOBJECTINSTANCE* instance, void* context);
- void setup_joystick_object(const DIDEVICEOBJECTINSTANCE* ob, int p_joy_id);
- void close_joystick(int id = -1);
+ void setup_joypad_object(const DIDEVICEOBJECTINSTANCE* ob, int p_joy_id);
+ void close_joypad(int id = -1);
void load_xinput();
void unload_xinput();
@@ -138,9 +138,9 @@ private:
bool have_device(const GUID &p_guid);
bool is_xinput_device(const GUID* p_guid);
- bool setup_dinput_joystick(const DIDEVICEINSTANCE* instance);
- void joystick_vibration_start_xinput(int p_device, float p_weak_magnitude, float p_strong_magnitude, float p_duration, uint64_t p_timestamp);
- void joystick_vibration_stop_xinput(int p_device, uint64_t p_timestamp);
+ bool setup_dinput_joypad(const DIDEVICEINSTANCE* instance);
+ void joypad_vibration_start_xinput(int p_device, float p_weak_magnitude, float p_strong_magnitude, float p_duration, uint64_t p_timestamp);
+ void joypad_vibration_stop_xinput(int p_device, uint64_t p_timestamp);
InputDefault::JoyAxis axis_correct(int p_val, bool p_xinput = false, bool p_trigger = false, bool p_negate = false) const;
XInputGetState_t xinput_get_state;
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index 34ea9cd156..28e55b531e 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -51,7 +51,7 @@
#include "globals.h"
#include "io/marshalls.h"
-#include "joystick.h"
+#include "joypad.h"
#include "shlobj.h"
#include <regstr.h>
@@ -714,7 +714,7 @@ LRESULT OS_Windows::WndProc(HWND hWnd,UINT uMsg, WPARAM wParam, LPARAM lParam) {
#endif
case WM_DEVICECHANGE: {
- joystick->probe_joysticks();
+ joypad->probe_joypads();
} break;
case WM_SETCURSOR: {
@@ -1120,7 +1120,7 @@ void OS_Windows::initialize(const VideoMode& p_desired,int p_video_driver,int p_
visual_server->init();
input = memnew( InputDefault );
- joystick = memnew (joystick_windows(input, &hWnd));
+ joypad = memnew (joypad_windows(input, &hWnd));
AudioDriverManagerSW::get_driver(p_audio_driver)->set_singleton();
@@ -1253,7 +1253,7 @@ void OS_Windows::finalize() {
main_loop=NULL;
- memdelete(joystick);
+ memdelete(joypad);
memdelete(input);
visual_server->finish();
@@ -1928,7 +1928,7 @@ void OS_Windows::process_events() {
MSG msg;
- last_id = joystick->process_joysticks(last_id);
+ last_id = joypad->process_joypads(last_id);
while(PeekMessageW(&msg,NULL,0,0,PM_REMOVE)) {
diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h
index e265313f05..cfc5546ae0 100644
--- a/platform/windows/os_windows.h
+++ b/platform/windows/os_windows.h
@@ -61,7 +61,7 @@
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
-class joystick_windows;
+class joypad_windows;
class OS_Windows : public OS {
enum {
@@ -133,7 +133,7 @@ class OS_Windows : public OS {
CursorShape cursor_shape;
InputDefault *input;
- joystick_windows *joystick;
+ joypad_windows *joypad;
#ifdef RTAUDIO_ENABLED
AudioDriverRtAudio driver_rtaudio;
diff --git a/platform/x11/joystick_linux.cpp b/platform/x11/joystick_linux.cpp
index d101a725ad..bef2ef3fc6 100644
--- a/platform/x11/joystick_linux.cpp
+++ b/platform/x11/joystick_linux.cpp
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* joystick_linux.cpp */
+/* joypad_linux.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -49,7 +49,7 @@
static const char* ignore_str = "/dev/input/js";
#endif
-joystick_linux::Joystick::Joystick() {
+joypad_linux::Joypad::Joypad() {
fd = -1;
dpad = 0;
devpath = "";
@@ -58,7 +58,7 @@ joystick_linux::Joystick::Joystick() {
}
}
-joystick_linux::Joystick::~Joystick() {
+joypad_linux::Joypad::~Joypad() {
for (int i = 0; i < MAX_ABS; i++) {
if (abs_info[i]) {
@@ -67,7 +67,7 @@ joystick_linux::Joystick::~Joystick() {
}
}
-void joystick_linux::Joystick::reset() {
+void joypad_linux::Joypad::reset() {
dpad = 0;
fd = -1;
@@ -80,7 +80,7 @@ void joystick_linux::Joystick::reset() {
}
}
-joystick_linux::joystick_linux(InputDefault *in)
+joypad_linux::joypad_linux(InputDefault *in)
{
exit_udev = false;
input = in;
@@ -88,37 +88,37 @@ joystick_linux::joystick_linux(InputDefault *in)
joy_thread = Thread::create(joy_thread_func, this);
}
-joystick_linux::~joystick_linux() {
+joypad_linux::~joypad_linux() {
exit_udev = true;
Thread::wait_to_finish(joy_thread);
memdelete(joy_thread);
memdelete(joy_mutex);
- close_joystick();
+ close_joypad();
}
-void joystick_linux::joy_thread_func(void *p_user) {
+void joypad_linux::joy_thread_func(void *p_user) {
if (p_user) {
- joystick_linux* joy = (joystick_linux*) p_user;
- joy->run_joystick_thread();
+ joypad_linux* joy = (joypad_linux*) p_user;
+ joy->run_joypad_thread();
}
return;
}
-void joystick_linux::run_joystick_thread() {
+void joypad_linux::run_joypad_thread() {
#ifdef UDEV_ENABLED
udev *_udev = udev_new();
ERR_FAIL_COND(!_udev);
- enumerate_joysticks(_udev);
- monitor_joysticks(_udev);
+ enumerate_joypads(_udev);
+ monitor_joypads(_udev);
udev_unref(_udev);
#else
- monitor_joysticks();
+ monitor_joypads();
#endif
}
#ifdef UDEV_ENABLED
-void joystick_linux::enumerate_joysticks(udev *p_udev) {
+void joypad_linux::enumerate_joypads(udev *p_udev) {
udev_enumerate *enumerate;
udev_list_entry *devices, *dev_list_entry;
@@ -126,7 +126,7 @@ void joystick_linux::enumerate_joysticks(udev *p_udev) {
enumerate = udev_enumerate_new(p_udev);
udev_enumerate_add_match_subsystem(enumerate,"input");
- udev_enumerate_add_match_property(enumerate, "ID_INPUT_JOYSTICK", "1");
+ udev_enumerate_add_match_property(enumerate, "ID_INPUT_JOYPAD", "1");
udev_enumerate_scan_devices(enumerate);
devices = udev_enumerate_get_list_entry(enumerate);
@@ -141,7 +141,7 @@ void joystick_linux::enumerate_joysticks(udev *p_udev) {
String devnode_str = devnode;
if (devnode_str.find(ignore_str) == -1) {
joy_mutex->lock();
- open_joystick(devnode);
+ open_joypad(devnode);
joy_mutex->unlock();
}
}
@@ -150,7 +150,7 @@ void joystick_linux::enumerate_joysticks(udev *p_udev) {
udev_enumerate_unref(enumerate);
}
-void joystick_linux::monitor_joysticks(udev *p_udev) {
+void joypad_linux::monitor_joypads(udev *p_udev) {
udev_device *dev = NULL;
udev_monitor *mon = udev_monitor_new_from_netlink(p_udev, "udev");
@@ -188,9 +188,9 @@ void joystick_linux::monitor_joysticks(udev *p_udev) {
if (devnode_str.find(ignore_str) == -1) {
if (action == "add")
- open_joystick(devnode);
+ open_joypad(devnode);
else if (String(action) == "remove")
- close_joystick(get_joy_from_path(devnode));
+ close_joypad(get_joy_from_path(devnode));
}
}
@@ -204,7 +204,7 @@ void joystick_linux::monitor_joysticks(udev *p_udev) {
}
#endif
-void joystick_linux::monitor_joysticks() {
+void joypad_linux::monitor_joypads() {
while (!exit_udev) {
joy_mutex->lock();
@@ -212,7 +212,7 @@ void joystick_linux::monitor_joysticks() {
char fname[64];
sprintf(fname, "/dev/input/event%d", i);
if (attached_devices.find(fname) == -1) {
- open_joystick(fname);
+ open_joypad(fname);
}
}
joy_mutex->unlock();
@@ -220,37 +220,37 @@ void joystick_linux::monitor_joysticks() {
}
}
-int joystick_linux::get_free_joy_slot() const {
+int joypad_linux::get_free_joy_slot() const {
- for (int i = 0; i < JOYSTICKS_MAX; i++) {
+ for (int i = 0; i < JOYPADS_MAX; i++) {
- if (joysticks[i].fd == -1) return i;
+ if (joypads[i].fd == -1) return i;
}
return -1;
}
-int joystick_linux::get_joy_from_path(String p_path) const {
+int joypad_linux::get_joy_from_path(String p_path) const {
- for (int i = 0; i < JOYSTICKS_MAX; i++) {
+ for (int i = 0; i < JOYPADS_MAX; i++) {
- if (joysticks[i].devpath == p_path) {
+ if (joypads[i].devpath == p_path) {
return i;
}
}
return -2;
}
-void joystick_linux::close_joystick(int p_id) {
+void joypad_linux::close_joypad(int p_id) {
if (p_id == -1) {
- for (int i=0; i<JOYSTICKS_MAX; i++) {
+ for (int i=0; i<JOYPADS_MAX; i++) {
- close_joystick(i);
+ close_joypad(i);
};
return;
}
else if (p_id < 0) return;
- Joystick &joy = joysticks[p_id];
+ Joypad &joy = joypads[p_id];
if (joy.fd != -1) {
@@ -273,9 +273,9 @@ static String _hex_str(uint8_t p_byte) {
return ret;
}
-void joystick_linux::setup_joystick_properties(int p_id) {
+void joypad_linux::setup_joypad_properties(int p_id) {
- Joystick* joy = &joysticks[p_id];
+ Joypad* joy = &joypads[p_id];
unsigned long keybit[NBITS(KEY_MAX)] = { 0 };
unsigned long absbit[NBITS(ABS_MAX)] = { 0 };
@@ -328,7 +328,7 @@ void joystick_linux::setup_joystick_properties(int p_id) {
}
}
-void joystick_linux::open_joystick(const char *p_path) {
+void joypad_linux::open_joypad(const char *p_path) {
int joy_num = get_free_joy_slot();
int fd = open(p_path, O_RDWR | O_NONBLOCK);
@@ -349,7 +349,7 @@ void joystick_linux::open_joystick(const char *p_path) {
}
//check if the device supports basic gamepad events, prevents certain keyboards from
- //being detected as joysticks
+ //being detected as joypads
if (!(test_bit(EV_KEY, evbit) && test_bit(EV_ABS, evbit) &&
(test_bit(ABS_X, absbit) || test_bit(ABS_Y, absbit) || test_bit(ABS_HAT0X, absbit) ||
test_bit(ABS_GAS, absbit) || test_bit(ABS_RUDDER, absbit)) &&
@@ -372,12 +372,12 @@ void joystick_linux::open_joystick(const char *p_path) {
return;
}
- joysticks[joy_num].reset();
+ joypads[joy_num].reset();
- Joystick &joy = joysticks[joy_num];
+ Joypad &joy = joypads[joy_num];
joy.fd = fd;
joy.devpath = String(p_path);
- setup_joystick_properties(joy_num);
+ setup_joypad_properties(joy_num);
sprintf(uid, "%04x%04x", __bswap_16(inpid.bustype), 0);
if (inpid.vendor && inpid.product && inpid.version) {
@@ -401,14 +401,14 @@ void joystick_linux::open_joystick(const char *p_path) {
}
}
-void joystick_linux::joystick_vibration_start(int p_id, float p_weak_magnitude, float p_strong_magnitude, float p_duration, uint64_t p_timestamp)
+void joypad_linux::joypad_vibration_start(int p_id, float p_weak_magnitude, float p_strong_magnitude, float p_duration, uint64_t p_timestamp)
{
- Joystick& joy = joysticks[p_id];
+ Joypad& joy = joypads[p_id];
if (!joy.force_feedback || joy.fd == -1 || p_weak_magnitude < 0.f || p_weak_magnitude > 1.f || p_strong_magnitude < 0.f || p_strong_magnitude > 1.f) {
return;
}
if (joy.ff_effect_id != -1) {
- joystick_vibration_stop(p_id, p_timestamp);
+ joypad_vibration_stop(p_id, p_timestamp);
}
struct ff_effect effect;
@@ -433,9 +433,9 @@ void joystick_linux::joystick_vibration_start(int p_id, float p_weak_magnitude,
joy.ff_effect_timestamp = p_timestamp;
}
-void joystick_linux::joystick_vibration_stop(int p_id, uint64_t p_timestamp)
+void joypad_linux::joypad_vibration_stop(int p_id, uint64_t p_timestamp)
{
- Joystick& joy = joysticks[p_id];
+ Joypad& joy = joypads[p_id];
if (!joy.force_feedback || joy.fd == -1 || joy.ff_effect_id == -1) {
return;
}
@@ -448,7 +448,7 @@ void joystick_linux::joystick_vibration_stop(int p_id, uint64_t p_timestamp)
joy.ff_effect_timestamp = p_timestamp;
}
-InputDefault::JoyAxis joystick_linux::axis_correct(const input_absinfo *p_abs, int p_value) const {
+InputDefault::JoyAxis joypad_linux::axis_correct(const input_absinfo *p_abs, int p_value) const {
int min = p_abs->minimum;
int max = p_abs->maximum;
@@ -468,17 +468,17 @@ InputDefault::JoyAxis joystick_linux::axis_correct(const input_absinfo *p_abs, i
return jx;
}
-uint32_t joystick_linux::process_joysticks(uint32_t p_event_id) {
+uint32_t joypad_linux::process_joypads(uint32_t p_event_id) {
if (joy_mutex->try_lock() != OK) {
return p_event_id;
}
- for (int i=0; i<JOYSTICKS_MAX; i++) {
+ for (int i=0; i<JOYPADS_MAX; i++) {
- if (joysticks[i].fd == -1) continue;
+ if (joypads[i].fd == -1) continue;
input_event events[32];
- Joystick* joy = &joysticks[i];
+ Joypad* joy = &joypads[i];
int len;
@@ -539,7 +539,7 @@ uint32_t joystick_linux::process_joysticks(uint32_t p_event_id) {
}
}
if (len == 0 || (len < 0 && errno != EAGAIN)) {
- close_joystick(i);
+ close_joypad(i);
};
if (joy->force_feedback) {
@@ -548,9 +548,9 @@ uint32_t joystick_linux::process_joysticks(uint32_t p_event_id) {
Vector2 strength = input->get_joy_vibration_strength(i);
float duration = input->get_joy_vibration_duration(i);
if (strength.x == 0 && strength.y == 0) {
- joystick_vibration_stop(i, timestamp);
+ joypad_vibration_stop(i, timestamp);
} else {
- joystick_vibration_start(i, strength.x, strength.y, duration, timestamp);
+ joypad_vibration_start(i, strength.x, strength.y, duration, timestamp);
}
}
}
diff --git a/platform/x11/joystick_linux.h b/platform/x11/joystick_linux.h
index 34e7001ca9..ebd1e82104 100644
--- a/platform/x11/joystick_linux.h
+++ b/platform/x11/joystick_linux.h
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* joystick_linux.h */
+/* joypad_linux.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,8 +28,8 @@
/*************************************************************************/
//author: Andreas Haas <hondres, liugam3@gmail.com>
-#ifndef JOYSTICK_LINUX_H
-#define JOYSTICK_LINUX_H
+#ifndef JOYPAD_LINUX_H
+#define JOYPAD_LINUX_H
#ifdef JOYDEV_ENABLED
#include "main/input_default.h"
#include "os/thread.h"
@@ -37,21 +37,21 @@
struct input_absinfo;
-class joystick_linux
+class joypad_linux
{
public:
- joystick_linux(InputDefault *in);
- ~joystick_linux();
- uint32_t process_joysticks(uint32_t p_event_id);
+ joypad_linux(InputDefault *in);
+ ~joypad_linux();
+ uint32_t process_joypads(uint32_t p_event_id);
private:
enum {
- JOYSTICKS_MAX = 16,
+ JOYPADS_MAX = 16,
MAX_ABS = 63,
MAX_KEY = 767, // Hack because <linux/input.h> can't be included here
};
- struct Joystick {
+ struct Joypad {
InputDefault::JoyAxis curr_axis[MAX_ABS];
int key_map[MAX_KEY];
int abs_map[MAX_ABS];
@@ -65,8 +65,8 @@ private:
int ff_effect_id;
uint64_t ff_effect_timestamp;
- Joystick();
- ~Joystick();
+ Joypad();
+ ~Joypad();
void reset();
};
@@ -74,7 +74,7 @@ private:
Mutex *joy_mutex;
Thread *joy_thread;
InputDefault *input;
- Joystick joysticks[JOYSTICKS_MAX];
+ Joypad joypads[JOYPADS_MAX];
Vector<String> attached_devices;
static void joy_thread_func(void *p_user);
@@ -82,21 +82,21 @@ private:
int get_joy_from_path(String path) const;
int get_free_joy_slot() const;
- void setup_joystick_properties(int p_id);
- void close_joystick(int p_id = -1);
+ void setup_joypad_properties(int p_id);
+ void close_joypad(int p_id = -1);
#ifdef UDEV_ENABLED
- void enumerate_joysticks(struct udev *_udev);
- void monitor_joysticks(struct udev *_udev);
+ void enumerate_joypads(struct udev *_udev);
+ void monitor_joypads(struct udev *_udev);
#endif
- void monitor_joysticks();
- void run_joystick_thread();
- void open_joystick(const char* path);
+ void monitor_joypads();
+ void run_joypad_thread();
+ void open_joypad(const char* path);
- void joystick_vibration_start(int p_id, float p_weak_magnitude, float p_strong_magnitude, float p_duration, uint64_t p_timestamp);
- void joystick_vibration_stop(int p_id, uint64_t p_timestamp);
+ void joypad_vibration_start(int p_id, float p_weak_magnitude, float p_strong_magnitude, float p_duration, uint64_t p_timestamp);
+ void joypad_vibration_stop(int p_id, uint64_t p_timestamp);
InputDefault::JoyAxis axis_correct(const input_absinfo *abs, int value) const;
};
#endif
-#endif // JOYSTICK_LINUX_H
+#endif // JOYPAD_LINUX_H
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index e560b46d4b..d1c9c866cb 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -458,7 +458,7 @@ void OS_X11::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi
input = memnew( InputDefault );
#ifdef JOYDEV_ENABLED
- joystick = memnew( joystick_linux(input));
+ joypad = memnew( joypad_linux(input));
#endif
_ensure_data_dir();
}
@@ -479,7 +479,7 @@ void OS_X11::finalize() {
//}
#ifdef JOYDEV_ENABLED
- memdelete(joystick);
+ memdelete(joypad);
#endif
memdelete(input);
@@ -1932,7 +1932,7 @@ void OS_X11::run() {
process_xevents(); // get rid of pending events
#ifdef JOYDEV_ENABLED
- event_id = joystick->process_joysticks(event_id);
+ event_id = joypad->process_joypads(event_id);
#endif
if (Main::iteration()==true)
break;
diff --git a/platform/x11/os_x11.h b/platform/x11/os_x11.h
index b89921fb3e..4f9ff71298 100644
--- a/platform/x11/os_x11.h
+++ b/platform/x11/os_x11.h
@@ -155,7 +155,7 @@ class OS_X11 : public OS_Unix {
InputDefault *input;
#ifdef JOYDEV_ENABLED
- joystick_linux *joystick;
+ joypad_linux *joypad;
#endif
#ifdef RTAUDIO_ENABLED
diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp
index 1f5296e9d2..49cd7758df 100644
--- a/scene/gui/base_button.cpp
+++ b/scene/gui/base_button.cpp
@@ -156,7 +156,7 @@ void BaseButton::_gui_input(InputEvent p_event) {
}
} break;
case InputEvent::ACTION:
- case InputEvent::JOYSTICK_BUTTON:
+ case InputEvent::JOYPAD_BUTTON:
case InputEvent::KEY: {
diff --git a/scene/gui/input_action.cpp b/scene/gui/input_action.cpp
index 501f39a7c2..77026dfdb1 100644
--- a/scene/gui/input_action.cpp
+++ b/scene/gui/input_action.cpp
@@ -24,7 +24,7 @@ bool ShortCut::is_shortcut(const InputEvent& p_event) const {
same=(shortcut.key.scancode==p_event.key.scancode && shortcut.key.mod == p_event.key.mod);
} break;
- case InputEvent::JOYSTICK_BUTTON: {
+ case InputEvent::JOYPAD_BUTTON: {
same=(shortcut.joy_button.button_index==p_event.joy_button.button_index);
@@ -34,7 +34,7 @@ bool ShortCut::is_shortcut(const InputEvent& p_event) const {
same=(shortcut.mouse_button.button_index==p_event.mouse_button.button_index);
} break;
- case InputEvent::JOYSTICK_MOTION: {
+ case InputEvent::JOYPAD_MOTION: {
same=(shortcut.joy_motion.axis==p_event.joy_motion.axis && (shortcut.joy_motion.axis_value < 0) == (p_event.joy_motion.axis_value < 0));
@@ -69,7 +69,7 @@ String ShortCut::get_as_text() const {
return str;
} break;
- case InputEvent::JOYSTICK_BUTTON: {
+ case InputEvent::JOYPAD_BUTTON: {
String str = RTR("Device")+" "+itos(shortcut.device)+", "+RTR("Button")+" "+itos(shortcut.joy_button.button_index);
str+=".";
@@ -90,7 +90,7 @@ String ShortCut::get_as_text() const {
return str;
} break;
- case InputEvent::JOYSTICK_MOTION: {
+ case InputEvent::JOYPAD_MOTION: {
int ax = shortcut.joy_motion.axis;
String str = RTR("Device")+" "+itos(shortcut.device)+", "+RTR("Axis")+" "+itos(ax)+".";
diff --git a/scene/gui/menu_button.cpp b/scene/gui/menu_button.cpp
index a96a39083c..755b296666 100644
--- a/scene/gui/menu_button.cpp
+++ b/scene/gui/menu_button.cpp
@@ -34,7 +34,7 @@
void MenuButton::_unhandled_key_input(InputEvent p_event) {
- if (p_event.is_pressed() && !p_event.is_echo() && (p_event.type==InputEvent::KEY || p_event.type==InputEvent::ACTION || p_event.type==InputEvent::JOYSTICK_BUTTON)) {
+ if (p_event.is_pressed() && !p_event.is_echo() && (p_event.type==InputEvent::KEY || p_event.type==InputEvent::ACTION || p_event.type==InputEvent::JOYPAD_BUTTON)) {
if (!get_parent() || !is_visible() || is_disabled())
return;
diff --git a/scene/main/scene_main_loop.cpp b/scene/main/scene_main_loop.cpp
index a6ef136b84..418f4362b0 100644
--- a/scene/main/scene_main_loop.cpp
+++ b/scene/main/scene_main_loop.cpp
@@ -366,7 +366,7 @@ void SceneTree::input_text( const String& p_text ) {
void SceneTree::input_event( const InputEvent& p_event ) {
- if (is_editor_hint() && (p_event.type==InputEvent::JOYSTICK_MOTION || p_event.type==InputEvent::JOYSTICK_BUTTON))
+ if (is_editor_hint() && (p_event.type==InputEvent::JOYPAD_MOTION || p_event.type==InputEvent::JOYPAD_BUTTON))
return; //avoid joy input on editor
root_lock++;
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index e71426c4f0..4c7114d093 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -2086,8 +2086,8 @@ void Viewport::_gui_input_event(InputEvent p_event) {
} break;
case InputEvent::ACTION:
- case InputEvent::JOYSTICK_BUTTON:
- case InputEvent::JOYSTICK_MOTION:
+ case InputEvent::JOYPAD_BUTTON:
+ case InputEvent::JOYPAD_MOTION:
case InputEvent::KEY: {
diff --git a/tools/doc/doc_data.cpp b/tools/doc/doc_data.cpp
index f66a8aff22..c6953c82be 100644
--- a/tools/doc/doc_data.cpp
+++ b/tools/doc/doc_data.cpp
@@ -503,7 +503,7 @@ void DocData::generate(bool p_basic_types) {
if (i==Variant::INPUT_EVENT) {
static const char* ie_type[InputEvent::TYPE_MAX]={
- "","Key","MouseMotion","MouseButton","JoystickMotion","JoystickButton","ScreenTouch","ScreenDrag","Action"
+ "","Key","MouseMotion","MouseButton","JoypadMotion","JoypadButton","ScreenTouch","ScreenDrag","Action"
};
cname+=ie_type[j];
}
diff --git a/tools/editor/project_settings.cpp b/tools/editor/project_settings.cpp
index f16f20fb96..456f98d137 100644
--- a/tools/editor/project_settings.cpp
+++ b/tools/editor/project_settings.cpp
@@ -82,8 +82,8 @@ void ProjectSettings::_notification(int p_what) {
translation_list->connect("button_pressed",this,"_translation_delete");
_update_actions();
popup_add->add_icon_item(get_icon("Keyboard","EditorIcons"),TTR("Key "),InputEvent::KEY);//"Key " - because the word 'key' has already been used as a key animation
- popup_add->add_icon_item(get_icon("JoyButton","EditorIcons"),TTR("Joy Button"),InputEvent::JOYSTICK_BUTTON);
- popup_add->add_icon_item(get_icon("JoyAxis","EditorIcons"),TTR("Joy Axis"),InputEvent::JOYSTICK_MOTION);
+ popup_add->add_icon_item(get_icon("JoyButton","EditorIcons"),TTR("Joy Button"),InputEvent::JOYPAD_BUTTON);
+ popup_add->add_icon_item(get_icon("JoyAxis","EditorIcons"),TTR("Joy Axis"),InputEvent::JOYPAD_MOTION);
popup_add->add_icon_item(get_icon("Mouse","EditorIcons"),TTR("Mouse Button"),InputEvent::MOUSE_BUTTON);
List<String> tfn;
@@ -198,7 +198,7 @@ void ProjectSettings::_device_input_add() {
}
} break;
- case InputEvent::JOYSTICK_MOTION: {
+ case InputEvent::JOYPAD_MOTION: {
ie.joy_motion.axis = device_index->get_selected()>>1;
ie.joy_motion.axis_value = device_index->get_selected()&1?1:-1;
@@ -207,20 +207,20 @@ void ProjectSettings::_device_input_add() {
for(int i=0;i<arr.size();i++) {
InputEvent aie=arr[i];
- if (aie.device == ie.device && aie.type==InputEvent::JOYSTICK_MOTION && aie.joy_motion.axis==ie.joy_motion.axis && aie.joy_motion.axis_value==ie.joy_motion.axis_value) {
+ if (aie.device == ie.device && aie.type==InputEvent::JOYPAD_MOTION && aie.joy_motion.axis==ie.joy_motion.axis && aie.joy_motion.axis_value==ie.joy_motion.axis_value) {
return;
}
}
} break;
- case InputEvent::JOYSTICK_BUTTON: {
+ case InputEvent::JOYPAD_BUTTON: {
ie.joy_button.button_index=device_index->get_selected();
for(int i=0;i<arr.size();i++) {
InputEvent aie=arr[i];
- if (aie.device == ie.device && aie.type==InputEvent::JOYSTICK_BUTTON && aie.joy_button.button_index==ie.joy_button.button_index) {
+ if (aie.device == ie.device && aie.type==InputEvent::JOYPAD_BUTTON && aie.joy_button.button_index==ie.joy_button.button_index) {
return;
}
}
@@ -361,10 +361,10 @@ void ProjectSettings::_add_item(int p_item){
device_index->add_item(TTR("Button 9"));
device_input->popup_centered_minsize(Size2(350,95));
} break;
- case InputEvent::JOYSTICK_MOTION: {
+ case InputEvent::JOYPAD_MOTION: {
device_id->set_value(0);
- device_index_label->set_text(TTR("Joystick Axis Index:"));
+ device_index_label->set_text(TTR("Joypad Axis Index:"));
device_index->clear();
for(int i=0;i<JOY_AXIS_MAX*2;i++) {
@@ -374,10 +374,10 @@ void ProjectSettings::_add_item(int p_item){
device_input->popup_centered_minsize(Size2(350,95));
} break;
- case InputEvent::JOYSTICK_BUTTON: {
+ case InputEvent::JOYPAD_BUTTON: {
device_id->set_value(3);
- device_index_label->set_text(TTR("Joystick Button Index:"));
+ device_index_label->set_text(TTR("Joypad Button Index:"));
device_index->clear();
for(int i=0;i<JOY_BUTTON_MAX;i++) {
@@ -526,7 +526,7 @@ void ProjectSettings::_update_actions() {
action->set_icon(0,get_icon("Keyboard","EditorIcons"));
} break;
- case InputEvent::JOYSTICK_BUTTON: {
+ case InputEvent::JOYPAD_BUTTON: {
String str = TTR("Device")+" "+itos(ie.device)+", "+TTR("Button")+" "+itos(ie.joy_button.button_index);
if (ie.joy_button.button_index>=0 && ie.joy_button.button_index<JOY_BUTTON_MAX)
@@ -552,7 +552,7 @@ void ProjectSettings::_update_actions() {
action->set_text(0,str);
action->set_icon(0,get_icon("Mouse","EditorIcons"));
} break;
- case InputEvent::JOYSTICK_MOTION: {
+ case InputEvent::JOYPAD_MOTION: {
int ax = ie.joy_motion.axis;
int n = 2*ax + (ie.joy_motion.axis_value<0 ? 0:1);
diff --git a/tools/editor/property_selector.cpp b/tools/editor/property_selector.cpp
index c3e512e990..d3d1421b38 100644
--- a/tools/editor/property_selector.cpp
+++ b/tools/editor/property_selector.cpp
@@ -321,8 +321,8 @@ void PropertySelector::_item_selected() {
case InputEvent::KEY: class_type="InputEventKey"; break;
case InputEvent::MOUSE_MOTION: class_type="InputEventMouseMotion"; break;
case InputEvent::MOUSE_BUTTON: class_type="InputEventMouseButton"; break;
- case InputEvent::JOYSTICK_MOTION: class_type="InputEventJoystickMotion"; break;
- case InputEvent::JOYSTICK_BUTTON: class_type="InputEventJoystickButton"; break;
+ case InputEvent::JOYPAD_MOTION: class_type="InputEventJoypadMotion"; break;
+ case InputEvent::JOYPAD_BUTTON: class_type="InputEventJoypadButton"; break;
case InputEvent::SCREEN_TOUCH: class_type="InputEventScreenTouch"; break;
case InputEvent::SCREEN_DRAG: class_type="InputEventScreenDrag"; break;
case InputEvent::ACTION: class_type="InputEventAction"; break;