Skip to main content
GameDev.net gamedev.net
🔒 Locked

Getting Started With DirectInput

Started by NickGravelyn Jun 2, 2006 at 1:42 AM 4 replies 500+ views
Original Post
NickGravelyn
NickGravelyn
I'm trying to start working with DirectInput and creating a custom data format for a controller I have. Problem is that I can't find any good resources on where to start. For instance, I know that I need to set up the data format which I believe I did correctly. Then I know I need to use the IDirectInput8::EnumDevices() function to find all the devices and compare them to what I need. Then I use the IDirectInput8::CreateDevice() function to create the actual device. Problem is that I don't know how to use the EnumDevices() function and the callback to pass the proper data to CreateDevice(). Then I don't know how to get the data from the right buttons. Can anyone help me out? Post some links, book titles, code snippets, or anything to get me started. Thanks in advance.
Ravyne
Ravyne
DirectInput always seemed like such a pain to me. Even when you have two conrollers with the same buttons, none of them will match-- btton #1 will be in different locations on each controller.

Honestly, I'd recomend going for XInput, the Xbox360 controller API which allows you to use 360 controls on your PC. Its a much smaller, less complicated API. I ported my generic control scheme to it in less than an hour, only looking at the sample code, and the controllers are widely available, cheap, and many may have them for their 360s already.
throw table_exception("(? ???)? ? ???");
NickGravelyn
NickGravelyn
Two problems with that approach: 1) I have a wireless 360 controller which means I can't use it with my PC until fall when Microsoft releases their USB receiver and 2) I'm looking to use a more obscure controller right now so I can't use XInput.
NickGravelyn
NickGravelyn
So I've been playing with it a bit and I can find the device using some calls. Now my question is this: how can I simply test the input that I want with the input that the enumerated devices can provide? I'm trying to do input for a PS2 controller using one of those USB adapters, so I can't just use any product IDs because they are determined by the various USB adapters. Is there a way to simply poll the device for its inputs and compare them to a list I make of what I need?
Ravyne
Ravyne
Quote:
Original post by NickGravelyn
1) I have a wireless 360 controller which means I can't use it with my PC until fall when Microsoft releases their USB receiver and


As for the other controller I have no idea, but the play & charge cable will allow you to plug in your wireless 360 pad to your PC AFAIK. If you don't have on yet you can get the kit for like 20-30 bucks, or a 3rd party cable only for ~12 bucks.

You should have one anyways, rechargeables are better for the environment ;)
throw table_exception("(? ???)? ? ???");
f4nt
f4nt
Even when the 360 is plugged in via the Play and Charge kit it's merely charging from the USB port.. It still transmits wirelessly while plugged in.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.