-#include STL_IOSTREAM
-#include STL_FSTREAM
-#include STL_STRING
-
-#include <jsinput.h>
-
-SG_USING_STD(fstream);
-SG_USING_STD(cout);
-SG_USING_STD(cin);
-SG_USING_STD(endl);
-SG_USING_STD(ios);
-SG_USING_STD(string);
-
-string axes_humannames[8] = { "Aileron", "Elevator", "Rudder", "Throttle",
- "Mixture", "Pitch", "View Direction",
- "View Elevation"
- };
-
-string axes_propnames[8]={ "/controls/flight/aileron","/controls/flight/elevator",
- "/controls/flight/rudder","/controls/engines/engine[%d]/throttle",
- "/controls/engines/engine[%d]/mixture","/controls/engines/engine[%d]/pitch",
- "/sim/current-view/goal-heading-offset-deg",
- "/sim/current-view/goal-pitch-offset-deg"
- };
-
-string axis_posdir[8]= { "right", "down/forward", "right", "forward", "forward", "forward", "left", "upward" };
-
-
-bool half_range[8]={ false,false,false,true,true,true,false,false };
-
-bool repeatable[8]={ false,false,false,false,false,false,true,true };
-
-bool invert[8]= { false,false,false,false,false,false,false,false };
-
-string button_humannames[8]= { "Left Brake", "Right Brake",
- "Flaps Up", "Flaps Down",
- "Elevator Trim Forward", "Elevator Trim Backward",
- "Landing Gear Up", "Landing Gear Down"
- };
-
-string button_propnames[8]={ "/controls/gear/brake-left",
- "/controls/gear/brake-right",
- "/controls/flight/flaps",
- "/controls/flight/flaps",
- "/controls/flight/elevator-trim",
- "/controls/flight/elevator-trim",
- "/controls/gear/gear-down",
- "/controls/gear/gear-down"
- };
-
-bool button_modup[8]={ true,true,false,false,false,false,false,false };
-
-bool button_boolean[8]={ false,false,false,false,false,false,true,true };
-
-float button_step[8]={ 1.0, 1.0, -0.34, 0.34, 0.001, -0.001, 0.0, 1.0 };
-
-string button_repeat[8]={ "false", "false", "false", "false", "true", "true", "false", "false" };
-
-
-void writeAxisXML(fstream &fs, int control, int axis) {
-
- char axisline[16];
- snprintf(axisline,16," <axis n=\"%d\">",axis);
-
- fs << axisline << endl;
- fs << " <desc>" << axes_humannames[control] << "</desc>" << endl;
- if (half_range[control]) {
- for (int i=0; i<=7; i++) {
- fs << " <binding>" << endl;
- fs << " <command>property-scale</command>" << endl;
- char propertyline[256];
- snprintf(propertyline,256,axes_propnames[control].c_str(),i);
- fs << " <property>" << propertyline << "</property>" << endl;
- fs << " <offset type=\"double\">-1.0</offset>" << endl;
- fs << " <factor type=\"double\">-0.5</factor>" << endl;
- fs << " </binding>" << endl;
- }
- } else if (repeatable[control]) {
- fs << " <low>" << endl;
- fs << " <repeatable>true</repeatable>" << endl;
- fs << " <binding>" << endl;
- fs << " <command>property-adjust</command>" << endl;
- fs << " <property>" << axes_propnames[control] << "</property>" << endl;
- if (invert[control]) {
- fs << " <step type=\"double\">1.0</step>" << endl;
- } else {
- fs << " <step type=\"double\">-1.0</step>" << endl;
- }
- fs << " </binding>" << endl;
- fs << " </low>" << endl;
- fs << " <high>" << endl;
- fs << " <repeatable>true</repeatable>" << endl;
- fs << " <binding>" << endl;
- fs << " <command>property-adjust</command>" << endl;
- fs << " <property>" << axes_propnames[control] << "</property>" << endl;
- if (invert[control]) {
- fs << " <step type=\"double\">-1.0</step>" << endl;
- } else {
- fs << " <step type=\"double\">1.0</step>" << endl;
- }
- fs << " </binding>" << endl;
- fs << " </high>" << endl;
- } else {
- fs << " <binding>" << endl;
- fs << " <command>property-scale</command>" << endl;
- fs << " <property>" << axes_propnames[control] << "</property>" << endl;
- fs << " <dead-band type=\"double\">0.02</dead-band>" << endl;
- fs << " <offset type=\"double\">0.0</offset>" << endl;
- if (invert[control]) {
- fs << " <factor type=\"double\">-1.0</factor>" << endl;
- } else {
- fs << " <factor type=\"double\">1.0</factor>" << endl;
- }
- fs << " </binding>" << endl;
- }
- fs << " </axis>" << endl << endl;