-
Notifications
You must be signed in to change notification settings - Fork 1
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
Update set_timer patch #1
base: main
Are you sure you want to change the base?
Conversation
TODOs
|
@pmp-p Just for more context, I discovered the bug in my game because I use You can test my game if you want here: |
current implementation does not always handle event type correctly see #2 |
444f765
to
ae23564
Compare
"""Patches the pygame.time.set_timer function to use gthreads""" | ||
|
||
def patch_set_timer( | ||
event: Union[int, pygame.event.Event], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the args to match the pygame-ce api docs if that's okay with you @pmp-p 😄
@pmp-p I believe this is your last comment from discord:
I will see if I can replace the usage of |
@pmp-p I took a look at your Thread patch: and the ids are only assigned in the The current implementation of the coroutine target function needs the id to be passed in as the parameter. The global So if the assignment of the ids was moved to the constructor, I could do something like this: thread = Thread(target=fire_event)
thread.args = thread.native_id
THREADS[event_type] = thread.native_id
thread.start() I did notice you have a TODO here: Is the goal to get access to the thread instance in the target coroutine? Then I could access the native_id. |
This is a follow up to pygame-web/pygbag#16
Summary of changes
millis
is0
loops
handlingset_timer
is called multiple timesReference:
https://pyga.me/docs/ref/time.html#pygame.time.set_timer
Not Implemented
when
event
param is an object