mirror of
https://github.com/glest/glest-source.git
synced 2025-08-31 11:41:46 +02:00
- cleanup of console and button placement in load game menu
This commit is contained in:
@@ -48,15 +48,29 @@ void Console::resetFonts() {
|
||||
font3D=CoreData::getInstance().getConsoleFont3D();
|
||||
}
|
||||
|
||||
void Console::addStdMessage(const string &s) {
|
||||
addLine(Lang::getInstance().get(s));
|
||||
void Console::addStdMessage(const string &s,bool clearOtherLines) {
|
||||
if(clearOtherLines == true) {
|
||||
addLineOnly(Lang::getInstance().get(s));
|
||||
}
|
||||
else {
|
||||
addLine(Lang::getInstance().get(s));
|
||||
}
|
||||
}
|
||||
|
||||
void Console::addStdScenarioMessage(const string &s) {
|
||||
addLine(Lang::getInstance().getScenarioString(s));
|
||||
void Console::addStdScenarioMessage(const string &s,bool clearOtherLines) {
|
||||
if(clearOtherLines == true) {
|
||||
addLineOnly(Lang::getInstance().getScenarioString(s));
|
||||
}
|
||||
else {
|
||||
addLine(Lang::getInstance().getScenarioString(s));
|
||||
}
|
||||
}
|
||||
|
||||
void Console::addLine(string line, bool playSound, int playerIndex, Vec3f textColor, bool teamMode) {
|
||||
void Console::addLineOnly(string line) {
|
||||
addLine(line,false,-1,Vec3f(1.f, 1.f, 1.f),false,true);
|
||||
}
|
||||
|
||||
void Console::addLine(string line, bool playSound, int playerIndex, Vec3f textColor, bool teamMode,bool clearOtherLines) {
|
||||
try {
|
||||
if(playSound == true) {
|
||||
SoundRenderer::getInstance().playFx(CoreData::getInstance().getClickSoundA());
|
||||
@@ -79,6 +93,10 @@ void Console::addLine(string line, bool playSound, int playerIndex, Vec3f textCo
|
||||
}
|
||||
//printf("info.PlayerIndex = %d, line [%s]\n",info.PlayerIndex,info.originalPlayerName.c_str());
|
||||
|
||||
if(clearOtherLines == true) {
|
||||
lines.clear();
|
||||
storedLines.clear();
|
||||
}
|
||||
lines.insert(lines.begin(), info);
|
||||
if(lines.size() > maxLines) {
|
||||
lines.pop_back();
|
||||
|
@@ -97,9 +97,10 @@ public:
|
||||
ConsoleLineInfo getStoredLineItem(int i) const;
|
||||
|
||||
void clearStoredLines();
|
||||
void addStdMessage(const string &s);
|
||||
void addStdScenarioMessage(const string &s);
|
||||
void addLine(string line, bool playSound= false,int playerIndex=-1,Vec3f textColor=Vec3f(1.f, 1.f, 1.f),bool teamMode=false);
|
||||
void addStdMessage(const string &s, bool clearOtherLines=false);
|
||||
void addStdScenarioMessage(const string &s,bool clearOtherLines=false);
|
||||
void addLineOnly(string line);
|
||||
void addLine(string line, bool playSound= false,int playerIndex=-1,Vec3f textColor=Vec3f(1.f, 1.f, 1.f),bool teamMode=false,bool clearOtherLines=false);
|
||||
void addLine(string line, bool playSound,string playerName, Vec3f textColor=Vec3f(1.f, 1.f, 1.f),bool teamMode=false);
|
||||
void addLine(string line, bool playSound, Vec3f textColor) { addLine(line,playSound,"",textColor,false); }
|
||||
void update();
|
||||
|
@@ -36,7 +36,7 @@ MenuStateLoadGame::MenuStateLoadGame(Program *program, MainMenu *mainMenu):
|
||||
Lang &lang= Lang::getInstance();
|
||||
|
||||
int buttonWidth = 120;
|
||||
int yPos=30;
|
||||
int yPos=40;
|
||||
int xPos=20;
|
||||
int xSpacing=20;
|
||||
int slotsToRender=20;
|
||||
@@ -199,7 +199,7 @@ void MenuStateLoadGame::mouseClick(int x, int y, MouseButton mouseButton){
|
||||
soundRenderer.playFx(coreData.getClickSoundB());
|
||||
if(selectedButton == NULL) {
|
||||
Lang &lang= Lang::getInstance();
|
||||
console.addStdMessage("NothingSelected");
|
||||
console.addStdMessage("NothingSelected",true);
|
||||
}
|
||||
else {
|
||||
string slotname = selectedButton->getText();
|
||||
@@ -210,7 +210,7 @@ void MenuStateLoadGame::mouseClick(int x, int y, MouseButton mouseButton){
|
||||
Lang &lang= Lang::getInstance();
|
||||
char szBuf[8096]="";
|
||||
sprintf(szBuf,lang.get("LoadGameDeletingFile","",true).c_str(),filename.c_str());
|
||||
console.addLine(szBuf);
|
||||
console.addLineOnly(szBuf);
|
||||
|
||||
for(int i = 0; i < slots.size(); i++) {
|
||||
if(slots[i] == selectedButton) {
|
||||
@@ -237,7 +237,7 @@ void MenuStateLoadGame::mouseClick(int x, int y, MouseButton mouseButton){
|
||||
|
||||
if(selectedButton == NULL) {
|
||||
Lang &lang= Lang::getInstance();
|
||||
console.addStdMessage("NothingSelected");
|
||||
console.addStdMessage("NothingSelected",true);
|
||||
}
|
||||
else {
|
||||
string filename = saveGameDir + selectedButton->getText() + ".xml";
|
||||
@@ -245,7 +245,7 @@ void MenuStateLoadGame::mouseClick(int x, int y, MouseButton mouseButton){
|
||||
Lang &lang= Lang::getInstance();
|
||||
char szBuf[8096]="";
|
||||
sprintf(szBuf,lang.get("LoadGameLoadingFile","",true).c_str(),filename.c_str());
|
||||
console.addLine(szBuf);
|
||||
console.addLineOnly(szBuf);
|
||||
|
||||
Game::loadGame(filename,program,false);
|
||||
return;
|
||||
|
Reference in New Issue
Block a user