aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRay <raysan5@gmail.com>2018-12-19 15:31:20 +0100
committerRay <raysan5@gmail.com>2018-12-19 15:31:20 +0100
commit49055a9b17f4b3818697995cb00a53d12916e60f (patch)
treeedfb962fe159f231c64eb487cce9c5b383ef0770 /src
parent66c360d385a92a1f3c4a1b6f7e51193e80ee5945 (diff)
downloadraylib-49055a9b17f4b3818697995cb00a53d12916e60f.tar.gz
raylib-49055a9b17f4b3818697995cb00a53d12916e60f.zip
Keep reviewing RPI keyboard input...
Diffstat (limited to 'src')
-rw-r--r--src/core.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/core.c b/src/core.c
index 2f1c961f..79404abe 100644
--- a/src/core.c
+++ b/src/core.c
@@ -3750,8 +3750,8 @@ static void InitKeyboard(void)
// Set new keyboard settings (change occurs immediately)
tcsetattr(STDIN_FILENO, TCSANOW, &keyboardNewSettings);
- // NOTE: Reading directly from stdin will give chars already key-mapped by kernel to ASCII or UNICODE, we change that! -> WHY???
-
+ // NOTE: Reading directly from stdin will give chars already key-mapped by kernel to ASCII or UNICODE
+
// Save old keyboard mode to restore it at the end
if (ioctl(STDIN_FILENO, KDGKBMODE, &defaultKeyboardMode) < 0)
{
@@ -3785,14 +3785,9 @@ static void ProcessKeyboard(void)
// Read availables keycodes from stdin
bufferByteCount = read(STDIN_FILENO, keysBuffer, MAX_KEYBUFFER_SIZE); // POSIX system call
- if (bufferByteCount > 0)
- {
- // Reset pressed keys array (it will be filled below)
- for (int i = 0; i < 512; i++) currentKeyState[i] = 0;
-
- // ISSUE: If pressed key is the same as previous one, currentKeyState is never reseted...
- }
-
+ // Reset pressed keys array (it will be filled below)
+ for (int i = 0; i < 512; i++) currentKeyState[i] = 0;
+
// Fill all read bytes (looking for keys)
for (int i = 0; i < bufferByteCount; i++)
{
@@ -3853,8 +3848,8 @@ static void ProcessKeyboard(void)
}
}
}
- else if (keysBuffer[i] == 0x0a) currentKeyState[257] = 1; // raylib KEY_ENTER (don't mix with <linux/input.h> KEY_*)
- else if (keysBuffer[i] == 0x7f) currentKeyState[259] = 1; // raylib KEY_BACKSPACE
+ else if (keysBuffer[i] == 0x0a) { lastKeyPressed = 257; currentKeyState[257] = 1; } // raylib KEY_ENTER (don't mix with <linux/input.h> KEY_*)
+ else if (keysBuffer[i] == 0x7f) { lastKeyPressed = 259; currentKeyState[259] = 1; } // raylib KEY_BACKSPACE
else
{
TraceLog(LOG_DEBUG, "Pressed key (ASCII): 0x%02x", keysBuffer[i]);