From: andy Date: Mon, 5 Apr 2004 19:38:50 +0000 (+0000) Subject: Revert the hard-coded keybindings I just replaced, and turn them into real X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=f46f962ca09ab7cbda1335b61378215e6c61e3df;p=flightgear.git Revert the hard-coded keybindings I just replaced, and turn them into real 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. --- diff --git a/src/Input/input.cxx b/src/Input/input.cxx index 757a6148e..4a4853def 100644 --- a/src/Input/input.cxx +++ b/src/Input/input.cxx @@ -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(¤t_aircraft); // Minimal Hud - break; - case 'i': - fgHUDInit(¤t_aircraft); // normal HUD - break; } } diff --git a/src/Main/fg_commands.cxx b/src/Main/fg_commands.cxx index 6a6ba0b36..ca3171f8b 100644 --- a/src/Main/fg_commands.cxx +++ b/src/Main/fg_commands.cxx @@ -16,6 +16,7 @@ #include #include +#include #include #include #include @@ -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 };