Re: [AD] Various tangents to distinguishing keyboards

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


Support for multiple keyboards or mice could be an interesting feature. I don't know however if it is even supported on the various platforms Allegro runs on. 

I would say the easier solution for you is to have your friends play on the same keyboard with different keys. Or teach them how to use joypads or joysticks. When they get used to joypads, they will find it is the more fun way of gaming.

If you really want to take on this feature, and all the work it entails, then I would say, you're welcome. Once you have some code, open a PR on github and we will guide you from there.

On 28 Sep 2017 03:13, "S. J. Dobrowolski" <stan423@xxxxxxxxx> 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.

Based solely on my glancing at Github Allegro 5 code, the Windows version seems to be using the "regular" window events for keyboard and/or mouse handling instead of "raw input". However there is a "raw input" handler in what looks like the window event queue handler; comment says it is unused though. It doesn't appear to handle anything but mouse events, and does not appear to try to distinguish the mice. The Linux version appears to be using evdev for mice and joysticks... well, the mouse init code made me rewrite this paragraph multiple times, is that supposed to be a "mixed" mouse or just a single one, and how do we know it's that early in the file system when joysticks need to check such a wider range? I guess I should install Linux and see for myself. Maybe no Linux Allegro users happened to be Linux Allegro laptop users who plugged in a regular mouse, maybe I'm missing something monumental about evdev.

So I guess I'm writing to you with following questions:

* Would you consider "multikeyboard" and "multimouse" add-ons to be added into the mainstream version of A5? Would real access to the feature (as opposed to an API wrapper) being limited to Win/Lin be a problem? Would you be concerned about this ending up being unmaintained?

* Does that sound like an overkill project for a team project beginner?

* Is no veteran maintainer doing something like this quietly at the moment?

* Can I assume that opening more evdev descriptors on Linux and doing stuff with them, as well as requesting both types of input events on Windows and then handling the new one has no good reason to break existing input framework?

* Can I just write what I want in Windows raw input handler and delete the code marked as dead, or is that there for a reason? Did someone try in the past to implement a raw input driver and ended up with loads of problems?

* What does Linux mouse driver init actually do?

* Is there anything that sounds like an obvious problem already?

Best regards,

Stan






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