aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorHinsbart2016-04-28 15:53:49 +0200
committerRémi Verschelde2016-04-29 07:43:16 +0200
commit3a3f56689e8d0ccebde4668dc81c975f03381ff7 (patch)
treea2eb98a0e71916790287e835ff3433bec4630f8c /tools
parent35e05b092c4c0af3919abd0fd90158dd37e2ba87 (diff)
downloadgodot-3a3f56689e8d0ccebde4668dc81c975f03381ff7.tar.gz
godot-3a3f56689e8d0ccebde4668dc81c975f03381ff7.tar.zst
godot-3a3f56689e8d0ccebde4668dc81c975f03381ff7.zip
More precise InputMap Axis descriptions in project settings.
Now it's "Left Stick {Up, Down, Left, Right}" instead of just "Left Stick" repeated 4x. (cherry picked from commit 418049b741bc6aa1445e64b78c681e5291f5a4d4)
Diffstat (limited to 'tools')
-rw-r--r--tools/editor/project_settings.cpp42
1 files changed, 18 insertions, 24 deletions
diff --git a/tools/editor/project_settings.cpp b/tools/editor/project_settings.cpp
index cd11345e0..f4797b433 100644
--- a/tools/editor/project_settings.cpp
+++ b/tools/editor/project_settings.cpp
@@ -56,6 +56,20 @@ static const char* _button_names[JOY_BUTTON_MAX]={
"D-Pad Right"
};
+static const char* _axis_names[JOY_AXIS_MAX*2] = {
+ " (Left Stick Left)",
+ " (Left Stick Right)",
+ " (Left Stick Up)",
+ " (Left Stick Down)",
+ " (Right Stick Left)",
+ " (Right Stick Right)",
+ " (Right Stick Up)",
+ " (Right Stick Down)",
+ "","","","",
+ "", " (L2)",
+ "", " (R2)"
+};
+
void ProjectSettings::_notification(int p_what) {
if (p_what==NOTIFICATION_ENTER_TREE) {
@@ -342,19 +356,7 @@ void ProjectSettings::_add_item(int p_item){
device_index->clear();
for(int i=0;i<JOY_AXIS_MAX*2;i++) {
- String desc;
-
- int ax=i/2;
- if (ax==0 || ax==1)
- desc=" (Left Stick)";
- else if (ax==2 || ax==3)
- desc=" (Right Stick)";
- else if (ax==6)
- desc=" (L2)";
- else if (ax==7)
- desc=" (R2)";
-
-
+ String desc = _axis_names[i];
device_index->add_item("Axis "+itos(i/2)+" "+(i&1?"+":"-")+desc);
}
device_input->popup_centered(Size2(350,95));
@@ -541,18 +543,10 @@ void ProjectSettings::_update_actions() {
} break;
case InputEvent::JOYSTICK_MOTION: {
- String desc;
int ax = ie.joy_motion.axis;
-
- if (ax==0 || ax==1)
- desc=" (Left Stick).";
- else if (ax==2 || ax==3)
- desc=" (Right Stick).";
- else if (ax==6)
- desc=" (L2).";
- else if (ax==7)
- desc=" (R2).";
- String str = "Device "+itos(ie.device)+", Axis "+itos(ie.joy_motion.axis)+" "+(ie.joy_motion.axis_value<0?"-":"+")+desc;
+ int n = 2*ax + (ie.joy_motion.axis_value<0 ? 0:1);
+ String desc = _axis_names[n];
+ String str = "Device "+itos(ie.device)+", Axis "+itos(ax)+" "+(ie.joy_motion.axis_value<0?"-":"+")+desc +".";
action->set_text(0,str);
action->set_icon(0,get_icon("JoyAxis","EditorIcons"));
} break;