- added game loading progress bar

This commit is contained in:
Mark Vejvoda 2011-01-09 10:03:33 +00:00
parent 6c5163d1e9
commit b5a139033a
3 changed files with 21 additions and 10 deletions

View File

@ -129,7 +129,7 @@ void Logger::loadLoadingScreen(string filepath){
// ==================== PRIVATE ====================
void Logger::renderLoadingScreen(){
void Logger::renderLoadingScreen() {
Renderer &renderer= Renderer::getInstance();
CoreData &coreData= CoreData::getInstance();
@ -152,6 +152,14 @@ void Logger::renderLoadingScreen(){
metrics.getVirtualW()/4,
62*metrics.getVirtualH()/100, false);
renderer.renderProgressBar(
progress,
metrics.getVirtualW()/4,
59*metrics.getVirtualH()/100,
coreData.getDisplayFontSmall(),
350,"loading progress ");
renderer.swapBuffers();
}

View File

@ -3,9 +3,9 @@
//
// Copyright (C) 2001-2008 Marti<74>o Figueroa
//
// 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
// 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
// License, or (at your option) any later version
// ==============================================================
@ -25,7 +25,7 @@ using Shared::Graphics::Texture2D;
namespace Glest{ namespace Game{
// =====================================================
// class Logger
// class Logger
//
/// Interface to write log files
// =====================================================
@ -42,7 +42,8 @@ private:
string state;
string subtitle;
string current;
Texture2D *loadingTexture;
Texture2D *loadingTexture;
int progress;
private:
Logger();
@ -52,10 +53,11 @@ private:
public:
static Logger & getInstance();
void setFile(const string &fileName) {this->fileName= fileName;}
void setState(const string &state) {this->state= state;}
void setSubtitle(const string &subtitle) {this->subtitle= subtitle;}
void setSubtitle(const string &subtitle) {this->subtitle= subtitle;}
void setProgress(int value) { this->progress = value; }
void add(const string &str, bool renderScreen= false);
void loadLoadingScreen(string filepath);

View File

@ -19,7 +19,7 @@
#include "logger.h"
#include "xml_parser.h"
#include "platform_util.h"
#include "game_util.h"
#include "game_util.h"
#include "leak_dumper.h"
using namespace Shared::Util;
@ -147,7 +147,8 @@ void TechTree::load(const string &dir, set<string> &factions, Checksum* checksum
char szBuf[1024]="";
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.setState(szBuf);
logger.setProgress((int)((((double)i + 1.0) / (double)factions.size()) * 100.0));
str=dir+"/factions/" + factionName;
factionTypes[i++].load(str, this, checksum,&checksumValue);