Changing window title and moving fps display to debug build.
This commit is contained in:
parent
0ae43db53e
commit
5f0e5cf623
25
game/main.cc
25
game/main.cc
@ -158,9 +158,6 @@ int main( int argc, char *argv[] )
|
|||||||
exit( -1 );
|
exit( -1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set window title to binary name (without the path):
|
|
||||||
std::vector<std::string> 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
|
// Ensure we can capture the escape key being pressed below
|
||||||
glfwSetInputMode(window, GLFW_STICKY_KEYS, 1);
|
glfwSetInputMode(window, GLFW_STICKY_KEYS, 1);
|
||||||
// set Callbacks
|
// set Callbacks
|
||||||
@ -181,7 +178,7 @@ int main( int argc, char *argv[] )
|
|||||||
|
|
||||||
int frameCount = 0;
|
int frameCount = 0;
|
||||||
|
|
||||||
const double FPSdelay = 2.0;
|
const double FPSdelay = 1.0;
|
||||||
double startTimeInSeconds = glfwGetTime();
|
double startTimeInSeconds = glfwGetTime();
|
||||||
double showNextFPS = startTimeInSeconds + FPSdelay;
|
double showNextFPS = startTimeInSeconds + FPSdelay;
|
||||||
|
|
||||||
@ -192,15 +189,17 @@ int main( int argc, char *argv[] )
|
|||||||
do {
|
do {
|
||||||
|
|
||||||
double now = glfwGetTime()- startTimeInSeconds;
|
double now = glfwGetTime()- startTimeInSeconds;
|
||||||
|
|
||||||
if (showNextFPS <= now) {
|
#ifdef SAXUM_DEBUG
|
||||||
std::stringstream sstream (std::stringstream::in | std::stringstream::out);
|
if (showNextFPS <= now) {
|
||||||
sstream << std::setprecision(1) << std::fixed
|
std::stringstream sstream (std::stringstream::in | std::stringstream::out);
|
||||||
<< tmp[tmp.size()-1] << " - FPS: " << frameCount / (now-showNextFPS + FPSdelay) << " " << 1000 * (now-showNextFPS + FPSdelay)/frameCount << " msec";
|
sstream << std::setprecision(1) << std::fixed
|
||||||
glfwSetWindowTitle(window, sstream.str().c_str() );
|
<< "Saxum" << " - FPS: " << frameCount / (now-showNextFPS + FPSdelay) << " " << 1000 * (now-showNextFPS + FPSdelay)/frameCount << " msec";
|
||||||
showNextFPS = now + FPSdelay;
|
glfwSetWindowTitle(window, sstream.str().c_str() );
|
||||||
frameCount = 0;
|
showNextFPS = now + FPSdelay;
|
||||||
}
|
frameCount = 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
if (app.isGameStarted()) {
|
if (app.isGameStarted()) {
|
||||||
static float gameStart = now;
|
static float gameStart = now;
|
||||||
if (app.isLocked() && app.getIgnoredMouseUpdates() == 0) {
|
if (app.isLocked() && app.getIgnoredMouseUpdates() == 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user