- adjusted ? toggle key to always allow toggling of FPS (whether or not debug in enabled)
This commit is contained in:
parent
aecc708942
commit
b0b775dc49
|
@ -1239,9 +1239,16 @@ void Game::render2d(){
|
|||
renderer.renderChatManager(&chatManager);
|
||||
|
||||
//debug info
|
||||
|
||||
|
||||
bool perfLogging = false;
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled == true ||
|
||||
SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled == true) {
|
||||
perfLogging = true;
|
||||
}
|
||||
|
||||
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+= "PosObjWord: " + intToStr(gui.getPosObjWorld().x) + "," + intToStr(gui.getPosObjWorld().y)+"\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(),
|
||||
Vec3f(1.0f), 10, 500, false);
|
||||
|
||||
|
@ -1314,14 +1321,12 @@ void Game::render2d(){
|
|||
}
|
||||
renderer.renderUnitTitles(coreData.getMenuFontNormal(),Vec3f(1.0f));
|
||||
}
|
||||
else {
|
||||
if(renderer.getAllowRenderUnitTitles() == true) {
|
||||
renderer.setAllowRenderUnitTitles(false);
|
||||
}
|
||||
else if(renderer.getAllowRenderUnitTitles() == true) {
|
||||
renderer.setAllowRenderUnitTitles(false);
|
||||
}
|
||||
|
||||
//network status
|
||||
if(renderNetworkStatus) {
|
||||
if(renderNetworkStatus == true) {
|
||||
if(NetworkManager::getInstance().getGameNetworkInterface() != NULL) {
|
||||
renderer.renderText(
|
||||
NetworkManager::getInstance().getGameNetworkInterface()->getNetworkStatus(),
|
||||
|
@ -1339,10 +1344,10 @@ void Game::render2d(){
|
|||
//2d mouse
|
||||
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);
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -161,6 +161,8 @@ Renderer::Renderer(){
|
|||
no2DMouseRendering = config.getBool("No2DMouseRendering","false");
|
||||
maxConsoleLines= config.getInt("ConsoleMaxLines");
|
||||
|
||||
showDebugUI = false;
|
||||
|
||||
gi.setFactory(fr.getGraphicsFactory(config.getString("FactoryGraphics")));
|
||||
GraphicsFactory *graphicsFactory= GraphicsInterface::getInstance().getFactory();
|
||||
|
||||
|
|
|
@ -257,6 +257,7 @@ private:
|
|||
std::vector<std::pair<Unit *,Vec3f> > renderUnitTitleList;
|
||||
|
||||
bool no2DMouseRendering;
|
||||
bool showDebugUI;
|
||||
|
||||
private:
|
||||
Renderer();
|
||||
|
@ -388,6 +389,9 @@ public:
|
|||
bool getNo2DMouseRendering() const { return no2DMouseRendering; }
|
||||
void setNo2DMouseRendering(bool value) { no2DMouseRendering = value; }
|
||||
|
||||
bool getShowDebugUI() const { return showDebugUI; }
|
||||
void setShowDebugUI(bool value) { showDebugUI = value; }
|
||||
|
||||
private:
|
||||
//private misc
|
||||
float computeSunAngle(float time);
|
||||
|
|
|
@ -116,7 +116,6 @@ void Gui::init(Game *game){
|
|||
this->console= game->getConsole();
|
||||
this->world= game->getWorld();
|
||||
selection.init(this, world->getThisFactionIndex());
|
||||
this->showDebugUI = false;
|
||||
}
|
||||
|
||||
void Gui::end(){
|
||||
|
@ -338,9 +337,6 @@ void Gui::hotKey(char key) {
|
|||
else if(key == configKeys.getCharKey("HotKeySelectBuiltBuilding")) {
|
||||
selectInterestingUnit(iutBuiltBuilding);
|
||||
}
|
||||
else if(key == configKeys.getCharKey("HotKeyShowDebug")) {
|
||||
this->showDebugUI = !this->showDebugUI;
|
||||
}
|
||||
else if(key == configKeys.getCharKey("HotKeyDumpWorldToLog")) {
|
||||
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());
|
||||
|
|
|
@ -132,8 +132,6 @@ private:
|
|||
|
||||
CardinalDir selectedBuildingFacing;
|
||||
|
||||
bool showDebugUI;
|
||||
|
||||
public:
|
||||
Gui();
|
||||
void init(Game *game);
|
||||
|
@ -178,8 +176,6 @@ public:
|
|||
void switchToNextDisplayColor();
|
||||
void onSelectionChanged();
|
||||
|
||||
bool getShowDebugUI() const { return showDebugUI; }
|
||||
|
||||
private:
|
||||
|
||||
//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__);
|
||||
}
|
||||
|
||||
|
|
|
@ -109,7 +109,8 @@ void MainMenu::render(){
|
|||
state->render();
|
||||
renderer.renderMouse2d(mouseX, mouseY, mouse2dAnim);
|
||||
|
||||
if(config.getBool("DebugMode")){
|
||||
//if(config.getBool("DebugMode")){
|
||||
if(renderer.getShowDebugUI() == true) {
|
||||
renderer.renderText(
|
||||
"FPS: " + intToStr(lastFps),
|
||||
coreData.getMenuFontNormal(), Vec3f(1.f), 10, 10, false);
|
||||
|
|
Loading…
Reference in New Issue