delete[] shaderSource;
glEnable(GL_MULTISAMPLE);
-
- Mix_Volume(0,VOLUME_MASTER);
/*
* Create all the worlds, entities, mobs, and the player. This function is defined in
if(vol->FirstChildElement("sfx")->QueryFloatAttribute("volume",&fval) == XML_NO_ERROR)
VOLUME_SFX = fval;
else VOLUME_SFX = 50;
-
- Mix_Volume(0,VOLUME_MASTER);
- Mix_Volume(1,VOLUME_SFX);
- Mix_VolumeMusic(VOLUME_MUSIC);
-
+
ui::initFonts();
ui::setFontFace(xml.FirstChildElement("font")->Attribute("path"));
+ updateConfig();
}
void updateConfig(){
- vol->FirstChildElement("master")->SetAttribute("volume",VOLUME_MASTER);
- vol->FirstChildElement("music")->SetAttribute("volume",VOLUME_MUSIC);
- vol->FirstChildElement("sfx")->SetAttribute("volume", VOLUME_SFX);
-
Mix_Volume(0,VOLUME_MASTER);
- Mix_Volume(1,VOLUME_SFX);
- Mix_VolumeMusic(VOLUME_MUSIC);
+ Mix_Volume(1,VOLUME_SFX * (VOLUME_MASTER/100.0f));
+ Mix_VolumeMusic(VOLUME_MUSIC * (VOLUME_MASTER/100.0f));
}
void saveConfig(){
+ vol->FirstChildElement("master")->SetAttribute("volume",VOLUME_MASTER);
+ vol->FirstChildElement("music")->SetAttribute("volume",VOLUME_MUSIC);
+ vol->FirstChildElement("sfx")->SetAttribute("volume", VOLUME_SFX);
+
xml.SaveFile("config/settings.xml", false);
}
updateConfig();
saveConfig();
}
-
- void quitMenu(){
- currentMenu = NULL;
- }
-
+
menuItem createButton(vec2 l, dim2 d, Color c, const char* t, menuFunc f){
menuItem temp;
temp.member = 0;
return temp;
}
- char* stradd(const char* a, const char* b){
- size_t len = strlen(a) + strlen(b);
- char *ret = (char*)malloc(len * sizeof(char) + 1);
- *ret = '\0';
-
- return strcat(strcat(ret,a),b);
- }
-
/*
* Draws the menu
*/
void drawMenu(Menu *menu){
setFontSize(24);
+ updateConfig();
SDL_Event e;
mouse.x=premouse.x+offset.x-(SCREEN_WIDTH/2);