Re: [AD] Various tangents to distinguishing keyboards |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
- To: allegro-developers@xxxxxxxxxxxxxxxxxx
- Subject: Re: [AD] Various tangents to distinguishing keyboards
- From: Edgar Reynaldo <edgarreynaldo@xxxxxxxxxxxxxxxxxx>
- Date: Thu, 28 Sep 2017 09:57:02 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=members-allegro-cc.20150623.gappssmtp.com; s=20150623; h=from:subject:to:references:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=wPv3+s3kei5q0SGJomGvM0mndvL8UUN1Ozzgh7SRIuM=; b=blZ6u5VksK/9ynr1ZeyYHYuX+3mkG7rH5xidTy9ed7xV/9hWCrf200N0OswSxXPuWZ WgqsPEK9bfcYVdE9Q5JZdP3kyaLlT54s1ZCeFFhTr28R09+3qCD4WKluD6/MfJ/lwVSy NP//NlMx4DW6tcYrVQ3quC8cUrkm/TPKdIIniqR8EkQ7t8juvvmHCSNW36V0USauk61Z 8t+IwEQNOV2malfw4TR6EkpRTLwKQePycJi9jMbyf9Mvv2PnUj5sX6RG9FkQMy23VZSX nCiHVN83hH/TWw8GVEdficTTmGx/0w1m9EOhC4MZohNG5MWfEOLvzMd7MemfBUllMX7N Mm7A==
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