Sign in to follow this  
LauraMcCarter

[SlimDX] Can't create gamepad device

Recommended Posts

I'm trying to create a gamepad device like so ... SlimDX.DirectInput.Device<Gamepad> gameDevice = new Device<Gamepad>(directInput, deviceInstance.InstanceGuid); but I kept getting the error "The data format must be marked with one and only one DataFormat attribute." Looking at the SlimDX code it seems that the only valid DataFormats are Keyboard, Mouse, and Joystick. I really wanted to create a Gamepad device because it had some cool features I wanted to use. Instead I got stuck creating a joypad device. Could you tell me if there is a way to create a SlimDX gamepad device? Thanks!

Share this post


Link to post
Share on other sites
In DirectInput the Xbox360 gamepad is represented as a joystick. I don't know where you got the Gamepad type from (XInput?), but it's not a built in DirectInput type. If you want to use the Xbox360 gamepad as a legitimate controller, use SlimDX.XInput.

Share this post


Link to post
Share on other sites
Thanks Mike.

Actually, I'm using a usb logitech controller but I wanted to see if the gamepad device would work for it. So if I create a Gamepad device like this...

SlimDX.XInput.Gamepad gamepad = new Gamepad();

are there any methods where I can give my Gamepad the GUID of the usb controller that I want to use?

Will a Gamepad work for a USB controller anyway?

Share this post


Link to post
Share on other sites
I have a logitech gamepad and was wondering if I can get it to work with slimdx? perhaps with rawinput? directinput?

in my c# program I have this so far but am not sure what to do next:

[CODE]
private void JoystickForm_Load(object sender, EventArgs e)
{
SlimDX.RawInput.Device.RegisterDevice(SlimDX.Multimedia.UsagePage.Game, SlimDX.Multimedia.UsageId.Gamepad, DeviceFlags.None);
SlimDX.RawInput.Device.RawInput += new EventHandler<RawInputEventArgs>(Device_RawInput);

}
void Device_RawInput(object sender, RawInputEventArgs e)
{
throw new NotImplementedException();
}
[/CODE]

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