[SlimDX] Can't create gamepad device

Started by
4 comments, last by Abdullah Kadhim 12 years, 3 months ago
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!
Advertisement
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.
Mike Popoloski | Journal | SlimDX
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?
Anything in the XInput namespace (Gamepad, Controller, etc) is specifically for the XBox 360 Controller.
darn! Oh, well.
Thanks for your help Mike.
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:


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();
}

This topic is closed to new replies.

Advertisement