X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FInput%2Ffgjs.cxx;h=691c9df1a09e72e372199c4ccb9b1646e6228b6a;hb=b9e866cfdd765cc742a6c9b3e35c8a9c1ca08dfc;hp=15fc46ce0d47476f44422749faaed4eb11de2a1a;hpb=9124dd945d9142b667839761f57075d07e4d1585;p=flightgear.git diff --git a/src/Input/fgjs.cxx b/src/Input/fgjs.cxx index 15fc46ce0..691c9df1a 100644 --- a/src/Input/fgjs.cxx +++ b/src/Input/fgjs.cxx @@ -18,13 +18,27 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +#include -#include -#include -#include -#include #include -#include + +#include STL_IOSTREAM +#include STL_FSTREAM +#include STL_STRING + +#include + +#if !defined(SG_HAVE_NATIVE_SGI_COMPILERS) +SG_USING_STD(fstream); +SG_USING_STD(cout); +SG_USING_STD(endl); +SG_USING_STD(ios); +#endif +SG_USING_STD(string); + +#if defined(_MSC_VER) || defined(__MINGW32__) +#define snprintf _snprintf +#endif string axes_humannames[8] = { "elevator", "ailerons", "rudder", "throttle", "mixture","propller pitch", "lateral view", @@ -46,8 +60,8 @@ string button_humannames[7]= { "apply all brakes", "apply left brake", "apply nose-down trim" }; -string button_propnames[7]={ "/controls/brakes/all", "/controls/brakes/left", - "/controls/brakes/right", "/controls/flaps", +string button_propnames[7]={ "/controls/brakes/all", "/controls/brakes[0]", + "/controls/brakes[1]", "/controls/flaps", "/controls/flaps","/controls/elevator-trim", "/controls/elevator-trim" }; @@ -78,15 +92,16 @@ void waitForButton(jsSuper *jss, int wait_ms) { void writeAxisProperties(fstream &fs, int control,int joystick, int axis) { - char jsDesc[25]; - snprintf(jsDesc,25,"--prop:/input/js%d/axis%d",joystick,axis); - fs << jsDesc << "/control=" << axes_propnames[control] << endl; + char jsDesc[80]; + snprintf(jsDesc,80,"--prop:/input/joysticks/js[%d]/axis[%d]/binding",joystick,axis); + fs << jsDesc << "/command=property-scale" << endl; + fs << jsDesc << "/property=" << axes_propnames[control] << endl; fs << jsDesc << "/dead-band=0.02" << endl; if( half_range[control] == true) { fs << jsDesc << "/offset=-1.0" << endl; - fs << jsDesc << "/factor=0.5" << endl; + fs << jsDesc << "/factor=-0.5" << endl; } else { fs << jsDesc << "/offset=0.0" << endl; fs << jsDesc << "/factor=1.0" << endl; @@ -96,13 +111,13 @@ void writeAxisProperties(fstream &fs, int control,int joystick, int axis) { void writeButtonProperties(fstream &fs, int property,int joystick, int button) { - char jsDesc[25]; - snprintf(jsDesc,25,"--prop:/input/js%d/button%d",joystick,button); + char jsDesc[80]; + snprintf(jsDesc,80,"--prop:/input/joysticks/js[%d]/button[%d]/binding",joystick,button); - fs << jsDesc << "/action=adjust" << endl; - fs << jsDesc << "/control=" << button_propnames[property] << endl; - fs << jsDesc << "/step=" << button_step[property] << endl; fs << jsDesc << "/repeatable=" << button_repeat[property] << endl; + fs << jsDesc << "/command=property-adjust" << endl; + fs << jsDesc << "/property=" << button_propnames[property] << endl; + fs << jsDesc << "/step=" << button_step[property] << endl; fs << endl; } @@ -113,7 +128,7 @@ int main(void) { jsSuper *jss=new jsSuper(); jsInput *jsi=new jsInput(jss); jsi->displayValues(false); - int i; + // int i; int control=0; @@ -196,6 +211,3 @@ int main(void) { return 1; } - - -