Some users have odd joysticks with more then 8 axises, increased to 16 (so 4 joysticks)
Ideally there would be no limit but I dont think its worth the effort. Also had a bug in last commit for the pytyhon api's "axisSingle" attribute, UI index starts at 1 not zero.
This commit is contained in:
@@ -1495,7 +1495,7 @@ static short draw_sensorbuttons(bSensor *sens, uiBlock *block, short xco, short
|
||||
else if(joy->type == SENS_JOY_AXIS)
|
||||
{
|
||||
uiDefButS(block, NUM, 1, "Number:", xco+10, yco-68, 0.46 * (width-20), 19,
|
||||
&joy->axis, 1, 4.0, 100, 0,
|
||||
&joy->axis, 1, 8.0, 100, 0,
|
||||
"Specify which axis pair to use, 1 is useually the main direction input.");
|
||||
|
||||
uiDefButI(block, NUM, 1, "Threshold:", xco+10 + 0.6 * (width-20),yco-44, 0.4 * (width-20), 19,
|
||||
@@ -1523,7 +1523,7 @@ static short draw_sensorbuttons(bSensor *sens, uiBlock *block, short xco, short
|
||||
}
|
||||
else { /* (joy->type == SENS_JOY_AXIS_SINGLE)*/
|
||||
uiDefButS(block, NUM, 1, "Number:", xco+10, yco-68, 0.46 * (width-20), 19,
|
||||
&joy->axis_single, 1, 8.0, 100, 0,
|
||||
&joy->axis_single, 1, 16.0, 100, 0,
|
||||
"Specify a single axis (verticle/horizontal/other) to detect");
|
||||
|
||||
uiDefButI(block, NUM, 1, "Threshold:", xco+10 + 0.6 * (width-20),yco-44, 0.4 * (width-20), 19,
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
#endif
|
||||
|
||||
#define JOYINDEX_MAX 8
|
||||
#define JOYAXIS_MAX 8
|
||||
#define JOYAXIS_MAX 16
|
||||
|
||||
#define JOYAXIS_RIGHT 0
|
||||
#define JOYAXIS_UP 1
|
||||
|
||||
@@ -605,7 +605,7 @@ PyObject* SCA_JoystickSensor::pyattr_get_axis_single(void *self_v, const KX_PYAT
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return PyInt_FromLong(joy->GetAxisPosition(self->m_axis));
|
||||
return PyInt_FromLong(joy->GetAxisPosition(self->m_axis-1));
|
||||
}
|
||||
|
||||
PyObject* SCA_JoystickSensor::pyattr_get_num_axis(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
|
||||
|
||||
Reference in New Issue
Block a user