From 2fa083b9de790452538a3635b6d1f66d90f36b5c Mon Sep 17 00:00:00 2001 From: Alexander Buhl <63983202+Buhlean@users.noreply.github.com> Date: Sat, 12 Dec 2020 17:57:08 +0100 Subject: [PATCH] Fixed #1455 Fixed writing out of array bounds Adjusted FPS comment to match value Deleted unused function at the end, which has never been in use in the history of this file --- examples/text/text_input_box.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/examples/text/text_input_box.c b/examples/text/text_input_box.c index 174c38d6a..454903820 100644 --- a/examples/text/text_input_box.c +++ b/examples/text/text_input_box.c @@ -30,7 +30,7 @@ int main(void) int framesCounter = 0; - SetTargetFPS(10); // Set our game to run at 60 frames-per-second + SetTargetFPS(10); // Set our game to run at 10 frames-per-second //-------------------------------------------------------------------------------------- // Main game loop @@ -65,9 +65,8 @@ int main(void) if (IsKeyPressed(KEY_BACKSPACE)) { letterCount--; - name[letterCount] = '\0'; - if (letterCount < 0) letterCount = 0; + name[letterCount] = '\0'; } } else if (GetMouseCursor() != MOUSE_CURSOR_DEFAULT) SetMouseCursor(MOUSE_CURSOR_DEFAULT); @@ -113,15 +112,3 @@ int main(void) return 0; } - -// Check if any key is pressed -// NOTE: We limit keys check to keys between 32 (KEY_SPACE) and 126 -bool IsAnyKeyPressed() -{ - bool keyPressed = false; - int key = GetKeyPressed(); - - if ((key >= 32) && (key <= 126)) keyPressed = true; - - return keyPressed; -} \ No newline at end of file