|
@@ -74,6 +74,8 @@ laController* la_FindControllerWithID(int id){
|
|
|
void la_ReadControllerAxisLimit(laController* c, int i, int Min, int Max){
|
|
|
c->AxisMins[i] = Min;
|
|
|
c->AxisMaxes[i] = Max;
|
|
|
+ c->AxisLimitMins[i] = -32768*0.95;
|
|
|
+ c->AxisLimitMaxes[i] = 32767*0.95;
|
|
|
}
|
|
|
void la_InitControllers(){
|
|
|
#ifdef __linux__
|
|
@@ -169,16 +171,26 @@ void la_AddButtonProp(laPropContainer* pc, char* id, char* name, char* desc, int
|
|
|
laAddEnumItemAs(p,"ACTIVE", "Active", "Button is pressed", 1, 0);
|
|
|
p->ElementBytes=1;
|
|
|
}
|
|
|
-void la_AddAxisProp(laPropContainer* pc, char* id, char* name, char* desc, int i, int array_len, char* array_prefix){
|
|
|
+void la_AddAxisProp(laPropContainer* pc, char* id, char* name, char* id_min, char* id_max, char* id_cmin, char* id_cmax, char* desc, int i, int array_len, char* array_prefix){
|
|
|
laProp* p=laAddIntProperty(pc,id,name,desc,array_len>1?LA_WIDGET_VALUE_METER_2D:LA_WIDGET_VALUE_METER,
|
|
|
array_prefix,0,32767,-32768,1,0,0,offsetof(laController, AxisValues[i]),0,0,array_len,0,0,0,0,0,0,0,LA_READ_ONLY);
|
|
|
+ if(id_min) p=laAddIntProperty(pc,id_min,id_min,desc,0,
|
|
|
+ array_prefix,0,32767,-32768,1,0,0,offsetof(laController, AxisLimitMins[i]),0,0,array_len,0,0,0,0,0,0,0,0);
|
|
|
+ if(id_max) p=laAddIntProperty(pc,id_max,id_max,desc,0,
|
|
|
+ array_prefix,0,32767,-32768,1,0,0,offsetof(laController, AxisLimitMaxes[i]),0,0,array_len,0,0,0,0,0,0,0,0);
|
|
|
+ if(id_min) p=laAddIntProperty(pc,id_cmax,id_cmax,desc,0,
|
|
|
+ array_prefix,0,32767,-32768,1,0,0,offsetof(laController, AxisCenterMins[i]),0,0,array_len,0,0,0,0,0,0,0,0);
|
|
|
+ if(id_cmax) p=laAddIntProperty(pc,id_cmin,id_cmin,desc,0,
|
|
|
+ array_prefix,0,32767,-32768,1,0,0,offsetof(laController, AxisCenterMaxes[i]),0,0,array_len,0,0,0,0,0,0,0,0);
|
|
|
}
|
|
|
void la_AddGenericButtonProps(laPropContainer* pc){
|
|
|
for(int i=0;i<LA_JS_MAX_BUTTONS;i++){ char* name=LA_JS_BTN_NAMES[i]; la_AddButtonProp(pc,name,name,name,i,0,0); }
|
|
|
}
|
|
|
void la_AddGenericAxisProps(laPropContainer* pc){
|
|
|
- for(int i=0;i<LA_JS_MAX_AXES;i++){ char* name=LA_JS_AXIS_NAMES[i]; la_AddAxisProp(pc,name,name,name,i,0,0); }
|
|
|
+ for(int i=0;i<LA_JS_MAX_AXES;i++){ char* name=LA_JS_AXIS_NAMES[i]; la_AddAxisProp(pc,name,name,0,0,0,0,name,i,0,0); }
|
|
|
}
|
|
|
+#define ADD_AXIS_PROP(pc,id,name,desc,i,array_len,array_prefix) \
|
|
|
+ la_AddAxisProp(pc,id,name,id "_min",id "_max",id "_cmin",id "_cmax",desc,i,array_len,array_prefix)
|
|
|
|
|
|
void laui_X56Throttle(laUiList *uil, laPropPack *This, laPropPack *Extra, laColumn *UNUSED, int context);
|
|
|
void laui_X56Stick(laUiList *uil, laPropPack *This, laPropPack *Extra, laColumn *UNUSED, int context);
|
|
@@ -216,13 +228,13 @@ void la_RegisterControllerProps(){
|
|
|
LA_PC_JS_X56_THROTTLE = pc;
|
|
|
laAddStringProperty(pc,"name","Name","Name of the controller", LA_WIDGET_STRING_PLAIN,0,0,0,1,offsetof(laController,Name),0,0,0,0,LA_READ_ONLY|LA_AS_IDENTIFIER);
|
|
|
laAddSubGroup(pc,"base","Base","Generic controller status", "la_controller",0,0,0,0,0,0,0,0,0,0,0,LA_UDF_LOCAL);
|
|
|
- la_AddAxisProp(pc,"thr1","THR1","Throttle 1",0,0,0);
|
|
|
- la_AddAxisProp(pc,"thr2","THR2","Throttle 1",1,0,0);
|
|
|
- la_AddAxisProp(pc,"wf","WF","Wheel F (big wheel)",2,0,0);
|
|
|
- la_AddAxisProp(pc,"ball","Ball","Thumb ball",3,2,"Left/Right,Up/Down");
|
|
|
- la_AddAxisProp(pc,"wg","WG","Wheel G (smaller wheel)",5,0,0);
|
|
|
- la_AddAxisProp(pc,"r4","RTY4","Rotary 4",6,0,0);
|
|
|
- la_AddAxisProp(pc,"r3","RTY3","Rotary 3",7,0,0);
|
|
|
+ ADD_AXIS_PROP(pc,"thr1","THR1","Throttle 1",0,0,0);
|
|
|
+ ADD_AXIS_PROP(pc,"thr2","THR2","Throttle 1",1,0,0);
|
|
|
+ ADD_AXIS_PROP(pc,"wf","WF","Wheel F (big wheel)",2,0,0);
|
|
|
+ ADD_AXIS_PROP(pc,"ball","Ball","Thumb ball",3,2,"Left/Right,Up/Down");
|
|
|
+ ADD_AXIS_PROP(pc,"wg","WG","Wheel G (smaller wheel)",5,0,0);
|
|
|
+ ADD_AXIS_PROP(pc,"r4","RTY4","Rotary 4",6,0,0);
|
|
|
+ ADD_AXIS_PROP(pc,"r3","RTY3","Rotary 3",7,0,0);
|
|
|
la_AddButtonProp(pc,"be","E","Button E (thumb flat switch)", 0,0,0);
|
|
|
la_AddButtonProp(pc,"bf","F","Button F (big push down switch)", 1,0,0);
|
|
|
la_AddButtonProp(pc,"bg","G","Button G (smaller up-side-down switch)", 2,0,0);
|
|
@@ -257,10 +269,10 @@ void la_RegisterControllerProps(){
|
|
|
LA_PC_JS_X56_STICK = pc;
|
|
|
laAddStringProperty(pc,"name","Name","Name of the controller", LA_WIDGET_STRING_PLAIN,0,0,0,1,offsetof(laController,Name),0,0,0,0,LA_READ_ONLY|LA_AS_IDENTIFIER);
|
|
|
laAddSubGroup(pc,"base","Base","Generic controller status", "la_controller",0,0,0,0,0,0,0,0,0,0,0,LA_UDF_LOCAL);
|
|
|
- la_AddAxisProp(pc,"stick","Stick","Main stick",0,2,"Left/Right,Up/Down");
|
|
|
- la_AddAxisProp(pc,"ball","Ball","Ball stick",2,2,"Left/Right,Up/Down");
|
|
|
- la_AddAxisProp(pc,"rudder","Rudder","Ruder twist",4,0,0);
|
|
|
- la_AddAxisProp(pc,"pov","POV","POV hat",5,2,"Left/Right,Up/Down");
|
|
|
+ ADD_AXIS_PROP(pc,"stick","Stick","Main stick",0,2,"Left/Right,Up/Down");
|
|
|
+ ADD_AXIS_PROP(pc,"ball","Ball","Ball stick",2,2,"Left/Right,Up/Down");
|
|
|
+ ADD_AXIS_PROP(pc,"rudder","Rudder","Ruder twist",4,0,0);
|
|
|
+ ADD_AXIS_PROP(pc,"pov","POV","POV hat",5,2,"Left/Right,Up/Down");
|
|
|
la_AddButtonProp(pc,"trigger","Trigger","Trigger", 0,0,0);
|
|
|
la_AddButtonProp(pc,"ba","A","Button A", 1,0,0);
|
|
|
la_AddButtonProp(pc,"bb","B","Button B (Side of stick)", 2,0,0);
|
|
@@ -304,7 +316,16 @@ void laui_X56Throttle(laUiList *uil, laPropPack *This, laPropPack *Extra, laColu
|
|
|
laEndRow(uil,b);
|
|
|
b=laBeginRow(uil,crl,0,0);
|
|
|
ui=laShowItem(uil,crl,This,"thr1");ui->Expand=1;ui->Extra->HeightCoeff=10;ui->Flags|=LA_UI_FLAGS_TRANSPOSE;
|
|
|
+ laShowCompoundValue(ui,LA_SLOT_MARKER_1,This,"thr1_min");
|
|
|
+ laShowCompoundValue(ui,LA_SLOT_MARKER_2,This,"thr1_max");
|
|
|
ui=laShowItem(uil,crl,This,"thr2");ui->Expand=1;ui->Extra->HeightCoeff=10;ui->Flags|=LA_UI_FLAGS_TRANSPOSE;
|
|
|
+ laShowCompoundValue(ui,LA_SLOT_MARKER_1,This,"thr2_min");
|
|
|
+ laShowCompoundValue(ui,LA_SLOT_MARKER_2,This,"thr2_max");
|
|
|
+ laEndRow(uil,b);
|
|
|
+ b=laBeginRow(uil,crl,0,0);
|
|
|
+ laShowItem(uil,crl,This,"thr1_min")->Flags|=LA_UI_FLAGS_KNOB; laShowItem(uil,crl,This,"thr1_max")->Flags|=LA_UI_FLAGS_KNOB;
|
|
|
+ laShowSeparator(uil,crl)->Expand=1;
|
|
|
+ laShowItem(uil,crl,This,"thr2_min")->Flags|=LA_UI_FLAGS_KNOB; laShowItem(uil,crl,This,"thr2_max")->Flags|=LA_UI_FLAGS_KNOB;
|
|
|
laEndRow(uil,b);
|
|
|
|
|
|
laShowItem(uil,rcl,This,"bf");
|