From 5f0e5cf623f4e1f0bcf9644926a13c79e96652b8 Mon Sep 17 00:00:00 2001 From: Faerbit Date: Sun, 15 Mar 2015 22:32:13 +0100 Subject: [PATCH] Changing window title and moving fps display to debug build. --- game/main.cc | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/game/main.cc b/game/main.cc index e64d2a8..fa4a467 100644 --- a/game/main.cc +++ b/game/main.cc @@ -158,9 +158,6 @@ int main( int argc, char *argv[] ) exit( -1 ); } - // Set window title to binary name (without the path): - std::vector tmp = ACGL::Utils::StringHelpers::split( std::string( argv[0] ), '/' ); - glfwSetWindowTitle(window, tmp[tmp.size()-1].c_str() ); // Ensure we can capture the escape key being pressed below glfwSetInputMode(window, GLFW_STICKY_KEYS, 1); // set Callbacks @@ -181,7 +178,7 @@ int main( int argc, char *argv[] ) int frameCount = 0; - const double FPSdelay = 2.0; + const double FPSdelay = 1.0; double startTimeInSeconds = glfwGetTime(); double showNextFPS = startTimeInSeconds + FPSdelay; @@ -192,15 +189,17 @@ int main( int argc, char *argv[] ) do { double now = glfwGetTime()- startTimeInSeconds; - - if (showNextFPS <= now) { - std::stringstream sstream (std::stringstream::in | std::stringstream::out); - sstream << std::setprecision(1) << std::fixed - << tmp[tmp.size()-1] << " - FPS: " << frameCount / (now-showNextFPS + FPSdelay) << " " << 1000 * (now-showNextFPS + FPSdelay)/frameCount << " msec"; - glfwSetWindowTitle(window, sstream.str().c_str() ); - showNextFPS = now + FPSdelay; - frameCount = 0; - } + + #ifdef SAXUM_DEBUG + if (showNextFPS <= now) { + std::stringstream sstream (std::stringstream::in | std::stringstream::out); + sstream << std::setprecision(1) << std::fixed + << "Saxum" << " - FPS: " << frameCount / (now-showNextFPS + FPSdelay) << " " << 1000 * (now-showNextFPS + FPSdelay)/frameCount << " msec"; + glfwSetWindowTitle(window, sstream.str().c_str() ); + showNextFPS = now + FPSdelay; + frameCount = 0; + } + #endif if (app.isGameStarted()) { static float gameStart = now; if (app.isLocked() && app.getIgnoredMouseUpdates() == 0) {