Cheezmeister
|
|
« on: March 29, 2015, 09:44:49 PM » |
|
Has anybody been able to successfully grab input from more than one connected mouse? Being able to distinguish one from the other, of course, I mean.
I've googled around but most of the results are for wonky OS addons that put multiple pointers on the screen, whereas what I want is to control one game with two different mice.
I'm not afraid to get down and dirty with device APIs, but I'm not sure where to get started with that...and I'd prefer to stay cross-platform.
Halp?
|
|
|
Logged
|
|
|
|
oahda
|
|
« Reply #1 on: March 30, 2015, 01:12:35 AM » |
|
I can't answer your question, but I'd be really interested in knowing why you'd want to do this, if you'd be willing to tell.
|
|
|
Logged
|
|
|
|
Cheezmeister
|
|
« Reply #2 on: March 30, 2015, 02:11:27 AM » |
|
Can't talk about it, it's part of my top-secret scheme to world domination. Uh, pretty simple, I want to use it as a control scheme for Vec. One mouse for crosshair, the other for moving around it in polar space. Degrades nicely to dual-stick gamepad controls (though mouse is richer and more precise than a stick), or mouse/WASD if we must. Beyond that, it seems like a relatively unexplored area (as evidenced by the wholesale lack of prior art) with some potential for novel gameplay. Plus, I've always had a soft spot for symmetry. There's some promising links at http://gamedev.stackexchange.com/questions/24046/is-it-possible-to-detect-two-different-mice-at-the-same-time-and-have-their-mov
|
|
|
Logged
|
|
|
|
|
zacaj
|
|
« Reply #4 on: March 30, 2015, 03:53:37 AM » |
|
When I tried to find ways to do this, ManyMouse was the only library that turned up.
|
|
|
Logged
|
My twitter: @zacaj_Well let's just take a look at this "getting started" page and see-- Download and install cmake
Noooooooo
|
|
|
Schrompf
|
|
« Reply #5 on: March 30, 2015, 05:21:21 AM » |
|
Freshly founded today because I was fed up with OIS: https://github.com/Schrompf/sniisSimple Non-Intrusive Input System - does not take over your main message loop, is able to handle multiple mice and keyboards, also provides input event bindings, key repetition, OS-provided names for controls. It's based on the aforementioned Object-Oriented Input System, which I needed to extend a lot in previous times. Then, while porting my game to Linux/Mac, I realized that on Linux it fights with the XPending() message loop in the Window framework I'm using (GLFW). I was always annoyed by its weird backwards FactoryAdapterBullshitPattern approach to things, but this really pushed me over the line. I ditched it completely and am now building an alternative that is hopefully 1) more useful 2) less intrusive and 3) easily built and changed. No documentation, yet. And it's still very early - currently it's only on Windows, I'm writing the Linux part just now. But if you want to try it, I'd guide you through it. Gotta need some testers anyways. Oh, and given the signature of zacaj above: it does not use CMake. Details: on Windows, multiple mice and keyboards are only possible with either RawInput or direct USB HID interaction (which is what RawInput does under the hood, I suppose). On Linux/Mac, I think it's not possible, because games like Trine do support multiple Mice/Keyboards only on Windows. But I *think* it might be possible when going the direct USB HID route like stated above. Haven't tried it, though, and given the Linux gaming market share, I probably never will.
|
|
« Last Edit: March 30, 2015, 05:28:37 AM by Schrompf »
|
Logged
|
Snake World, multiplayer worm eats stuff and grows DevLog
|
|
|
Cheezmeister
|
|
« Reply #6 on: March 30, 2015, 12:14:35 PM » |
|
Wow, that's....pretty much exactly, precisely what I need. What exactly was your search term? Teach me, sensei, for my google-fu is lacking. Schrompf, it sounds like you'd enjoy the WTFPL. And yeah, I really need to find some time to get up to speed with gyp/ninja. I don't see CMake going anywhere but downhill, unfortunately.
|
|
|
Logged
|
|
|
|
jgrams
|
|
« Reply #7 on: March 31, 2015, 07:30:12 AM » |
|
On Linux/Mac, I think it's not possible, because games like Trine do support multiple Mice/Keyboards only on Windows. But I *think* it might be possible when going the direct USB HID route like stated above. Haven't tried it, though, and given the Linux gaming market share, I probably never will.
In theory it should be possible on Linux, but in practice...it might require manual configuration on the part of the user? I messed with it a decade or so ago, but don't remember any of the details. Plus I know it has changed in that time. The Linux kernel has long supported access to multiple mice, e.g. /dev/input/mice gives you the sum of all of them, and /dev/input/mouse0 mouse1 mouse2 etc. for access to individual ones. Multi-Pointer X has been around for a while as well, but I think you have to manually configure mice to give separate pointers, otherwise I don't know that it lets you distinguish them. So...there's my bit of half-baked useless trivia for the day...
|
|
|
Logged
|
|
|
|
rosholger
Level 1
|
|
« Reply #8 on: March 31, 2015, 08:20:47 AM » |
|
Wow, that's....pretty much exactly, precisely what I need. What exactly was your search term? Teach me, sensei, for my google-fu is lacking. Schrompf, it sounds like you'd enjoy the WTFPL. And yeah, I really need to find some time to get up to speed with gyp/ninja. I don't see CMake going anywhere but downhill, unfortunately. haha the search term was 'sdl multiple mice', which led to a forum post where that was referenced.
|
|
|
Logged
|
|
|
|
Cheezmeister
|
|
« Reply #9 on: March 31, 2015, 05:59:44 PM » |
|
In theory it should be possible on Linux, but in practice...it might require manual configuration on the part of the user
You just described trying to do anything in Linux :D
|
|
|
Logged
|
|
|
|
ThemsAllTook
|
|
« Reply #10 on: March 31, 2015, 06:14:49 PM » |
|
It's definitely possible on OS X. A friend of mine once wrote a dual mouse drawing program that was pretty neat. Not sure if you have to drop down to the level of IOKit or IOHIDManager to make it work, but at some level the APIs exist to do the job.
|
|
|
Logged
|
|
|
|
Cheezmeister
|
|
« Reply #11 on: March 31, 2015, 07:30:18 PM » |
|
Yeah, it looks like Icculus has it covered for all three platforms, for ten years already. Not only that, but You don't have to build this as a shared library; we encourage you to just compile the source and statically link them into your application...this makes integrating ManyMouse much less complex.
Sage advice!
|
|
|
Logged
|
|
|
|
Schrompf
|
|
« Reply #12 on: April 01, 2015, 03:47:18 AM » |
|
Yes. I made some progress yesterday, currently it looks like the input subsystem already supports multiple mice easily - the XServer, of course, does not.
I didn't know ManyMouse, but I'll keep it bookmarked for inspiration.
|
|
|
Logged
|
Snake World, multiplayer worm eats stuff and grows DevLog
|
|
|
Cheezmeister
|
|
« Reply #13 on: April 01, 2015, 02:34:34 PM » |
|
I would definitely do that. I'm browsing ManyMouse source as I integrate it, and it's really quite a fine example of how to neatly expose an API without letting the details of multiple implemenations (there are five) leak into it. Super clean, clearly annotated code. Of course, it's anything but object-oriented Unfortunately the one thing that really needed documentation, the event struct, has none at all. (Actually, the whole API has no direct doc, but e.g. ManyMouse_Quit" is kinda self-explanatory.) From what I can tell based on the examples, the `item` field is 0 or 1 depending on x or y axis (and meaningless for non-motion events), the `value` field is some arbitrary int bounded by `minval` and `maxval`, and you may get notified of either absolute or relative motion, or both, depending on the available implementation.
|
|
|
Logged
|
|
|
|
Schrompf
|
|
« Reply #14 on: April 01, 2015, 10:30:05 PM » |
|
From what I see here, you always get relative movements, as in: diff positions only.
And yeah, Linux at its best again: they design an interface to any generic input device. Of course because of Linux they implement it as block devices mapped to the file system. Then, only a few years later, they realize that *everyone* can now read mouse and keyboard events, so a background keylogger could easily spy on your credentials. So they make it root. And thus the whole input API is useless.
Except Joysticks, Gamepads and such. Currently those are bound with R/W access for normal users. Forward halve a year and some smart guy will notice that in SteamOS you enter credit card data and passwords with your controller. Then they'll make everything else root only, too.
Linux. I'm not able to express my feelings towards it anymore. Not in English.
XInput2 to the rescue. It's XServer again, so it's bound to a display, so it's usable without admin privileges.
|
|
|
Logged
|
Snake World, multiplayer worm eats stuff and grows DevLog
|
|
|
pelle
|
|
« Reply #15 on: April 02, 2015, 01:30:17 AM » |
|
Settlers 1 in msdos supported multiple mice for local multiplayer. You just had to tell it what serial ports to use. Only PC game I remember having that, so no idea if it was supported somehow in the OS or they had to go lowlevel (guess the latter).
|
|
|
Logged
|
|
|
|
|
oahda
|
|
« Reply #17 on: April 02, 2015, 01:58:59 AM » |
|
because gamepad >>>> mouse/mice anyway
|
|
|
Logged
|
|
|
|
ThemsAllTook
|
|
« Reply #18 on: April 02, 2015, 10:33:46 AM » |
|
because gamepad >>>> mouse/mice anyway
For pointing at lemmings? There are a lot of things gamepads do better, but this doesn't sound like one of them.
|
|
|
Logged
|
|
|
|
oahda
|
|
« Reply #19 on: April 02, 2015, 10:38:33 AM » |
|
because gamepad >>>> mouse/mice anyway
For pointing at lemmings? There are a lot of things gamepads do better, but this doesn't sound like one of them. I'm just throwing around the same crap as always; I just don't like FPS games or mouse/keyboard controllers at all. c; Sorry, I'll stop shitting in threads now.
|
|
|
Logged
|
|
|
|
|