]> git.mxchange.org Git - flightgear.git/blobdiff - src/Input/FGJoystickInput.hxx
Allow using the system version of flite and the HTS engine
[flightgear.git] / src / Input / FGJoystickInput.hxx
index a59f9bbe20dc4142e889bc23640b1bc9773a3dec..b161da9a3dc9d1c3521d9dbb7ff65cb00a6e9a3f 100644 (file)
 #ifndef _FGJOYSTICKINPUT_HXX
 #define _FGJOYSTICKINPUT_HXX
 
-#ifndef __cplusplus                                                          
-# error This library requires C++
-#endif
-
 #include "FGCommonInput.hxx"
 #include "FGButton.hxx"
-#include "FGjs.hxx"
-#include <simgear/structure/subsystem_mgr.hxx>
 
+#include <memory> // for std::auto_ptr
+#include <simgear/structure/subsystem_mgr.hxx>
+#include <plib/js.h>
 
 ////////////////////////////////////////////////////////////////////////
 // The Joystick Input Class
@@ -45,6 +42,7 @@ public:
 
   virtual void init();
   virtual void postinit();
+  virtual void reinit();
   virtual void update( double dt );
 
   static const int MAX_JOYSTICKS        = 10;
@@ -52,6 +50,11 @@ public:
   static const int MAX_JOYSTICK_BUTTONS = 32;
 
 private:
+    
+   void _remove(bool all);
+   SGPropertyNode_ptr status_node;
+
   /**
    * Settings for a single joystick axis.
    */
@@ -65,7 +68,7 @@ private:
     float high_threshold;
     FGButton low;
     FGButton high;
-    float interval_sec;
+    float interval_sec, delay_sec, release_delay_sec;
     double last_dt;
   };
 
@@ -76,14 +79,19 @@ private:
     joystick ();
     virtual ~joystick ();
     int jsnum;
-    jsJoystick * js;
+    std::auto_ptr<jsJoystick> plibJS;
     int naxes;
     int nbuttons;
     axis * axes;
     FGButton * buttons;
+    bool predefined;
+      
+    void clearAxesAndButtons();
   };
-  joystick bindings[MAX_JOYSTICKS];
-
+    
+  joystick joysticks[MAX_JOYSTICKS];
+  void updateJoystick(int index, joystick* joy, double dt);
+    
 };
 
 #endif