Re: [AD] Various tangents to distinguishing keyboards

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]




On 9/27/2017 5:55 PM, S. J. Dobrowolski wrote:
Grettings, everyone.

Apologies if this is the wrong channel but it relates to source code of Allegro so I couldn't come up with anything more appropriate. (Also, please excuse any English errors.) I was considering modifying A5 for multiple mice and keyboards event input support - while distinguishing these devices, for clarity. Rationale: some of my friends and me don't like gamepads that much, but like the idea of local play with separate controllers. As a sidenote, I guess I'm more familiar with using A4, but my prototypes could use a rewrite, even if it means coding from scratch where I have used A4 bitmaps for game logic.

Based solely on web searches, on Windows, it appears some sort of hardware ID is part of "raw input" API event. On Linux, it appears that evdev API allows you to distinguish connected devices, but I'm not sure how that is supposed to cooperate with various layers of user protection and desktop stack. On MacOS... I frankly couldn't find good information. I don't have a Mac anyway, so trusting my Mac code even in the slightest would be a huge mistake.


You are correct, on Windows the key is to use the RawInput API from Win32.

I have some experience with this subject, as I wrote a Multi Mouse software interface library and program called ManyMouse. I spent an entire summer doing this as my research project. You can see the current state of the program on Github here :

https://github.com/EdgarReynaldo/ManyMouse

The file you will find most interesting is RawInputHandler.cpp, here : https://github.com/EdgarReynaldo/ManyMouse/blob/master/src/RawInputHandler.cpp

The biggest problem with this project is interacting with the OS. It's easy to monitor HID devices and multiple mouse input. The problem comes when you want them to act like mice cursors. You have to create your own window for the mouse icon, you have to make it transparent, and the hard part is taking mouse input and making it into window actions.

I abandoned this project a while back, and I've been busy with other things. You're welcome to look at the source code and ask questions, but this is still a big project for a novice to take on. Windows OS just does not support multiple mice cursors, period. You have to emulate every little thing they do, like sending mouse pressses to the correct window, and that means you have to read the windows on the desktop, and that means a ton of os and system windows and tons of nested child windows and controls and it is a nightmare. That's why I abandoned this project.

I would have to separate out and rewrite pretty much everything for it to be usable by allegro and integrate it with the library.

My 2c

Edgar






















Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/