]> git.mxchange.org Git - flightgear.git/commitdiff
Andreas Gaeb: make input (joystick) re-init work.
authorJames Turner <zakalawe@mac.com>
Sat, 29 Jan 2011 16:05:02 +0000 (16:05 +0000)
committerJames Turner <zakalawe@mac.com>
Sat, 29 Jan 2011 16:05:02 +0000 (16:05 +0000)
src/Input/FGJoystickInput.cxx
src/Input/FGJoystickInput.hxx

index 349782d5b5e3c890abfb46e89a7c45c3e79cd59a..17f1f3557f1afec4d85986ef207594867b49ac7f 100644 (file)
@@ -119,6 +119,14 @@ void FGJoystickInput::init()
   }
 }
 
+void FGJoystickInput::reinit() {
+  SG_LOG(SG_INPUT, SG_DEBUG, "Re-Initializing joystick bindings");
+  SGPropertyNode * js_nodes = fgGetNode("/input/joysticks", true);
+  js_nodes->removeChildren("js", false);
+  FGJoystickInput::init();
+  FGJoystickInput::postinit();
+}
+
 void FGJoystickInput::postinit()
 {
   FGNasalSys *nasalsys = (FGNasalSys *)globals->get_subsystem("nasal");
index ef1530ec025497194ce8559381abc70efe8bde27..039401e29892c38f87866d5f1a449156793d20a4 100644 (file)
@@ -44,6 +44,7 @@ public:
 
   virtual void init();
   virtual void postinit();
+  virtual void reinit();
   virtual void update( double dt );
 
   static const int MAX_JOYSTICKS        = 10;