]> git.mxchange.org Git - flightgear.git/commitdiff
make modifier keys accessible via /devices/status/keyboard/{shift,ctrl,alt}
authormfranz <mfranz>
Mon, 5 Jun 2006 13:45:59 +0000 (13:45 +0000)
committermfranz <mfranz>
Mon, 5 Jun 2006 13:45:59 +0000 (13:45 +0000)
src/Input/input.cxx

index be5d83071db9176adb0394c18a2eed6e33098be2..db9ad7562230646bdae6731d44185e54cbe3437d 100644 (file)
@@ -77,6 +77,28 @@ void keyHandler(int key, int keymod, int mousex, int mousey);
 
 static FGInput * default_input = 0;
 
+\f
+////////////////////////////////////////////////////////////////////////
+// Local functions.
+////////////////////////////////////////////////////////////////////////
+
+static bool
+getModShift ()
+{
+  return bool(fgGetKeyModifiers() & KEYMOD_SHIFT);
+}
+
+static bool
+getModCtrl ()
+{
+  return bool(fgGetKeyModifiers() & KEYMOD_CTRL);
+}
+
+static bool
+getModAlt ()
+{
+  return bool(fgGetKeyModifiers() & KEYMOD_ALT);
+}
 
 \f
 ////////////////////////////////////////////////////////////////////////
@@ -201,6 +223,22 @@ FGInput::postinit ()
   _postinit_joystick();
 }
 
+void
+FGInput::bind ()
+{
+  fgTie("/devices/status/keyboard/shift", getModShift);
+  fgTie("/devices/status/keyboard/ctrl", getModCtrl);
+  fgTie("/devices/status/keyboard/alt", getModAlt);
+}
+
+void
+FGInput::unbind ()
+{
+  fgUntie("/devices/status/keyboard/shift");
+  fgUntie("/devices/status/keyboard/ctrl");
+  fgUntie("/devices/status/keyboard/alt");
+}
+
 void 
 FGInput::update (double dt)
 {