1
0
Fork 0

make modifier keys accessible via /devices/status/keyboard/{shift,ctrl,alt}

This commit is contained in:
mfranz 2006-06-05 13:45:59 +00:00
parent 6cc4cbd696
commit b2d2ec2e16

View file

@ -77,6 +77,28 @@ void keyHandler(int key, int keymod, int mousex, int mousey);
static FGInput * default_input = 0;
////////////////////////////////////////////////////////////////////////
// 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);
}
////////////////////////////////////////////////////////////////////////
@ -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)
{