Corrected issue #1203
This commit is contained in:
parent
8e59ecb50c
commit
72cc3e0530
1 changed files with 5 additions and 14 deletions
19
src/core.c
19
src/core.c
|
@ -5076,20 +5076,11 @@ static void *EventThread(void *arg)
|
|||
// Make sure we got a valid keycode
|
||||
if ((keycode > 0) && (keycode < sizeof(CORE.Input.Keyboard.currentKeyState)))
|
||||
{
|
||||
/* Disabled buffer !!
|
||||
// Store the key information for raylib to later use
|
||||
CORE.Input.Keyboard.currentKeyState[keycode] = event.value;
|
||||
if (event.value > 0)
|
||||
{
|
||||
// Add the key int the fifo
|
||||
CORE.Input.Keyboard.lastKeyPressed.contents[CORE.Input.Keyboard.lastKeyPressed.head] = keycode; // Put the data at the front of the fifo snake
|
||||
CORE.Input.Keyboard.lastKeyPressed.head = (CORE.Input.Keyboard.lastKeyPressed.head + 1) & 0x07; // Increment the head pointer forwards and binary wraparound after 7 (fifo is 8 elements long)
|
||||
// TODO: This fifo is not fully threadsafe with multiple writers, so multiple keyboards hitting a key at the exact same time could miss a key (double write to head before it was incremented)
|
||||
}
|
||||
*/
|
||||
|
||||
CORE.Input.Keyboard.currentKeyState[keycode] = event.value;
|
||||
if (event.value == 1)
|
||||
// WARNING: https://www.kernel.org/doc/Documentation/input/input.txt
|
||||
// Event interface: 'value' is the value the event carries. Either a relative change for EV_REL,
|
||||
// absolute new value for EV_ABS (joysticks ...), or 0 for EV_KEY for release, 1 for keypress and 2 for autorepeat
|
||||
CORE.Input.Keyboard.currentKeyState[keycode] = (event.value >= 1)? 1 : 0;
|
||||
if (event.value >= 1)
|
||||
{
|
||||
CORE.Input.Keyboard.keyPressedQueue[CORE.Input.Keyboard.keyPressedQueueCount] = keycode; // Register last key pressed
|
||||
CORE.Input.Keyboard.keyPressedQueueCount++;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue