]> git.mxchange.org Git - flightgear.git/blobdiff - src/Input/input.cxx
Declare fgReshape into gui.h
[flightgear.git] / src / Input / input.cxx
index 6f86ee0c4e2e5fe5d1de1ae89dcb2f9008c98119..a6c578e934a5150a8c3d0f3c9f00257d58968237 100644 (file)
@@ -61,9 +61,7 @@
 
 #include "input.hxx"
 
-#if !defined(SG_HAVE_NATIVE_SGI_COMPILERS)
 SG_USING_STD(ifstream);
-#endif
 SG_USING_STD(string);
 SG_USING_STD(vector);
 
@@ -115,13 +113,6 @@ FGBinding::read (const SGPropertyNode * node)
     return;
   }
 
-  _command = globals->get_commands()->getCommand(_command_name);
-  if (_command == 0) {
-    SG_LOG(SG_INPUT, SG_ALERT, "Command " << _command_name << " is undefined");
-    _arg = 0;
-    return;
-  }
-
   delete _arg;
   _arg = new SGPropertyNode;
   _setting = 0;
@@ -132,6 +123,8 @@ void
 FGBinding::fire () const
 {
   if (test()) {
+    if (_command == 0)
+      _command = globals->get_commands()->getCommand(_command_name);
     if (_command == 0) {
       SG_LOG(SG_INPUT, SG_WARN, "No command attached to binding");
     } else if (!(*_command)(_arg)) {
@@ -169,9 +162,6 @@ FGBinding::fire (double setting) const
 // Implementation of FGInput.
 ////////////////////////////////////////////////////////////////////////
 
-                                // From main.cxx
-extern void fgReshape( int width, int height );
-
 
 FGInput::FGInput ()
 {
@@ -201,24 +191,30 @@ FGInput::init ()
   glutPassiveMotionFunc (GLUTmotion);
 }
 
+void 
+FGInput::update (double dt)
+{
+  _update_keyboard();
+  _update_joystick();
+  _update_mouse();
+}
+
 void
-FGInput::bind ()
+FGInput::suspend ()
 {
-  // no op
+    // NO-OP
 }
 
 void
-FGInput::unbind ()
+FGInput::resume ()
 {
-  // no op
+    // NO-OP
 }
 
-void 
-FGInput::update (double dt)
+bool
+FGInput::is_suspended () const
 {
-  _update_keyboard();
-  _update_joystick();
-  _update_mouse();
+    return false;
 }
 
 void
@@ -317,36 +313,6 @@ FGInput::doKey (int k, int modifiers, int x, int y)
                     FGAutopilot::FG_TC_HEADING_LOCK );
             }
             return;
-        case 256+GLUT_KEY_F8: {// F8 toggles fog ... off fastest nicest...
-            const string &fog = fgGetString("/sim/rendering/fog");
-            if (fog == "disabled") {
-              fgSetString("/sim/rendering/fog", "fastest");
-              SG_LOG(SG_INPUT, SG_INFO, "Fog enabled, hint=fastest");
-            } else if (fog == "fastest") {
-              fgSetString("/sim/rendering/fog", "nicest");
-              SG_LOG(SG_INPUT, SG_INFO, "Fog enabled, hint=nicest");
-            } else if (fog == "nicest") {
-              fgSetString("/sim/rendering/fog", "disabled");
-              SG_LOG(SG_INPUT, SG_INFO, "Fog disabled");
-            } else {
-              fgSetString("/sim/rendering/fog", "disabled");
-              SG_LOG(SG_INPUT, SG_ALERT, "Unrecognized fog type "
-                     << fog << ", changed to 'disabled'");
-            }
-            return;
-        }
-        case 256+GLUT_KEY_F10: // F10 toggles menu on and off...
-            SG_LOG(SG_INPUT, SG_INFO, "Invoking call back function");
-            guiToggleMenu();
-            return;
-        case 256+GLUT_KEY_F11: // F11 Altitude Dialog.
-            SG_LOG(SG_INPUT, SG_INFO, "Invoking Altitude call back function");
-            NewAltitude( NULL );
-            return;
-        case 256+GLUT_KEY_F12: // F12 Heading Dialog...
-            SG_LOG(SG_INPUT, SG_INFO, "Invoking Heading call back function");
-            NewHeading( NULL );
-            return;
         }
 
 // END SPECIALS
@@ -372,9 +338,9 @@ FGInput::doMouseClick (int b, int updown, int x, int y)
   if (mode.pass_through) {
     if (puMouse(b, updown, x, y))
       return;
-    else if ((current_panel != 0) &&
-             current_panel->getVisibility() &&
-             current_panel->doMouseAction(b, updown, x, y))
+    else if ((globals->get_current_panel() != 0) &&
+             globals->get_current_panel()->getVisibility() &&
+             globals->get_current_panel()->doMouseAction(b, updown, x, y))
       return;
     else if (fgHandle3DPanelMouseEvent(b, updown, x, y))
       return;
@@ -490,7 +456,6 @@ FGInput::_init_joystick ()
       SG_LOG(SG_INPUT, SG_WARN, "Joystick " << i << " not found");
       continue;
     } else {
-#ifdef FG_PLIB_JOYSTICK_GETNAME
       bool found_js = false;
       const char * name = js->getName();
       SG_LOG(SG_INPUT, SG_INFO, "Looking for bindings for joystick \""
@@ -512,7 +477,6 @@ FGInput::_init_joystick ()
         if (found_js)
             break;
       }
-#endif
     }
 #ifdef WIN32
     JOYCAPS jsCaps ;