Sign in to follow this  
juanmanuelsanchez

Gamepad support programing?

Recommended Posts

hi all ! Im trying to add suport for gamepads in my engine, now I need to know wich is the best way to aproach, directinput perhaps? Also if you know any good tuts please post the link. Thanks a lot in advance

Share this post


Link to post
Share on other sites
DirectInput if you're working just with windows, SDL if you're crossplatform.

(in fact the windows build of SDL is just a thin wrapper around directinput).

You can use directinput from c++ or the .net languages. You should be able to use SDL with pretty much any language.

Share this post


Link to post
Share on other sites
By far the easiest way is XInput, but that limits you to Xbox 360 controllers only. (I don't see that as a problem as I code mainly for myself). Otherwise, on Windows, DirectInput is your best bet.

Share this post


Link to post
Share on other sites
I need something that will let me code different type of controllers or "profiles" since other people might not have my type of controller.

So I need some tuts on how to program gamepad support for that kind of situations...

And yes it will windows based only.

Share this post


Link to post
Share on other sites
You won't need to worry too much about specific kinds of controllers.

DirectInput abstracts that all away, you just work with a simple device object that tells you how many buttons, sticks, dpads, etc it has and let's you obtain their states.

The important thing is not to force the user to use one particular control setup. If you give them the ability to remap controls (changing what a particular button does, for example), then virtually any gamepad will be usable in your game.

Share this post


Link to post
Share on other sites
Lots of possibilities, especially considering you didn't tell us what kind of gamepad you have. There's 10000 different ones out there.

Does the gamepad work for you with other games?

Is it directx compatible?

Do you need to install a special driver? (you have to in order to use the xbox 360 gamepads in windows).

Does the gamepad require batteries? Are they charged?

Share this post


Link to post
Share on other sites
The gamepad is a Saitek P2900 Wireless.

The page with info is here: http://www.saitekusa.com/usa/prod/p2900.htm

It works with other games.

I suppose its directx compatible.

about drivers... cant remember I suppose thats yes you have to install the vendors drivers.

ANd yes... its on and with batteries

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this