]> git.mxchange.org Git - flightgear.git/blobdiff - src/Input/input.hxx
- adjusted for no-value constructor for FGPanel
[flightgear.git] / src / Input / input.hxx
index 4ee5e0dddfe3b965fb455765f5436bc49ecf9b44..bc7bb55c42bea973096520101eae86a7f6cc47ae 100644 (file)
@@ -184,25 +184,29 @@ public:
 
 private:
 
-  typedef vector<FGBinding> binding_list_t;
-
                                // Constants
-  static const int MAX_KEYS = 1024;
+  enum 
+  {
+    MAX_KEYS = 1024,
+
   #ifdef WIN32
-  static const int MAX_JOYSTICKS = 2;
+    MAX_JOYSTICKS = 2,
   #else
-  static const int MAX_JOYSTICKS = 10;
+    MAX_JOYSTICKS = 10,
   #endif
-  static const int MAX_AXES = _JS_MAX_AXES;
-  static const int MAX_BUTTONS = 32;
+    MAX_AXES = _JS_MAX_AXES,
+    MAX_BUTTONS = 32
+  };
 
 
+  typedef vector<FGBinding> binding_list_t;
+
   /**
    * Settings for a key or button.
    */
   struct button {
     button ()
-      : is_repeatable(true),
+      : is_repeatable(false),
        last_state(-1)
     {}
     bool is_repeatable;
@@ -217,11 +221,17 @@ private:
   struct axis {
     axis ()
       : last_value(9999999),
-       tolerance(0.002)
+       tolerance(0.002),
+       low_threshold(-0.9),
+       high_threshold(0.9)
     {}
     float last_value;
     float tolerance;
     binding_list_t bindings[FG_MOD_MAX];
+    float low_threshold;
+    float high_threshold;
+    struct button low;
+    struct button high;
   };
 
 
@@ -254,6 +264,14 @@ private:
   void _init_joystick ();
 
 
+  /**
+   * Initialize a single button.
+   */
+  inline void _init_button (const SGPropertyNode * node,
+                           button &b,
+                           const string name);
+
+
   /**
    * Update the keyboard.
    */
@@ -266,6 +284,12 @@ private:
   void _update_joystick ();
 
 
+  /**
+   * Update a single button.
+   */
+  inline void _update_button (button &b, int modifiers, bool pressed);
+
+
   /**
    * Read bindings and modifiers.
    */
@@ -283,6 +307,12 @@ private:
 
 };
 
+// Handle keyboard events
+void GLUTkey(unsigned char k, int x, int y);
+void GLUTkeyup(unsigned char k, int x, int y);
+void GLUTspecialkey(int k, int x, int y);
+void GLUTspecialkeyup(int k, int x, int y);
+
 extern FGInput current_input;
 
 #endif // _CONTROLS_HXX