1
0
Fork 0

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.
This commit is contained in:
andy 2004-04-05 19:38:50 +00:00
parent 27290ab0ef
commit f46f962ca0
2 changed files with 32 additions and 24 deletions

View 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;
}
}

View 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
};