SDL Questions. Please help!

Started by
5 comments, last by Origin2052 20 years, 6 months ago
I''m wondering how to play audio in SDL and how to use Gamepads? Could anyone explain and/or provide an example?
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]
Matt
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
What is Barrel Drop?
Who are HTS Games?
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
~~~ 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
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?
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!}

--{You fight like a dairy farmer!}

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.

0xa0000000

This topic is closed to new replies.

Advertisement