WARNING: GetKeyPressed() <-> GetCharPressed() #1336

Previous GetKeyPressed() method was actually returning unicode codepoints equivalent values instead of the key-code of the pressed key. So, it has been replaced by GetCharPressed(), returning unicode codepoints and GetKeyPressed() now returns key-codes.
This commit is contained in:
Ray 2020-12-18 18:58:02 +01:00
parent 893a64712e
commit 96542269d0
3 changed files with 141 additions and 90 deletions

View file

@ -2,7 +2,7 @@
*
* raylib [text] example - Input Box
*
* This example has been created using raylib 1.7 (www.raylib.com)
* This example has been created using raylib 3.5 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*
* Copyright (c) 2017 Ramon Santamaria (@raysan5)
@ -46,8 +46,8 @@ int main(void)
// Set the window's cursor to the I-Beam
SetMouseCursor(MOUSE_CURSOR_IBEAM);
// Get pressed key (character) on the queue
int key = GetKeyPressed();
// Get char pressed (unicode character) on the queue
int key = GetCharPressed();
// Check if more characters have been pressed on the same frame
while (key > 0)
@ -59,7 +59,7 @@ int main(void)
letterCount++;
}
key = GetKeyPressed(); // Check next character in the queue
key = GetCharPressed(); // Check next character in the queue
}
if (IsKeyPressed(KEY_BACKSPACE))