-
-
Notifications
You must be signed in to change notification settings - Fork 34
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
pygame.time.set_timer not working properly #16
Comments
maybe it's an error in the timing calculation, iirc cpython had to change the time function for wasm to function properly. maybe sdl2 still use the wrong one. would need to see the time delta beetween firing event : is it always next frame (~ 1.0/60) or some bad timing value ? i'll get to investigate after fixing sdl_image. if it is not fixable at C level , would a python workaround (aio can inject event in pygame queue) be ok for typical usage ? |
If not fixable at C level, then seemingly having at least a Python implementation would be better than nothing so I guess yes, it would be ok for typical usage. In case it wouldn't be as efficient as manual timing (can't see how that could really happen), then that should be noted somewhere to inform users that manual timing may be preferred over |
simplest way i've found is by using green threads https://gist.github.com/pmp-p/fb25df0c8beb84d5c771c1875d7594bd |
patch applied https://github.com/pygame-web/python-wasm-plus/blob/8d8d1154edef66667449e42263026057074bffa9/support/__EMSCRIPTEN__.overlay/pygame/wasm_patches.py#L11 |
apparently it's working fine. |
It doesn't seem to actually do any delaying (probably because usage of threads?), it apparently posts those events almost immediately, here you can see how that looks like visually (possible epilepsy warning!!!): https://matiiss.github.io/wasm_test/ and here is the source:
The text was updated successfully, but these errors were encountered: