make modifier keys accessible via /devices/status/keyboard/{shift,ctrl,alt}
This commit is contained in:
parent
6cc4cbd696
commit
b2d2ec2e16
1 changed files with 38 additions and 0 deletions
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue