FGBinding ();
+ /**
+ * Copy constructor.
+ */
+ FGBinding (const FGBinding &binding);
+
+
/**
* Convenience constructor.
*
private:
- void _fire (const SGPropertyNode *arg) const;
string _command_name;
SGCommandMgr::command_t _command;
- const SGPropertyNode * _arg;
+ mutable SGPropertyNode * _arg;
+ mutable SGPropertyNode * _setting;
+ mutable SGCommandState * _command_state;
};
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 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;
};
void _init_joystick ();
+ /**
+ * Initialize a single button.
+ */
+ inline void _init_button (const SGPropertyNode * node,
+ button &b,
+ const string name);
+
+
/**
* Update the keyboard.
*/
void _update_joystick ();
+ /**
+ * Update a single button.
+ */
+ inline void _update_button (button &b, int modifiers, bool pressed);
+
+
/**
* Read bindings and modifiers.
*/
};
+// 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