QTfrontend/SDLs.cpp
changeset 1235 070629f3902d
parent 1225 f882a92ef872
child 1387 c809c536a58f
equal deleted inserted replaced
1234:1091e2f12751 1235:070629f3902d
    21 #include "SDL.h"
    21 #include "SDL.h"
    22 #include "hwconsts.h"
    22 #include "hwconsts.h"
    23 
    23 
    24 SDLInteraction::SDLInteraction()
    24 SDLInteraction::SDLInteraction()
    25 {
    25 {
       
    26 	music = NULL;
       
    27 
    26 	SDL_Init(SDL_INIT_VIDEO);
    28 	SDL_Init(SDL_INIT_VIDEO);
    27 	SDL_Init(SDL_INIT_AUDIO);
    29 	SDL_Init(SDL_INIT_AUDIO);
    28 	Mix_OpenAudio(22050, 0x8010, 2, 512);
    30 	Mix_OpenAudio(22050, 0x8010, 2, 512);
    29 	
    31 	
    30 	Mix_Volume(-1, 50);
    32 	Mix_VolumeMusic(50);
    31 	music = Mix_LoadMUS(QString(datadir->absolutePath() + "/Music/main theme.ogg").toAscii().constData());
       
    32 }
    33 }
    33 
    34 
    34 SDLInteraction::~SDLInteraction()
    35 SDLInteraction::~SDLInteraction()
    35 {
    36 {
    36 	SDL_Quit();
    37 	SDL_Quit();
    56 
    57 
    57 	return result;
    58 	return result;
    58 }
    59 }
    59 void SDLInteraction::StartMusic()
    60 void SDLInteraction::StartMusic()
    60 {
    61 {
       
    62 	if (!music)
       
    63 		music = Mix_LoadMUS(QString(datadir->absolutePath() + "/Music/main theme.ogg").toAscii().constData());
       
    64 
    61 	Mix_FadeInMusic(music, -1, 3000);
    65 	Mix_FadeInMusic(music, -1, 3000);
    62 }
    66 }
    63 
    67 
    64 void SDLInteraction::StopMusic()
    68 void SDLInteraction::StopMusic()
    65 {
    69 {