mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-24 16:48:18 -05:00
input: Added ability to retrieve modifiers state.
This commit is contained in:
parent
3813b28e9b
commit
58fae36870
2 changed files with 18 additions and 0 deletions
|
@ -109,6 +109,16 @@ struct Keyboard
|
|||
return decodeKeyState(m_key[_key], *_modifiers);
|
||||
}
|
||||
|
||||
uint8_t getModifiersState()
|
||||
{
|
||||
uint8_t modifiers = 0;
|
||||
for (uint32_t ii = 0; ii < entry::Key::Count; ++ii)
|
||||
{
|
||||
modifiers |= (m_key[ii]>>16)&0xff;
|
||||
}
|
||||
return modifiers;
|
||||
}
|
||||
|
||||
void pushChar(uint8_t _len, const uint8_t _char[4])
|
||||
{
|
||||
for (uint32_t len = m_ring.reserve(4)
|
||||
|
@ -314,6 +324,11 @@ bool inputGetKeyState(entry::Key::Enum _key, uint8_t* _modifiers)
|
|||
return s_input->m_keyboard.getKeyState(_key, _modifiers);
|
||||
}
|
||||
|
||||
uint8_t inputGetModifiersState()
|
||||
{
|
||||
return s_input->m_keyboard.getModifiersState();
|
||||
}
|
||||
|
||||
void inputChar(uint8_t _len, const uint8_t _char[4])
|
||||
{
|
||||
s_input->m_keyboard.pushChar(_len, _char);
|
||||
|
|
|
@ -42,6 +42,9 @@ void inputSetKeyState(entry::Key::Enum _key, uint8_t _modifiers, bool _down);
|
|||
///
|
||||
bool inputGetKeyState(entry::Key::Enum _key, uint8_t* _modifiers = NULL);
|
||||
|
||||
///
|
||||
uint8_t inputGetModifiersState();
|
||||
|
||||
/// Adds single UTF-8 encoded character into input buffer.
|
||||
void inputChar(uint8_t _len, const uint8_t _char[4]);
|
||||
|
||||
|
|
Loading…
Reference in a new issue