QTfrontend/SDLs.cpp
changeset 1223 41d7283934c1
parent 1191 5539aa59f703
child 1224 0b9fbee5ceda
equal deleted inserted replaced
1222:bc94a25d867a 1223:41d7283934c1
    17  */
    17  */
    18 
    18 
    19 #include "SDLs.h"
    19 #include "SDLs.h"
    20 
    20 
    21 #include "SDL.h"
    21 #include "SDL.h"
       
    22 #include "hwconsts.h"
    22 
    23 
    23 SDLInteraction::SDLInteraction()
    24 SDLInteraction::SDLInteraction()
    24 {
    25 {
    25 	SDL_Init(SDL_INIT_VIDEO);
    26 	SDL_Init(SDL_INIT_VIDEO);
       
    27 	SDL_Init(SDL_INIT_AUDIO);
       
    28 	Mix_OpenAudio(22050, 0x8010, 2, 512);
       
    29 	
       
    30 	Mix_Volume(-1, 50);
       
    31 	music = Mix_LoadMUS(QString(datadir->absolutePath() + "/Music/main theme.ogg").toAscii().constData());
       
    32 	StartMusic();
    26 }
    33 }
    27 
    34 
    28 SDLInteraction::~SDLInteraction()
    35 SDLInteraction::~SDLInteraction()
    29 {
    36 {
    30 	SDL_Quit();
    37 //	SDL_Quit();
    31 }
    38 }
    32 
    39 
    33 QStringList SDLInteraction::getResolutions() const
    40 QStringList SDLInteraction::getResolutions() const
    34 {
    41 {
    35 	QStringList result;
    42 	QStringList result;
    48 				result << QString("%1x%2").arg(modes[i]->w).arg(modes[i]->h);
    55 				result << QString("%1x%2").arg(modes[i]->w).arg(modes[i]->h);
    49 	}
    56 	}
    50 
    57 
    51 	return result;
    58 	return result;
    52 }
    59 }
       
    60 void SDLInteraction::StartMusic()
       
    61 {
       
    62 	Mix_PlayMusic(music, -1);
       
    63 }
       
    64 
       
    65 void SDLInteraction::StopMusic()
       
    66 {
       
    67 
       
    68 }