1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

Added effects volume.

This commit is contained in:
Frank Zago 2009-05-08 02:58:41 +00:00
parent b5ae7d5cbe
commit 6e99d6703c
2 changed files with 20 additions and 5 deletions

10
CMT.cpp
View File

@ -117,11 +117,15 @@ int main(int argc, char** argv)
}
atexit(TTF_Quit);
THC tlog0<<"\tInitializing fonts: "<<pomtime.getDif()<<std::endl;
CAudioHandler * audioh = new CAudioHandler; //initializing audio
audioh->initAudio();
//audio initialized
//initializing audio
CAudioHandler * audioh = new CAudioHandler;
// Note: because of interface button range, volume can only be a
// multiple of 11, from 0 to 99.
audioh->initAudio(88);
cgi->audioh = audioh;
tlog0<<"\tInitializing sound: "<<pomtime.getDif()<<std::endl;
tlog0<<"Initializing screen, fonts and sound handling: "<<tmh.getDif()<<std::endl;
CDefHandler::Spriteh = cgi->spriteh = new CLodHandler();
cgi->spriteh->init("Data" PATHSEPARATOR "H3sprite.lod","Sprites");

View File

@ -4452,13 +4452,20 @@ CSystemOptionsWindow::CSystemOptionsWindow(const SDL_Rect &pos, CPlayerInterface
mapScrollSpeed->onChange = boost::bind(&CPlayerInterface::setMapScrollingSpeed, owner, _1);
musicVolume = new CHighlightableButtonsGroup(0, true);
for(int i=1; i<=10; ++i)
for(int i=0; i<10; ++i)
{
musicVolume->addButton(boost::assign::map_list_of(0,CGI->generaltexth->zelp[325+i].first),CGI->generaltexth->zelp[325+i].second, "syslb.def", 188 + 19*(i-1), 415, i*10);
musicVolume->addButton(boost::assign::map_list_of(0,CGI->generaltexth->zelp[326+i].first),CGI->generaltexth->zelp[326+i].second, "syslb.def", 188 + 19*i, 415, i*11);
}
musicVolume->select(CGI->audioh->getMusicVolume(), 1);
musicVolume->onChange = boost::bind(&CAudioHandler::setMusicVolume, CGI->audioh, _1);
effectsVolume = new CHighlightableButtonsGroup(0, true);
for(int i=0; i<10; ++i)
{
effectsVolume->addButton(boost::assign::map_list_of(0,CGI->generaltexth->zelp[336+i].first),CGI->generaltexth->zelp[336+i].second, "syslb.def", 188 + 19*i, 481, i*11);
}
effectsVolume->select(CGI->audioh->getSoundVolume(), 1);
effectsVolume->onChange = boost::bind(&CAudioHandler::setSoundVolume, CGI->audioh, _1);
}
CSystemOptionsWindow::~CSystemOptionsWindow()
@ -4471,6 +4478,7 @@ CSystemOptionsWindow::~CSystemOptionsWindow()
delete heroMoveSpeed;
delete mapScrollSpeed;
delete musicVolume;
delete effectsVolume;
}
void CSystemOptionsWindow::bquitf()
@ -4503,6 +4511,7 @@ void CSystemOptionsWindow::activate()
heroMoveSpeed->activate();
mapScrollSpeed->activate();
musicVolume->activate();
effectsVolume->activate();
}
void CSystemOptionsWindow::deactivate()
@ -4513,6 +4522,7 @@ void CSystemOptionsWindow::deactivate()
heroMoveSpeed->deactivate();
mapScrollSpeed->deactivate();
musicVolume->deactivate();
effectsVolume->deactivate();
}
void CSystemOptionsWindow::show(SDL_Surface *to)
@ -4525,6 +4535,7 @@ void CSystemOptionsWindow::show(SDL_Surface *to)
heroMoveSpeed->show(to);
mapScrollSpeed->show(to);
musicVolume->show(to);
effectsVolume->show(to);
}
CTavernWindow::CTavernWindow(const CGHeroInstance *H1, const CGHeroInstance *H2, const std::string &gossip)