Advertisement

Generic Input API?

Started by August 21, 2003 12:11 AM
4 comments, last by Krylloan 21 years ago
Is there anything similar to DirectInput in *nix? If you''re not already familiar, DirectInput is an API that treats all input devices the same, just a collection of axes with axis properties, regardless of whether it is a keyboard, mouse, joystick etc... This allows your game to support input devices not considered, maybe not even created at the time of release.
Um, have you looked into SDL, it has an input component that would be straight forward to program for, I would assume.
Advertisement
Yeah, I''ve looked at SDL, but it doesn''t really cut the mustard.

SDL deals with each device differently, there''s specific keyboard events, specific mouse events and specific joystick events, but no support for generic events.

It also has some anomalies, eg numlock/capslock don''t act as buttons but rather as state changers (So you can''t use them in games).
quote: Original post by Krylloan
Yeah, I''ve looked at SDL, but it doesn''t really cut the mustard.
Take a look at ClanLib. Take a loot at GGI - though I think that''s really just for graphics. The core issue is the fact that DirectInput has a much more controlled environment allowing for a more sophisticated interface and hardware support. How does DI recognize and properly label and configure a device released after it was? Either the device contains the DI data on-board or the driver/config software for the device installs it in the DirectX database. Because Linux has a diferent architecture and a lot less vendor support, that''s not likely to happen any time soon.

Sorry.

quote: It also has some anomalies, eg numlock/capslock don''t act as buttons but rather as state changers (So you can''t use them in games).
That''s a function of how some keyboards are built. Did you know that pressing certain key combinations on certain keyboards is impossible because the keys share at least one signal line?

Besides, what game do you know that would ask you to use Num/Caps/Scroll Lock as a game button, given their odd positions?
Thanks, I''m just having a look at ClanLib and GGI. Looking sorta promising.

As far as requiring vendor support, I sort-of guessed that, but I was hoping that maybe most vendors actually did support one. Oh well.


And as far as keyboards go, I''m still horrified by the fact that the manufacturers are still using that old interface method that makes many combinations of keys unavailable. It would be so simple to design a keyboard that could send every single keyboard event. (Ie, I reckon I could do it with my small knowledge of electronic engineering).

BTW, capslock is actually a useful button in games. (at least I know I have used it in some FPS''s, with shift and ctrl taken up by walk and crouch). But I see the point about scroll lock.

I think the way to make SDL better in this area would be to have two separate "keys" for capslock (and the others). One is simply using the key as any old button, the other is the state (down = caps turned on, up = caps turned off).

quote: Original post by Oluseyi
Besides, what game do you know that would ask you to use Num/Caps/Scroll Lock as a game button, given their odd positions?


Flight sims seem to use every key for something - in the old 8086 MS Flight Sim, num lock toggled the minimap.
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara

This topic is closed to new replies.

Advertisement