René Dudfield <renesd@xxxxxxxxx> suggested:
For pygame integration posting events into the event queue would be a
good idea ( pygame.event.post ). Maybe run in another thread, or
polled at the required frequency with pygame.time.set_timer ?
I'd suggest not creating another thread if we don't absolutely need to.
Does anyone know how the mouse works in Pygame? how is it polled? I'd think the wiimote should be done in a similar manner.
Yes, I believe so.Would it be possible to query the result of the overlapped IO as part of the pygame.event.pump / pygame.event.get calls?
The game is going to be
calling those already.
We'll see, I guess. It makes sense that a consistent frequency would be ideal, but from what I can tell,Some reasons why that might not work:
- I recall reading in the code that some of the accelerometer calculations
work best if the device is polled with inconsistent frequency. I don't
know how big a problem that is in practice.
- The bluetooth library code might want to be called more frequently thanI don't know why it would care... my code has nothing to do with bluetooth. As far as it's concerned, the Wiimotes could be USB HID devices.
once per (graphics) frame.
Are you assuming that the user calls pump, or does pygame have some internal thread that consistently calls pump?
I haven't dug around very much inside the code, so I don't know how it looks in there, but it seems like the pygame.event.pump code is already doing periodic input work,