loading progress a bit more detailed
This commit is contained in:
parent
b5a139033a
commit
6d94548b4f
|
@ -157,7 +157,7 @@ void Logger::renderLoadingScreen() {
|
|||
metrics.getVirtualW()/4,
|
||||
59*metrics.getVirtualH()/100,
|
||||
coreData.getDisplayFontSmall(),
|
||||
350,"loading progress ");
|
||||
350,""); // no string here, because it has to be language specific and does not give much information
|
||||
|
||||
|
||||
renderer.swapBuffers();
|
||||
|
|
|
@ -58,12 +58,14 @@ public:
|
|||
void setState(const string &state) {this->state= state;}
|
||||
void setSubtitle(const string &subtitle) {this->subtitle= subtitle;}
|
||||
void setProgress(int value) { this->progress = value; }
|
||||
int getProgress() const {return progress;}
|
||||
|
||||
void add(const string &str, bool renderScreen= false);
|
||||
void loadLoadingScreen(string filepath);
|
||||
void renderLoadingScreen();
|
||||
|
||||
void clear();
|
||||
|
||||
};
|
||||
|
||||
}}//end namespace
|
||||
|
|
|
@ -380,6 +380,9 @@ void Program::setState(ProgramState *programState, bool cleanupOldState)
|
|||
int Y = 0;
|
||||
SDL_GetMouseState(&X,&Y);
|
||||
programState->setStartXY(X,Y);
|
||||
Logger::getInstance().setProgress(0);
|
||||
Logger::getInstance().setState("");
|
||||
|
||||
|
||||
SDL_PumpEvents();
|
||||
|
||||
|
|
|
@ -77,10 +77,12 @@ void FactionType::load(const string &dir, const TechTree *techTree, Checksum* ch
|
|||
|
||||
// b1) load units
|
||||
try{
|
||||
Logger &logger= Logger::getInstance();
|
||||
int progressBaseValue=logger.getProgress();
|
||||
for(int i = 0; i < unitTypes.size(); ++i) {
|
||||
string str= dir + "/units/" + unitTypes[i].getName();
|
||||
unitTypes[i].load(i, str, techTree, this, checksum,techtreeChecksum);
|
||||
|
||||
logger.setProgress(progressBaseValue+(int)((((double)i + 1.0) / (double)unitTypes.size()) * 100.0/techTree->getTypeCount()));
|
||||
SDL_PumpEvents();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -148,7 +148,7 @@ void TechTree::load(const string &dir, set<string> &factions, Checksum* checksum
|
|||
sprintf(szBuf,"%s %s [%d / %d] - %s",Lang::getInstance().get("Loading").c_str(),Lang::getInstance().get("Faction").c_str(),i+1,(int)factions.size(),factionName.c_str());
|
||||
Logger &logger= Logger::getInstance();
|
||||
logger.setState(szBuf);
|
||||
logger.setProgress((int)((((double)i + 1.0) / (double)factions.size()) * 100.0));
|
||||
logger.setProgress((int)((((double)i) / (double)factions.size()) * 100.0));
|
||||
|
||||
str=dir+"/factions/" + factionName;
|
||||
factionTypes[i++].load(str, this, checksum,&checksumValue);
|
||||
|
|
Loading…
Reference in New Issue
Block a user