-
Notifications
You must be signed in to change notification settings - Fork 23
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
Changing the polling rate of hardware inputs #26
Comments
So the polling for events occurs inbetween frames (SDL2 queues them up). So if you find inputs are slow, it's likely only because your frame takes too long to render or update. All the logic for the polling is in the mainloop function: https://github.com/aviks/GameZero.jl/blob/master/src/GameZero.jl#L79 |
Thanks for the info, my problem is that my keyboard/mouse events are executing too fast (a good problem to have!) and resolving several commands before the key is released--even on a very short tap. Looking at the code, I could modify handleEvents! to perhaps accept and return the timer and check the elapsed duration before continuing the loop, but would that slow down the whole game? |
After reviewing my code, I've decided that changing the polling rate isn't a good way to solve my problem. Instead, I've changed from executing functions directly via mouse/keyboard inputs to switching flags on/off and letting the game engine execute the functions based on those flags to control actor animation, destruction, etc. |
Hi all, is there a way to change the polling rate of the mouse/keyboard inputs? I tried looking in
event.jl
, but I'm not too familiar with how events are scheduled...The text was updated successfully, but these errors were encountered: