I understand that this is very likely unable to be done, however I thought I'd ask:
If I have two keyboards plugged into my computer, would it be possible to differentiate a keypress on one keyboard from that of another? I was hoping to use this to allow people to do a quick cheap workaround for multiplayer if they don't have two controllers but have a keyboard lying around. Presently I can do this as is so long as they keybindings don't overlap, but I was wondering if there was another way.
Thanks a million all
Detect Multiple Keyboards?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- zorg
- Party member
- Posts: 3441
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: Detect Multiple Keyboards?
Windows itself is able to differentiate between multiple mouses and multiple keyboards.dizzykiwi3 wrote: ↑Wed Apr 19, 2017 4:18 am I understand that this is very likely unable to be done, however I thought I'd ask:
If I have two keyboards plugged into my computer, would it be possible to differentiate a keypress on one keyboard from that of another? I was hoping to use this to allow people to do a quick cheap workaround for multiplayer if they don't have two controllers but have a keyboard lying around. Presently I can do this as is so long as they keybindings don't overlap, but I was wondering if there was another way.
Thanks a million all
Don't know about OS X or the many Linuces though.
And as far as i know, SDL (sadly) doesn't expose this kind of information, probably because either it can't be coded to function on all platforms, or that no one wanted to hassle with it; in other words, since SDL doesn't support it, löve can't do it either.
(But, if you're willing to mess with the FFI, then maybe, just maybe, depending on the OS, you might find ways to accomplish this -in paralell- to löve's own keyboard (and mouse) methods that go through the SDL, so making it interoperate will be another hassle...)
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
- dizzykiwi3
- Citizen
- Posts: 58
- Joined: Tue Jan 14, 2014 2:03 am
Re: Detect Multiple Keyboards?
Gotcha gotcha... I figured as much, thanks for sincerely indulging me in this speculation though haha
Re: Detect Multiple Keyboards?
What is the use case of multiple keyboards anyway? Can you, like, have two windows opened at one time and use keyboard A to type in window A and keyboard B to type in window B, without switching focus?
Re: Detect Multiple Keyboards?
In split screen or by games with more than player on screen you can have multiple players using his own keyboard. Maybe he has an game where players compete against each other simultaneously by entering text or something.
Re: Detect Multiple Keyboards?
Yes I can see that, I meant the OS support. If OS doesn't naturally support multiple keyboards, people wouldn't use more than one. Expecting people to use input mode more obscure than those 2000's 3d controllers is wishful.
- zorg
- Party member
- Posts: 3441
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: Detect Multiple Keyboards?
Source: Me being able to get that information in Delphi 7. But as i said, even if unix/linux/osx supported this too in one form or another, as long as someone doesn't fold themselves 6 times, this won't be supported in SDL... but hey, one can always design a controller with 100+ buttons or one with 2 axes and 3-5 buttons, right? Controllers CAN be differentiated
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Re: Detect Multiple Keyboards?
Nix supported multiple prime input devices ages before Windows ever did. But yeah that's OS-specific, as far as I'm aware every OS uses its own interface for that.
With that in mind, I think my last question should be paraphrased as "do window managers support using multiple keyboards and how".
With that in mind, I think my last question should be paraphrased as "do window managers support using multiple keyboards and how".
- zorg
- Party member
- Posts: 3441
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: Detect Multiple Keyboards?
That said, we're not really talking about multiple simultaneous pointers/keyboard input with multiple active windows, only that a löve project would be one active process, and the input devices, keyboards and mice, could be differentiated so that local multiplayer could work with multiple keyboards/mice instead of just controller devices.
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Re: Detect Multiple Keyboards?
Either way that would require SDL patching. On Windows there's MultiPoint Mouse SDK RawInput, as part of Windows SDK. On Nix systems, you can grab information from /dev/input/* corresponding to keyboards and mice, and read from it like from file. It outputs a few bytes that encode position of the mouse and buttons depressed, very easy to use, same with keyboards.
Who is online
Users browsing this forum: No registered users and 70 guests