Jump to content
  • Advertisement
Sign in to follow this  
LauraMcCarter

[SlimDX] Can't create gamepad device

This topic is 2401 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
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.

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:


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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!