Jump to content
  • Advertisement

Archived

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

Origin2052

SDL Questions. Please help!

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

Advertisement
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
I Don''t know about gamepads but I suggest using SDL_mixer for sound in SDL apps. It handles all the mixing so you don;t have to.

http://jcatki.no-ip.org/SDL_mixer/SDL_mixer.html

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
And what about gamepads that support rumble and force feedback? How would you get the gamepad to shake using SDL?





--{You fight like a dairy farmer!}

Share this post


Link to post
Share on other sites
As mentioned in the documentation, force feedback is not yet supporte. Perhaps it will be in SDL 2.0 . The docs also have many code snippets that help you understand the API.

Share this post


Link to post
Share on other sites

  • 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!