QTfrontend/SDLs.cpp
changeset 2050 8149802b4f14
parent 2027 7c051453a487
child 2191 20c62f787a4d
equal deleted inserted replaced
2049:243d363546e7 2050:8149802b4f14
    24 SDLInteraction::SDLInteraction()
    24 SDLInteraction::SDLInteraction()
    25 {
    25 {
    26 	music = NULL;
    26 	music = NULL;
    27 
    27 
    28 	SDL_Init(SDL_INIT_VIDEO);
    28 	SDL_Init(SDL_INIT_VIDEO);
    29 	SDL_Init(SDL_INIT_AUDIO);
       
    30 	Mix_OpenAudio(22050, 0x8010, 2, 512);
       
    31   
       
    32 	Mix_VolumeMusic(33);
       
    33 }
    29 }
    34 
    30 
    35 SDLInteraction::~SDLInteraction()
    31 SDLInteraction::~SDLInteraction()
    36 {
    32 {
    37 	SDL_Quit();
    33 	SDL_Quit();
    58 	return result;
    54 	return result;
    59 }
    55 }
    60 void SDLInteraction::StartMusic()
    56 void SDLInteraction::StartMusic()
    61 {
    57 {
    62 	if (!music)
    58 	if (!music)
       
    59     {
       
    60    	    SDL_Init(SDL_INIT_AUDIO);
       
    61 	    Mix_OpenAudio(22050, 0x8010, 2, 512);
       
    62   
       
    63 	    Mix_VolumeMusic(33);
    63 		music = Mix_LoadMUS(QString(datadir->absolutePath() + "/Music/main theme.ogg").toLocal8Bit().constData());
    64 		music = Mix_LoadMUS(QString(datadir->absolutePath() + "/Music/main theme.ogg").toLocal8Bit().constData());
       
    65     }
    64 
    66 
    65 	Mix_FadeInMusic(music, -1, 3000);
    67 	Mix_FadeInMusic(music, -1, 3000);
    66 }
    68 }
    67 
    69 
    68 void SDLInteraction::StopMusic()
    70 void SDLInteraction::StopMusic()