diff options
author | Juan Linietsky <reduzio@gmail.com> | 2016-01-02 09:37:16 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2016-01-02 09:37:16 -0300 |
commit | 432e2e77692e0c718b35ffddc0602a4193e13239 (patch) | |
tree | 05e893d7bfdb12e6afbd7a404d08d00226fbcc70 /tools/editor | |
parent | df5fa62ab955437f05bfd7acdf6ed61d6d9c827e (diff) |
proper joy axis support as actions, can be configured and inquired, fixes #2317
Diffstat (limited to 'tools/editor')
-rw-r--r-- | tools/editor/project_settings.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/tools/editor/project_settings.cpp b/tools/editor/project_settings.cpp index 09d2e4bd01..174ec66f24 100644 --- a/tools/editor/project_settings.cpp +++ b/tools/editor/project_settings.cpp @@ -156,12 +156,14 @@ void ProjectSettings::_device_input_add() { } break; case InputEvent::JOYSTICK_MOTION: { - ie.joy_motion.axis = device_index->get_selected(); + ie.joy_motion.axis = device_index->get_selected()>>1; + ie.joy_motion.axis_value = device_index->get_selected()&1?1:-1; + 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) { + 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) { return; } } @@ -295,9 +297,10 @@ void ProjectSettings::_add_item(int p_item){ device_id->set_val(0); device_index_label->set_text("Joy Button Axis:"); device_index->clear(); - for(int i=0;i<8;i++) { + for(int i=0;i<24;i++) { + - device_index->add_item("Axis "+itos(i)); + device_index->add_item("Axis "+itos(i/2)+" "+(i&1?"+":"-")); } device_input->popup_centered(Size2(350,95)); @@ -494,7 +497,7 @@ void ProjectSettings::_update_actions() { } break; case InputEvent::JOYSTICK_MOTION: { - String str = "Device "+itos(ie.device)+", Axis "+itos(ie.joy_motion.axis)+"."; + String str = "Device "+itos(ie.device)+", Axis "+itos(ie.joy_motion.axis)+" "+(ie.joy_motion.axis_value<0?"-.":"+."); action->set_text(0,str); action->set_icon(0,get_icon("JoyAxis","EditorIcons")); } break; |