[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Multiple Mice



Ignoring python & pygame for a moment, all the major popular platforms
have a way to use multiple USB mice

Windows XP & Vista support multiple mice through the WM_INPUT
messages, which come to an app if it calls "RegisterRawInput"
http://msdn2.microsoft.com/en-us/library/ms645590.aspx
http://msdn2.microsoft.com/en-us/library/ms645600.aspx

Mac OSX supports multiple mice through IOKit's Human Interface Device
(HID) api (HID is basically a USB class interface thing)
http://developer.apple.com/documentation/DeviceDrivers/Conceptual/IOKitFundamentals/Families_Ref/chapter_11_section_7.html

I don't know the details of Linux, evidently it's the "evdev"
interface, or I guess MPX must be some X-Windows way of doing it?

There is an old c++ project called manymouse that was made to be cross-platform:
http://icculus.org/manymouse/

also note that none of the multiple mouse approaches I mentioned
actually have multiple mouse cursors at the OS level - they just let
you get raw data from multiple mice. So OS cursor acceleration isn't
used, and you also would want to disable the OS cursor and lock it to
your app's window when your app is in some multiple mice mode.

---
addressing multiple mice in python pygame... I don't know how to do
that (but I'd like to). I suppose somebody could make a manymouse
binding, which seems like it could work fine for Lnux and Mac OSX -
except on windows, the app gets the raw input data through it's
message loop, which sdl owns in pygame, so you'd have to somehow keep
SDL from eating those events.

However, you might be able to tell sdl to let WM_INPUT passthrough to
your app with pygame.event.set_allowed. Then maybe some ctypes type
things could let call RegisterRawInputDevices and GetRawInputData.
Which should all be pretty easy.

If you are able to somehow get te multiple mice data in pygame, then
pygame can take care of locking the system cursor and hiding it fairly well

---
btw, If anybody has any success with this kind of stuff through python
and/or pygame, I'd be delighted to hear about exactly how they did
things


On 7/17/07, Ian Mallett <geometrian@xxxxxxxxx> wrote:
Hi,
I'm trying to make a two player game, and I'm wondering if there is a way to
use the input from two mice simultaneously.  As far as I can tell, the
answer is no, as the computer already seems to merge two inputs.  Anyway, I
thought I would ask in case anyone knows how to do it.  Thanks!
Ian