Archived

This topic is now archived and is closed to further replies.

SDL Questions. Please help!

This topic is 5175 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

Joysticks:

SDL_Joystick *InitJoy()
{
int nb_joy;
SDL_Joystick *joy;

nb_joy = SDL_NumJoysticks(); // return the number of joysticks available
if(nb_joy > 0)
joy = SDL_JoystickOpen(0); // open first joystick
if(!joy)
{
printf("Error: unable to open joystick");
return NULL
}
SDL_JoystickEventState(SDL_ENABLE); // enable joystick to send events

return joy;
}


if want to know more, go to the sdl website in the section Doc Project

Matt

[edited by - lemurion on October 11, 2003 3:08:27 PM]

Share this post


Link to post
Share on other sites
http://www.libsdl.org

Should have enough information for what you''re looking for.

~~~ Signature: ~~
"Satan sent me to destroy the video game industry." - Trigger(my alter ego)
"God is a game designer too and his game, ''Life'' " - Me
"Squirrles make me horny." - Sean Randy Rowlen Uranus

Share this post


Link to post
Share on other sites
I''ve looked at the sdl site but their "help" is too complex for me.. I don''t get it.

Could someone post an example? Oh and about gamepads, thanx lemurion that''s great! But what about actually detecting if someone is pressing a button on the gamepad? How do I do that?

Share this post


Link to post
Share on other sites