-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[rcore] IsKeyPressed()
missing quick inputs
#4591
Comments
Sorry I didn't see that when searching // config.h
#define TAP_CODE_DELAY 20 However, I confirmed that setting that delay to lower values could still cause missed inputs. Framerate shouldn't determine whether Raylib can see input. This won't just be a problem for QMK/ZMK. Razer, Corsair, Wooting, and more are increasingly creating features which allow users to input some incredibly quick key presses. If they happen to release their key immediately after it triggers, Raylib will miss their input (although this can happen with a normal keyboard too, it's just easier with features like this). FPS drops also cause input drops, regardless of keyboard. For now, I'll use GetKeyPressed to avoid inconsistencies. |
Regardless, an input shouldn't be dropped because of lower FPS, and an input shouldn't be dropped because someone tapped a key quickly. While typing on a normal keyboard I registered keypresses that only lasted 10-20ms. This can be dropped even at 60 FPS. |
I've been messing with GLFW and SDL2 and neither have issue seeing the press/release events. The function here will trigger on both PRESS and RELEASE: bool IsKeyPressed(int key)
{
if ((key > 0) && (key < MAX_KEYBOARD_KEYS))
{
for (int i = 0; i < CORE.Input.Keyboard.keyPressedQueueCount; i++)
{
if (CORE.Input.Keyboard.keyPressedQueue[i] == key)
{
return true;
}
}
}
return false;
} |
IsKeyPressed()
missing quick inputs
If |
Do you mean |
I meant |
I suppose SDL users have dealt with this just fine? If they get a press and release in the same frame, then the event queue will have both of them in there, so the game would handle the down event and then the up event. For raylib, you'd just have to make sure your logic for handling down comes before up, and make sure they aren't exclusive.
|
Yeah, that's all fine, I'm just saying some people might not expect that. |
would it be that bad if this got applied cause I noticed indeed similar issues as OP, or rather not issue but a feature I would like to work as he described aswell tbh. |
For me, IsKeyPressed fails to see a press if the release happens immediately afterwards.
My keyboard firmware sends some keys as:
with no delay between them by default. Raylib doesn't see these presses (unless I double tap the key or increase the firmware's tap delay). I know this is because of my keyboard firmware, but the key has been pressed, so Raylib should still see it. Other applications/games don't have issues with this, and qmk is a very popular firmware, so more people will run into this issue in the future.
The text was updated successfully, but these errors were encountered: