[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.5.5 Mix_PlayMusic

int Mix_PlayMusic(Mix_Music *music, int loops)

music
Pointer to Mix_Music to play.
loops
number of times to play through the music.
0 plays the music zero times...
-1 plays the music forever (or as close as it can get to that)

Play the loaded music loop times through from start to finish. The previous music will be halted, or if fading out it waits (blocking) for that to finish.

Returns: 0 on success, or -1 on errors.

 
// play music forever
// Mix_Music *music; // I assume this has been loaded already
if(Mix_PlayMusic(music, -1)==-1) {
    printf("Mix_PlayMusic: %s\n", Mix_GetError());
    // well, there's no music, but most games don't break without music...
}

See Also:
4.5.6 Mix_FadeInMusic



This document was generated on November, 13 2009 using texi2html