/*
* call-seq:
* new( n ) -> Joystick
*
* Create and initialize an interface to the nth joystick on the
* system. Raises SDLError if the joystick could not be opened.
*/
VALUE rbgm_joystick_new( VALUE module, VALUE vindex )
{
VALUE self;
SDL_Joystick *joy;
int index;
index = NUM2INT(vindex);
joy = SDL_JoystickOpen(index);
if(joy == NULL)
{
rb_raise(eSDLError,"Could not open joystick %d: %s",\
index,SDL_GetError());
}
self = Data_Wrap_Struct(cJoy, 0, RBGM_JoystickClose, joy);
return self;
}