mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2025-04-06 12:24:23 -04:00
Fixing SDL char input.
This commit is contained in:
parent
088bd06b04
commit
6efb223b49
1 changed files with 1 additions and 16 deletions
|
@ -450,22 +450,7 @@ namespace entry
|
|||
{
|
||||
uint8_t modifiers = translateKeyModifiers(kev.keysym.mod);
|
||||
Key::Enum key = translateKey(kev.keysym.scancode);
|
||||
|
||||
const uint8_t shiftMask = Modifier::LeftShift|Modifier::RightShift;
|
||||
const bool nonShiftModifiers = (0 != (modifiers&(~shiftMask) ) );
|
||||
const bool isCharPressed = (Key::Key0 <= key && key <= Key::KeyZ) || (Key::Esc <= key && key <= Key::Minus);
|
||||
const bool isText = isCharPressed && !nonShiftModifiers;
|
||||
|
||||
if (isText)
|
||||
{
|
||||
uint8_t pressedChar[4];
|
||||
pressedChar[0] = keyToAscii(key, modifiers);
|
||||
m_eventQueue.postCharEvent(handle, 1, pressedChar);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_eventQueue.postKeyEvent(handle, key, modifiers, kev.state == SDL_PRESSED);
|
||||
}
|
||||
m_eventQueue.postKeyEvent(handle, key, modifiers, kev.state == SDL_PRESSED);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Add table
Reference in a new issue