2010-03-20 12:11:46 +00:00
|
|
|
|
// ==============================================================
|
|
|
|
|
// This file is part of Glest (www.glest.org)
|
|
|
|
|
//
|
|
|
|
|
// Copyright (C) 2001-2005 Marti<74>o Figueroa
|
|
|
|
|
//
|
2010-03-23 02:37:41 +00:00
|
|
|
|
// You can redistribute this code and/or modify it under
|
|
|
|
|
// the terms of the GNU General Public License as published
|
|
|
|
|
// by the Free Software Foundation; either version 2 of the
|
2010-03-20 12:11:46 +00:00
|
|
|
|
// License, or (at your option) any later version
|
|
|
|
|
// ==============================================================
|
|
|
|
|
|
|
|
|
|
#include "menu_state_options.h"
|
|
|
|
|
|
|
|
|
|
#include "renderer.h"
|
|
|
|
|
#include "sound_renderer.h"
|
|
|
|
|
#include "core_data.h"
|
|
|
|
|
#include "config.h"
|
|
|
|
|
#include "menu_state_root.h"
|
|
|
|
|
#include "util.h"
|
|
|
|
|
|
|
|
|
|
#include "leak_dumper.h"
|
|
|
|
|
|
|
|
|
|
using namespace Shared::Util;
|
|
|
|
|
|
|
|
|
|
namespace Glest{ namespace Game{
|
|
|
|
|
|
|
|
|
|
// =====================================================
|
|
|
|
|
// class MenuStateOptions
|
|
|
|
|
// =====================================================
|
|
|
|
|
|
2010-03-23 02:37:41 +00:00
|
|
|
|
MenuStateOptions::MenuStateOptions(Program *program, MainMenu *mainMenu):
|
2010-03-20 12:11:46 +00:00
|
|
|
|
MenuState(program, mainMenu, "config")
|
|
|
|
|
{
|
|
|
|
|
Lang &lang= Lang::getInstance();
|
|
|
|
|
Config &config= Config::getInstance();
|
2010-04-01 00:13:28 +00:00
|
|
|
|
//modeinfos=list<ModeInfo> ();
|
|
|
|
|
Shared::Platform::getFullscreenVideoModes(&modeInfos);
|
2010-03-23 01:38:19 +00:00
|
|
|
|
activeInputLabel=NULL;
|
2010-04-01 00:13:28 +00:00
|
|
|
|
|
2010-04-01 18:59:05 +00:00
|
|
|
|
int leftline=670;
|
|
|
|
|
int rightline=670;
|
|
|
|
|
int leftLabelStart=250;
|
2010-04-01 00:13:28 +00:00
|
|
|
|
int leftColumnStart=leftLabelStart+150;
|
|
|
|
|
int rightLabelStart=500;
|
|
|
|
|
int rightColumnStart=rightLabelStart+150;
|
2010-04-01 18:59:05 +00:00
|
|
|
|
int buttonRowPos=80;
|
2010-04-01 00:13:28 +00:00
|
|
|
|
int captionOffset=75;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
labelAudioSection.init(leftLabelStart+captionOffset, leftline);
|
|
|
|
|
labelAudioSection.setFont(CoreData::getInstance().getMenuFontVeryBig());
|
|
|
|
|
labelAudioSection.setText(lang.get("Audio"));
|
|
|
|
|
leftline-=30;
|
|
|
|
|
|
|
|
|
|
//soundboxes
|
|
|
|
|
labelVolumeFx.init(leftLabelStart, leftline);
|
2010-03-20 12:11:46 +00:00
|
|
|
|
labelVolumeFx.setText(lang.get("FxVolume"));
|
2010-04-01 00:13:28 +00:00
|
|
|
|
listBoxVolumeFx.init(leftColumnStart, leftline, 80);
|
|
|
|
|
leftline-=30;
|
|
|
|
|
|
|
|
|
|
labelVolumeAmbient.init(leftLabelStart, leftline);
|
|
|
|
|
listBoxVolumeAmbient.init(leftColumnStart, leftline, 80);
|
2010-03-20 12:11:46 +00:00
|
|
|
|
labelVolumeAmbient.setText(lang.get("AmbientVolume"));
|
2010-04-01 00:13:28 +00:00
|
|
|
|
leftline-=30;
|
|
|
|
|
|
|
|
|
|
labelVolumeMusic.init(leftLabelStart, leftline);
|
|
|
|
|
listBoxVolumeMusic.init(leftColumnStart, leftline, 80);
|
2010-03-20 12:11:46 +00:00
|
|
|
|
labelVolumeMusic.setText(lang.get("MusicVolume"));
|
2010-04-01 00:13:28 +00:00
|
|
|
|
leftline-=30;
|
|
|
|
|
|
|
|
|
|
for(int i=0; i<=100; i+=5){
|
|
|
|
|
listBoxVolumeFx.pushBackItem(intToStr(i));
|
|
|
|
|
listBoxVolumeAmbient.pushBackItem(intToStr(i));
|
|
|
|
|
listBoxVolumeMusic.pushBackItem(intToStr(i));
|
|
|
|
|
}
|
|
|
|
|
listBoxVolumeFx.setSelectedItem(intToStr(config.getInt("SoundVolumeFx")/5*5));
|
|
|
|
|
listBoxVolumeAmbient.setSelectedItem(intToStr(config.getInt("SoundVolumeAmbient")/5*5));
|
|
|
|
|
listBoxVolumeMusic.setSelectedItem(intToStr(config.getInt("SoundVolumeMusic")/5*5));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
leftline-=30;
|
|
|
|
|
labelMiscSection.init(leftLabelStart+captionOffset, leftline);
|
|
|
|
|
labelMiscSection.setFont(CoreData::getInstance().getMenuFontVeryBig());
|
|
|
|
|
labelMiscSection.setText(lang.get("Misc"));
|
|
|
|
|
leftline-=30;
|
|
|
|
|
|
2010-03-20 12:11:46 +00:00
|
|
|
|
//lang
|
2010-04-01 00:13:28 +00:00
|
|
|
|
labelLang.init(leftLabelStart, leftline);
|
|
|
|
|
labelLang.setText(lang.get("Language"));
|
|
|
|
|
listBoxLang.init(leftColumnStart, leftline, 170);
|
2010-03-20 12:11:46 +00:00
|
|
|
|
vector<string> langResults;
|
|
|
|
|
findAll("data/lang/*.lng", langResults, true);
|
|
|
|
|
if(langResults.empty()){
|
|
|
|
|
throw runtime_error("There is no lang file");
|
|
|
|
|
}
|
|
|
|
|
listBoxLang.setItems(langResults);
|
|
|
|
|
listBoxLang.setSelectedItem(config.getString("Lang"));
|
2010-04-01 00:13:28 +00:00
|
|
|
|
leftline-=30;
|
|
|
|
|
|
2010-03-23 01:38:19 +00:00
|
|
|
|
//playerName
|
2010-04-01 00:13:28 +00:00
|
|
|
|
labelPlayerNameLabel.init(leftLabelStart,leftline);
|
|
|
|
|
labelPlayerNameLabel.setText(lang.get("Playername"));
|
|
|
|
|
|
|
|
|
|
labelPlayerName.init(leftColumnStart,leftline);
|
2010-03-23 02:37:41 +00:00
|
|
|
|
labelPlayerName.setText(config.getString("NetPlayerName",Socket::getHostName().c_str()));
|
2010-04-01 00:13:28 +00:00
|
|
|
|
leftline-=30;
|
|
|
|
|
|
|
|
|
|
leftline-=30;
|
|
|
|
|
labelVideoSection.init(leftLabelStart+captionOffset, leftline);
|
|
|
|
|
labelVideoSection.setFont(CoreData::getInstance().getMenuFontVeryBig());
|
|
|
|
|
labelVideoSection.setText(lang.get("Video"));
|
|
|
|
|
leftline-=30;
|
|
|
|
|
|
|
|
|
|
//resolution
|
|
|
|
|
labelScreenModes.init(leftLabelStart, leftline);
|
|
|
|
|
labelScreenModes.setText(lang.get("Resolution"));
|
|
|
|
|
listBoxScreenModes.init(leftColumnStart, leftline, 170);
|
|
|
|
|
for(list<ModeInfo>::const_iterator it= modeInfos.begin(); it!=modeInfos.end(); ++it){
|
|
|
|
|
listBoxScreenModes.pushBackItem((*it).getString());
|
|
|
|
|
}
|
|
|
|
|
listBoxScreenModes.setSelectedItem(config.getString("ScreenWidth")+"x"+config.getString("ScreenHeight"));
|
|
|
|
|
leftline-=30;
|
|
|
|
|
|
|
|
|
|
//filter
|
|
|
|
|
labelFilter.init(leftLabelStart, leftline);
|
|
|
|
|
labelFilter.setText(lang.get("Filter"));
|
|
|
|
|
listBoxFilter.init(leftColumnStart, leftline, 170);
|
|
|
|
|
listBoxFilter.pushBackItem("Bilinear");
|
|
|
|
|
listBoxFilter.pushBackItem("Trilinear");
|
|
|
|
|
listBoxFilter.setSelectedItem(config.getString("Filter"));
|
|
|
|
|
leftline-=30;
|
|
|
|
|
|
2010-03-20 12:11:46 +00:00
|
|
|
|
//shadows
|
2010-04-01 00:13:28 +00:00
|
|
|
|
labelShadows.init(leftLabelStart, leftline);
|
|
|
|
|
labelShadows.setText(lang.get("Shadows"));
|
|
|
|
|
listBoxShadows.init(leftColumnStart, leftline, 170);
|
2010-03-20 12:11:46 +00:00
|
|
|
|
for(int i= 0; i<Renderer::sCount; ++i){
|
|
|
|
|
listBoxShadows.pushBackItem(lang.get(Renderer::shadowsToStr(static_cast<Renderer::Shadows>(i))));
|
|
|
|
|
}
|
|
|
|
|
string str= config.getString("Shadows");
|
|
|
|
|
listBoxShadows.setSelectedItemIndex(clamp(Renderer::strToShadows(str), 0, Renderer::sCount-1));
|
2010-04-01 00:13:28 +00:00
|
|
|
|
leftline-=30;
|
|
|
|
|
|
2010-03-20 12:11:46 +00:00
|
|
|
|
//textures 3d
|
2010-04-01 00:13:28 +00:00
|
|
|
|
labelTextures3D.init(leftLabelStart, leftline);
|
|
|
|
|
listBoxTextures3D.init(leftColumnStart, leftline, 80);
|
|
|
|
|
labelTextures3D.setText(lang.get("Textures3D"));
|
2010-03-20 12:11:46 +00:00
|
|
|
|
listBoxTextures3D.pushBackItem(lang.get("No"));
|
|
|
|
|
listBoxTextures3D.pushBackItem(lang.get("Yes"));
|
2010-03-23 07:59:24 +00:00
|
|
|
|
listBoxTextures3D.setSelectedItemIndex(clamp(config.getBool("Textures3D"), false, true));
|
2010-04-01 00:13:28 +00:00
|
|
|
|
leftline-=30;
|
|
|
|
|
|
2010-03-20 12:11:46 +00:00
|
|
|
|
//lights
|
2010-04-01 00:13:28 +00:00
|
|
|
|
labelLights.init(leftLabelStart, leftline);
|
|
|
|
|
labelLights.setText(lang.get("MaxLights"));
|
|
|
|
|
listBoxLights.init(leftColumnStart, leftline, 80);
|
2010-03-20 12:11:46 +00:00
|
|
|
|
for(int i= 1; i<=8; ++i){
|
|
|
|
|
listBoxLights.pushBackItem(intToStr(i));
|
|
|
|
|
}
|
|
|
|
|
listBoxLights.setSelectedItemIndex(clamp(config.getInt("MaxLights")-1, 0, 7));
|
2010-04-01 00:13:28 +00:00
|
|
|
|
leftline-=30;
|
|
|
|
|
|
|
|
|
|
//unit particles
|
|
|
|
|
labelUnitParticles.init(leftLabelStart,leftline);
|
|
|
|
|
labelUnitParticles.setText(lang.get("ShowUnitParticles"));
|
|
|
|
|
listBoxUnitParticles.init(leftColumnStart,leftline,80);
|
|
|
|
|
listBoxUnitParticles.pushBackItem(lang.get("No"));
|
|
|
|
|
listBoxUnitParticles.pushBackItem(lang.get("Yes"));
|
|
|
|
|
listBoxUnitParticles.setSelectedItemIndex(clamp(config.getBool("UnitParticles"), 0, 1));
|
|
|
|
|
leftline-=30;
|
2010-03-20 12:11:46 +00:00
|
|
|
|
|
2010-04-01 00:13:28 +00:00
|
|
|
|
// buttons
|
|
|
|
|
buttonOk.init(200, buttonRowPos, 100);
|
|
|
|
|
buttonOk.setText(lang.get("Ok"));
|
|
|
|
|
buttonAbort.setText(lang.get("Abort"));
|
|
|
|
|
buttonAbort.init(310, buttonRowPos, 100);
|
|
|
|
|
buttonAutoConfig.setText(lang.get("AutoConfig"));
|
|
|
|
|
buttonAutoConfig.init(450, buttonRowPos, 125);
|
2010-03-23 02:37:41 +00:00
|
|
|
|
|
2010-03-20 12:11:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MenuStateOptions::mouseClick(int x, int y, MouseButton mouseButton){
|
|
|
|
|
|
|
|
|
|
Config &config= Config::getInstance();
|
|
|
|
|
CoreData &coreData= CoreData::getInstance();
|
|
|
|
|
SoundRenderer &soundRenderer= SoundRenderer::getInstance();
|
|
|
|
|
|
2010-03-23 01:38:19 +00:00
|
|
|
|
if(buttonOk.mouseClick(x, y)){
|
|
|
|
|
soundRenderer.playFx(coreData.getClickSoundA());
|
|
|
|
|
saveConfig();
|
|
|
|
|
mainMenu->setState(new MenuStateRoot(program, mainMenu));
|
2010-03-23 02:37:41 +00:00
|
|
|
|
}
|
2010-03-23 01:38:19 +00:00
|
|
|
|
else if(buttonAbort.mouseClick(x, y)){
|
2010-03-20 12:11:46 +00:00
|
|
|
|
soundRenderer.playFx(coreData.getClickSoundA());
|
|
|
|
|
mainMenu->setState(new MenuStateRoot(program, mainMenu));
|
2010-03-23 02:37:41 +00:00
|
|
|
|
}
|
2010-03-20 12:11:46 +00:00
|
|
|
|
else if(buttonAutoConfig.mouseClick(x, y)){
|
|
|
|
|
soundRenderer.playFx(coreData.getClickSoundA());
|
|
|
|
|
Renderer::getInstance().autoConfig();
|
|
|
|
|
saveConfig();
|
|
|
|
|
mainMenu->setState(new MenuStateOptions(program, mainMenu));
|
2010-03-23 02:37:41 +00:00
|
|
|
|
}
|
2010-03-23 01:38:19 +00:00
|
|
|
|
else if(labelPlayerName.mouseClick(x, y) && ( activeInputLabel != &labelPlayerName )){
|
|
|
|
|
setActiveInputLable(&labelPlayerName);
|
2010-03-20 12:11:46 +00:00
|
|
|
|
}
|
2010-03-23 01:38:19 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
listBoxLang.mouseClick(x, y);
|
|
|
|
|
listBoxShadows.mouseClick(x, y);
|
|
|
|
|
listBoxFilter.mouseClick(x, y);
|
|
|
|
|
listBoxTextures3D.mouseClick(x, y);
|
|
|
|
|
listBoxUnitParticles.mouseClick(x, y);
|
|
|
|
|
listBoxLights.mouseClick(x, y);
|
|
|
|
|
listBoxVolumeFx.mouseClick(x, y);
|
|
|
|
|
listBoxVolumeAmbient.mouseClick(x, y);
|
|
|
|
|
listBoxVolumeMusic.mouseClick(x, y);
|
2010-04-01 00:13:28 +00:00
|
|
|
|
listBoxScreenModes.mouseClick(x, y);
|
2010-03-20 12:11:46 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MenuStateOptions::mouseMove(int x, int y, const MouseState *ms){
|
2010-03-23 01:38:19 +00:00
|
|
|
|
buttonOk.mouseMove(x, y);
|
|
|
|
|
buttonAbort.mouseMove(x, y);
|
2010-03-20 12:11:46 +00:00
|
|
|
|
buttonAutoConfig.mouseMove(x, y);
|
|
|
|
|
listBoxLang.mouseMove(x, y);
|
|
|
|
|
listBoxVolumeFx.mouseMove(x, y);
|
|
|
|
|
listBoxVolumeAmbient.mouseMove(x, y);
|
|
|
|
|
listBoxVolumeMusic.mouseMove(x, y);
|
|
|
|
|
listBoxLang.mouseMove(x, y);
|
|
|
|
|
listBoxFilter.mouseMove(x, y);
|
|
|
|
|
listBoxShadows.mouseMove(x, y);
|
|
|
|
|
listBoxTextures3D.mouseMove(x, y);
|
|
|
|
|
listBoxUnitParticles.mouseMove(x, y);
|
|
|
|
|
listBoxLights.mouseMove(x, y);
|
2010-04-01 00:13:28 +00:00
|
|
|
|
listBoxScreenModes.mouseMove(x, y);
|
2010-03-20 12:11:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-03-23 01:38:19 +00:00
|
|
|
|
void MenuStateOptions::keyDown(char key){
|
|
|
|
|
if(activeInputLabel!=NULL)
|
|
|
|
|
{
|
|
|
|
|
if(key==vkBack){
|
|
|
|
|
string text= activeInputLabel->getText();
|
|
|
|
|
if(text.size()>1){
|
|
|
|
|
text.erase(text.end()-2);
|
|
|
|
|
}
|
|
|
|
|
activeInputLabel->setText(text);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MenuStateOptions::keyPress(char c){
|
|
|
|
|
if(activeInputLabel!=NULL)
|
|
|
|
|
{
|
|
|
|
|
int maxTextSize= 16;
|
|
|
|
|
if(&labelPlayerName==activeInputLabel){
|
|
|
|
|
if((c>='0' && c<='9')||(c>='a' && c<='z')||(c>='A' && c<='Z')||
|
|
|
|
|
(c=='-')||(c=='(')||(c==')')){
|
|
|
|
|
if(activeInputLabel->getText().size()<maxTextSize){
|
|
|
|
|
string text= activeInputLabel->getText();
|
2010-03-23 02:37:41 +00:00
|
|
|
|
text.insert(text.end()-1, c);
|
2010-03-23 01:38:19 +00:00
|
|
|
|
activeInputLabel->setText(text);
|
|
|
|
|
}
|
|
|
|
|
}
|
2010-03-23 02:37:41 +00:00
|
|
|
|
}
|
2010-03-23 01:38:19 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-03-20 12:11:46 +00:00
|
|
|
|
void MenuStateOptions::render(){
|
|
|
|
|
Renderer &renderer= Renderer::getInstance();
|
|
|
|
|
|
2010-03-23 01:38:19 +00:00
|
|
|
|
renderer.renderButton(&buttonOk);
|
|
|
|
|
renderer.renderButton(&buttonAbort);
|
2010-03-20 12:11:46 +00:00
|
|
|
|
renderer.renderButton(&buttonAutoConfig);
|
|
|
|
|
renderer.renderListBox(&listBoxLang);
|
|
|
|
|
renderer.renderListBox(&listBoxShadows);
|
|
|
|
|
renderer.renderListBox(&listBoxTextures3D);
|
|
|
|
|
renderer.renderListBox(&listBoxUnitParticles);
|
|
|
|
|
renderer.renderListBox(&listBoxLights);
|
|
|
|
|
renderer.renderListBox(&listBoxFilter);
|
|
|
|
|
renderer.renderListBox(&listBoxVolumeFx);
|
|
|
|
|
renderer.renderListBox(&listBoxVolumeAmbient);
|
|
|
|
|
renderer.renderListBox(&listBoxVolumeMusic);
|
|
|
|
|
renderer.renderLabel(&labelLang);
|
2010-03-23 01:38:19 +00:00
|
|
|
|
renderer.renderLabel(&labelPlayerNameLabel);
|
|
|
|
|
renderer.renderLabel(&labelPlayerName);
|
2010-03-20 12:11:46 +00:00
|
|
|
|
renderer.renderLabel(&labelShadows);
|
|
|
|
|
renderer.renderLabel(&labelTextures3D);
|
|
|
|
|
renderer.renderLabel(&labelUnitParticles);
|
|
|
|
|
renderer.renderLabel(&labelLights);
|
|
|
|
|
renderer.renderLabel(&labelFilter);
|
|
|
|
|
renderer.renderLabel(&labelVolumeFx);
|
|
|
|
|
renderer.renderLabel(&labelVolumeAmbient);
|
|
|
|
|
renderer.renderLabel(&labelVolumeMusic);
|
2010-04-01 00:13:28 +00:00
|
|
|
|
renderer.renderLabel(&labelVideoSection);
|
|
|
|
|
renderer.renderLabel(&labelAudioSection);
|
|
|
|
|
renderer.renderLabel(&labelMiscSection);
|
|
|
|
|
renderer.renderLabel(&labelScreenModes);
|
|
|
|
|
renderer.renderListBox(&listBoxScreenModes);
|
2010-03-20 12:11:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MenuStateOptions::saveConfig(){
|
|
|
|
|
Config &config= Config::getInstance();
|
2010-03-23 01:38:19 +00:00
|
|
|
|
Lang &lang= Lang::getInstance();
|
|
|
|
|
setActiveInputLable(NULL);
|
2010-03-23 02:37:41 +00:00
|
|
|
|
|
2010-03-23 01:38:19 +00:00
|
|
|
|
if(labelPlayerName.getText().length()>0)
|
|
|
|
|
{
|
|
|
|
|
config.setString("NetPlayerName", labelPlayerName.getText());
|
|
|
|
|
}
|
|
|
|
|
//Copy values
|
|
|
|
|
config.setString("Lang", listBoxLang.getSelectedItem());
|
|
|
|
|
lang.loadStrings(config.getString("Lang"));
|
|
|
|
|
|
|
|
|
|
int index= listBoxShadows.getSelectedItemIndex();
|
|
|
|
|
config.setString("Shadows", Renderer::shadowsToStr(static_cast<Renderer::Shadows>(index)));
|
|
|
|
|
|
|
|
|
|
config.setString("Filter", listBoxFilter.getSelectedItem());
|
2010-03-23 07:59:24 +00:00
|
|
|
|
config.setBool("Textures3D", listBoxTextures3D.getSelectedItemIndex());
|
2010-03-23 01:38:19 +00:00
|
|
|
|
config.setBool("UnitParticles", listBoxUnitParticles.getSelectedItemIndex());
|
|
|
|
|
config.setInt("MaxLights", listBoxLights.getSelectedItemIndex()+1);
|
|
|
|
|
config.setString("SoundVolumeFx", listBoxVolumeFx.getSelectedItem());
|
|
|
|
|
config.setString("SoundVolumeAmbient", listBoxVolumeAmbient.getSelectedItem());
|
|
|
|
|
CoreData::getInstance().getMenuMusic()->setVolume(strToInt(listBoxVolumeMusic.getSelectedItem())/100.f);
|
|
|
|
|
config.setString("SoundVolumeMusic", listBoxVolumeMusic.getSelectedItem());
|
2010-04-01 00:13:28 +00:00
|
|
|
|
|
|
|
|
|
//just for the moment ....
|
|
|
|
|
string currentResolution=config.getString("ScreenWidth")+"x"+config.getString("ScreenHeight");
|
|
|
|
|
string selectedResolution=listBoxScreenModes.getSelectedItem();
|
|
|
|
|
if(currentResolution!=selectedResolution){
|
|
|
|
|
for(list<ModeInfo>::const_iterator it= modeInfos.begin(); it!=modeInfos.end(); ++it){
|
|
|
|
|
if((*it).getString()==selectedResolution)
|
|
|
|
|
{
|
|
|
|
|
config.setInt("ScreenWidth",(*it).width);
|
|
|
|
|
config.setInt("ScreenHeight",(*it).height);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-03-20 12:11:46 +00:00
|
|
|
|
config.save();
|
|
|
|
|
Renderer::getInstance().loadConfig();
|
|
|
|
|
SoundRenderer::getInstance().loadConfig();
|
|
|
|
|
}
|
|
|
|
|
|
2010-03-23 01:38:19 +00:00
|
|
|
|
void MenuStateOptions::setActiveInputLable(GraphicLabel *newLable)
|
|
|
|
|
{
|
|
|
|
|
if(newLable!=NULL){
|
|
|
|
|
string text= newLable->getText();
|
|
|
|
|
size_t found;
|
|
|
|
|
found=text.find_last_of("_");
|
|
|
|
|
if (found==string::npos)
|
|
|
|
|
{
|
|
|
|
|
text=text+"_";
|
|
|
|
|
}
|
|
|
|
|
newLable->setText(text);
|
|
|
|
|
}
|
|
|
|
|
if(activeInputLabel!=NULL && !activeInputLabel->getText().empty()){
|
|
|
|
|
string text= activeInputLabel->getText();
|
|
|
|
|
size_t found;
|
|
|
|
|
found=text.find_last_of("_");
|
|
|
|
|
if (found!=string::npos)
|
|
|
|
|
{
|
|
|
|
|
text=text.substr(0,found);
|
|
|
|
|
}
|
|
|
|
|
activeInputLabel->setText(text);
|
|
|
|
|
}
|
|
|
|
|
activeInputLabel=newLable;
|
|
|
|
|
}
|
|
|
|
|
|
2010-03-20 12:11:46 +00:00
|
|
|
|
}}//end namespace
|