mirror of
https://github.com/glest/glest-source.git
synced 2025-10-03 10:51:55 +02:00
- adjusted ? toggle key to always allow toggling of FPS (whether or not debug in enabled)
This commit is contained in:
@@ -1240,8 +1240,15 @@ void Game::render2d(){
|
|||||||
|
|
||||||
//debug info
|
//debug info
|
||||||
|
|
||||||
|
bool perfLogging = false;
|
||||||
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled == true ||
|
||||||
|
SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled == true) {
|
||||||
|
perfLogging = true;
|
||||||
|
}
|
||||||
|
|
||||||
string str;
|
string str;
|
||||||
if(gui.getShowDebugUI() == true || difftime(time(NULL),lastRenderLog2d) >= 1) {
|
if( renderer.getShowDebugUI() == true ||
|
||||||
|
(perfLogging == true && difftime(time(NULL),lastRenderLog2d) >= 1)) {
|
||||||
str+= "MouseXY: " + intToStr(mouseX) + "," + intToStr(mouseY)+"\n";
|
str+= "MouseXY: " + intToStr(mouseX) + "," + intToStr(mouseY)+"\n";
|
||||||
str+= "PosObjWord: " + intToStr(gui.getPosObjWorld().x) + "," + intToStr(gui.getPosObjWorld().y)+"\n";
|
str+= "PosObjWord: " + intToStr(gui.getPosObjWorld().x) + "," + intToStr(gui.getPosObjWorld().y)+"\n";
|
||||||
str+= "Render FPS: "+intToStr(lastRenderFps)+"\n";
|
str+= "Render FPS: "+intToStr(lastRenderFps)+"\n";
|
||||||
@@ -1305,7 +1312,7 @@ void Game::render2d(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(gui.getShowDebugUI() == true) {
|
if(renderer.getShowDebugUI() == true) {
|
||||||
renderer.renderText(str, coreData.getMenuFontNormal(),
|
renderer.renderText(str, coreData.getMenuFontNormal(),
|
||||||
Vec3f(1.0f), 10, 500, false);
|
Vec3f(1.0f), 10, 500, false);
|
||||||
|
|
||||||
@@ -1314,14 +1321,12 @@ void Game::render2d(){
|
|||||||
}
|
}
|
||||||
renderer.renderUnitTitles(coreData.getMenuFontNormal(),Vec3f(1.0f));
|
renderer.renderUnitTitles(coreData.getMenuFontNormal(),Vec3f(1.0f));
|
||||||
}
|
}
|
||||||
else {
|
else if(renderer.getAllowRenderUnitTitles() == true) {
|
||||||
if(renderer.getAllowRenderUnitTitles() == true) {
|
renderer.setAllowRenderUnitTitles(false);
|
||||||
renderer.setAllowRenderUnitTitles(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//network status
|
//network status
|
||||||
if(renderNetworkStatus) {
|
if(renderNetworkStatus == true) {
|
||||||
if(NetworkManager::getInstance().getGameNetworkInterface() != NULL) {
|
if(NetworkManager::getInstance().getGameNetworkInterface() != NULL) {
|
||||||
renderer.renderText(
|
renderer.renderText(
|
||||||
NetworkManager::getInstance().getGameNetworkInterface()->getNetworkStatus(),
|
NetworkManager::getInstance().getGameNetworkInterface()->getNetworkStatus(),
|
||||||
@@ -1339,10 +1344,10 @@ void Game::render2d(){
|
|||||||
//2d mouse
|
//2d mouse
|
||||||
renderer.renderMouse2d(mouseX, mouseY, mouse2d, gui.isSelectingPos()? 1.f: 0.f);
|
renderer.renderMouse2d(mouseX, mouseY, mouse2d, gui.isSelectingPos()? 1.f: 0.f);
|
||||||
|
|
||||||
if(difftime(time(NULL),lastRenderLog2d) >= 1) {
|
if(perfLogging == true && difftime(time(NULL),lastRenderLog2d) >= 1) {
|
||||||
lastRenderLog2d = time(NULL);
|
lastRenderLog2d = time(NULL);
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d Statistics: %s\n",__FILE__,__FUNCTION__,__LINE__,str.c_str());
|
|
||||||
|
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d Statistics: %s\n",__FILE__,__FUNCTION__,__LINE__,str.c_str());
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugWorldSynch,"In [%s::%s] Line: %d Statistics: %s\n",__FILE__,__FUNCTION__,__LINE__,str.c_str());
|
SystemFlags::OutputDebug(SystemFlags::debugWorldSynch,"In [%s::%s] Line: %d Statistics: %s\n",__FILE__,__FUNCTION__,__LINE__,str.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -161,6 +161,8 @@ Renderer::Renderer(){
|
|||||||
no2DMouseRendering = config.getBool("No2DMouseRendering","false");
|
no2DMouseRendering = config.getBool("No2DMouseRendering","false");
|
||||||
maxConsoleLines= config.getInt("ConsoleMaxLines");
|
maxConsoleLines= config.getInt("ConsoleMaxLines");
|
||||||
|
|
||||||
|
showDebugUI = false;
|
||||||
|
|
||||||
gi.setFactory(fr.getGraphicsFactory(config.getString("FactoryGraphics")));
|
gi.setFactory(fr.getGraphicsFactory(config.getString("FactoryGraphics")));
|
||||||
GraphicsFactory *graphicsFactory= GraphicsInterface::getInstance().getFactory();
|
GraphicsFactory *graphicsFactory= GraphicsInterface::getInstance().getFactory();
|
||||||
|
|
||||||
|
@@ -257,6 +257,7 @@ private:
|
|||||||
std::vector<std::pair<Unit *,Vec3f> > renderUnitTitleList;
|
std::vector<std::pair<Unit *,Vec3f> > renderUnitTitleList;
|
||||||
|
|
||||||
bool no2DMouseRendering;
|
bool no2DMouseRendering;
|
||||||
|
bool showDebugUI;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Renderer();
|
Renderer();
|
||||||
@@ -388,6 +389,9 @@ public:
|
|||||||
bool getNo2DMouseRendering() const { return no2DMouseRendering; }
|
bool getNo2DMouseRendering() const { return no2DMouseRendering; }
|
||||||
void setNo2DMouseRendering(bool value) { no2DMouseRendering = value; }
|
void setNo2DMouseRendering(bool value) { no2DMouseRendering = value; }
|
||||||
|
|
||||||
|
bool getShowDebugUI() const { return showDebugUI; }
|
||||||
|
void setShowDebugUI(bool value) { showDebugUI = value; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//private misc
|
//private misc
|
||||||
float computeSunAngle(float time);
|
float computeSunAngle(float time);
|
||||||
|
@@ -116,7 +116,6 @@ void Gui::init(Game *game){
|
|||||||
this->console= game->getConsole();
|
this->console= game->getConsole();
|
||||||
this->world= game->getWorld();
|
this->world= game->getWorld();
|
||||||
selection.init(this, world->getThisFactionIndex());
|
selection.init(this, world->getThisFactionIndex());
|
||||||
this->showDebugUI = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gui::end(){
|
void Gui::end(){
|
||||||
@@ -338,9 +337,6 @@ void Gui::hotKey(char key) {
|
|||||||
else if(key == configKeys.getCharKey("HotKeySelectBuiltBuilding")) {
|
else if(key == configKeys.getCharKey("HotKeySelectBuiltBuilding")) {
|
||||||
selectInterestingUnit(iutBuiltBuilding);
|
selectInterestingUnit(iutBuiltBuilding);
|
||||||
}
|
}
|
||||||
else if(key == configKeys.getCharKey("HotKeyShowDebug")) {
|
|
||||||
this->showDebugUI = !this->showDebugUI;
|
|
||||||
}
|
|
||||||
else if(key == configKeys.getCharKey("HotKeyDumpWorldToLog")) {
|
else if(key == configKeys.getCharKey("HotKeyDumpWorldToLog")) {
|
||||||
std::string worldLog = world->DumpWorldToLog();
|
std::string worldLog = world->DumpWorldToLog();
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] worldLog dumped to [%s]\n",__FILE__,__FUNCTION__,__LINE__,worldLog.c_str());
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] worldLog dumped to [%s]\n",__FILE__,__FUNCTION__,__LINE__,worldLog.c_str());
|
||||||
|
@@ -132,8 +132,6 @@ private:
|
|||||||
|
|
||||||
CardinalDir selectedBuildingFacing;
|
CardinalDir selectedBuildingFacing;
|
||||||
|
|
||||||
bool showDebugUI;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Gui();
|
Gui();
|
||||||
void init(Game *game);
|
void init(Game *game);
|
||||||
@@ -178,8 +176,6 @@ public:
|
|||||||
void switchToNextDisplayColor();
|
void switchToNextDisplayColor();
|
||||||
void onSelectionChanged();
|
void onSelectionChanged();
|
||||||
|
|
||||||
bool getShowDebugUI() const { return showDebugUI; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
//orders
|
//orders
|
||||||
|
@@ -271,6 +271,13 @@ void MainWindow::eventKeyDown(char key){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Config &configKeys = Config::getInstance(std::pair<ConfigType,ConfigType>(cfgMainKeys,cfgUserKeys));
|
||||||
|
if(key == configKeys.getCharKey("HotKeyShowDebug")) {
|
||||||
|
Renderer &renderer= Renderer::getInstance();
|
||||||
|
bool showDebugUI = renderer.getShowDebugUI();
|
||||||
|
renderer.setShowDebugUI(!showDebugUI);
|
||||||
|
}
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -109,7 +109,8 @@ void MainMenu::render(){
|
|||||||
state->render();
|
state->render();
|
||||||
renderer.renderMouse2d(mouseX, mouseY, mouse2dAnim);
|
renderer.renderMouse2d(mouseX, mouseY, mouse2dAnim);
|
||||||
|
|
||||||
if(config.getBool("DebugMode")){
|
//if(config.getBool("DebugMode")){
|
||||||
|
if(renderer.getShowDebugUI() == true) {
|
||||||
renderer.renderText(
|
renderer.renderText(
|
||||||
"FPS: " + intToStr(lastFps),
|
"FPS: " + intToStr(lastFps),
|
||||||
coreData.getMenuFontNormal(), Vec3f(1.f), 10, 10, false);
|
coreData.getMenuFontNormal(), Vec3f(1.f), 10, 10, false);
|
||||||
|
Reference in New Issue
Block a user