View Single Post
  #9   Spotlight this post!  
Unread 12-12-2012, 10:47
gauravchhabra gauravchhabra is offline
Junior Member
no team
 
Join Date: Dec 2012
Location: India
Posts: 2
gauravchhabra is an unknown quantity at this point
Re: Reading multiple joysticks on C# using SlimDX.

Hey Eric Haskins,

i am trying to program the dance pad programmed for a Dancing Revolution Game, could any one tell how i can take the input from their button..?? because i tried using the serial port input but it didn't worked out.

even i used this code but its not returning the data.

JoystickState state = new JoystickState();

// JoystickState state = joystick.CurrentJoystickState; ( If i use this and delete the above command then i get a error for Object reference not set to an instance of an object. ( NULL Reference Exception )


//Capture Buttons.
byte[] buttons = state.GetButtons();
for (int i = 0; i < buttons.Length; i++)
{
if (buttons[i] != 0)
{
info += "Button:" + i + " ";
label1.Text = info;

}
}