]> git.mxchange.org Git - flightgear.git/blobdiff - src/Input/fgjs.cxx
Moved some of the low level scene graph construction code over to simgear.
[flightgear.git] / src / Input / fgjs.cxx
index 80cfc97ad503e4859abdbdde5fbbfc4dbcdb68be..c4cd037d9b04312151bdfb383515d35f4081357a 100644 (file)
 
 #include <jsinput.h>
 
-#if !defined(SG_HAVE_NATIVE_SGI_COMPILERS)
 SG_USING_STD(fstream);
 SG_USING_STD(cout);
 SG_USING_STD(endl);
 SG_USING_STD(ios);
 SG_USING_STD(string);
-#endif
-
 
 string axes_humannames[8] = { "elevator", "ailerons", "rudder", "throttle", 
                               "mixture","propller pitch", "lateral view", 
                               "longitudinal view" 
                             };
 
-string axes_propnames[8]={ "/controls/elevator","/controls/aileron",
-                           "/controls/rudder","/controls/throttle",
-                           "/controls/mixture","/controls/pitch", 
+string axes_propnames[8]={ "/controls/flight/elevator","/controls/flight/aileron",
+                           "/controls/flight/rudder","/controls/engines/engine/throttle",
+                           "/controls/engines/engine/mixture","/controls/engines/engine/pitch", 
                            "/sim/views/axes/lat","/sim/views/axes/long" 
                          };
                       
@@ -57,10 +54,10 @@ string button_humannames[7]= { "apply all brakes", "apply left brake",
                                "apply nose-down trim"
                              }; 
 
-string button_propnames[7]={ "/controls/brakes/all", "/controls/brakes[0]",
-                             "/controls/brakes[1]", "/controls/flaps",
-                             "/controls/flaps","/controls/elevator-trim",
-                             "/controls/elevator-trim" 
+string button_propnames[7]={ "/controls/gear/wheel[-1]/brake", "/controls/gear/wheel[0]/brake",
+                             "/controls/gear/wheel[1]/brake", "/controls/flight/flaps",
+                             "/controls/flight/flaps","/controls/flight/elevator-trim",
+                             "/controls/flight/elevator-trim" 
                            };                                                   
  
 
@@ -89,15 +86,16 @@ void waitForButton(jsSuper *jss, int wait_ms) {
 
 void writeAxisProperties(fstream &fs, int control,int joystick, int axis) {
      
-     char jsDesc[40];
-     snprintf(jsDesc,40,"--prop:/input/joysticks/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;
@@ -107,13 +105,13 @@ void writeAxisProperties(fstream &fs, int control,int joystick, int axis) {
 
 void writeButtonProperties(fstream &fs, int property,int joystick, int button) {
      
-     char jsDesc[40];
-     snprintf(jsDesc,40,"--prop:/input/joysticks/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; 
 }