]> git.mxchange.org Git - flightgear.git/commitdiff
Revert the hard-coded keybindings I just replaced, and turn them into real
authorandy <andy>
Mon, 5 Apr 2004 19:38:50 +0000 (19:38 +0000)
committerandy <andy>
Mon, 5 Apr 2004 19:38:50 +0000 (19:38 +0000)
command bindings accessible from XML.  This still probably isn't a final
solution (which would drive the HUD from propery values), but it's a step
in the right direction anyway.

src/Input/input.cxx
src/Main/fg_commands.cxx

index 757a6148e3f915897654321e886198f882cdf8a7..4a4853def30373a4f4b219ad5f86b7c61d9bbd11 100644 (file)
@@ -240,7 +240,6 @@ FGInput::doKey (int k, int modifiers, int x, int y)
       }
     }
   }
-
                                 // Key released.
   else {
     SG_LOG(SG_INPUT, SG_DEBUG, "User released key " << k
@@ -255,29 +254,6 @@ FGInput::doKey (int k, int modifiers, int x, int y)
         return;
       }
     }
-  }
-                                // Use the old, default actions.
-  SG_LOG( SG_INPUT, SG_DEBUG, "(No user binding.)" );
-
-  if (modifiers & KEYMOD_RELEASED)
-    return;
-  
-  // Hard-coded legacy key handlers.
-  // These need to be turned into FGCommand bindings and mapped via
-  // the input configuration...
-  switch (k) {
-  case 'H':
-    HUD_brightkey( true );
-    break;
-  case 'h':
-    HUD_masterswitch( true );
-    break;
-  case 'I':
-    fgHUDInit2(&current_aircraft); // Minimal Hud
-    break;
-  case 'i':
-    fgHUDInit(&current_aircraft);  // normal HUD
-    break;
   }
 }
 
index 6a6ba0b36bcefe10cd378b078673807975c381b4..ca3171f8b2ae84618972fddb4f262d3257e54a32 100644 (file)
@@ -16,6 +16,7 @@
 
 #include <Cockpit/panel.hxx>
 #include <Cockpit/panel_io.hxx>
+#include <Cockpit/hud.hxx>
 #include <Environment/environment.hxx>
 #include <FDM/flight.hxx>
 #include <GUI/gui.h>
@@ -1184,6 +1185,33 @@ do_increase_visibility (const SGPropertyNode * arg)
     return true;
 }
 
+static bool
+do_hud_brightkey(const SGPropertyNode *)
+{
+    HUD_brightkey( true );
+    return true;
+}
+
+static bool
+do_hud_masterswitch(const SGPropertyNode *)
+{
+    HUD_masterswitch( true );
+    return true;
+}
+
+static bool
+do_hud_init(const SGPropertyNode *)
+{
+    fgHUDInit(0); // minimal HUD
+    return true;
+}
+
+static bool
+do_hud_init2(const SGPropertyNode *)
+{
+    fgHUDInit2(0);  // normal HUD
+    return true;
+}
 
 ////////////////////////////////////////////////////////////////////////
 // Command setup.
@@ -1242,6 +1270,10 @@ static struct {
     { "replay", do_replay },
     { "decrease-visibility", do_decrease_visibility },
     { "increase-visibility", do_increase_visibility },
+    { "hud-brightkey", do_hud_brightkey },
+    { "hud-masterswitch", do_hud_masterswitch },
+    { "hud-init", do_hud_init },
+    { "hud-init2", do_hud_init2 },
     { 0, 0 }                   // zero-terminated
 };