summaryrefslogtreecommitdiff
path: root/src/cRender.cpp
diff options
context:
space:
mode:
authorGravatar jonas <himself@jonasgunz.de> 2019-03-26 11:07:48 +0100
committerGravatar jonas <himself@jonasgunz.de> 2019-03-26 11:07:48 +0100
commit02389b39c87d21fa5b38dbe7cf0cb5a83118c4b6 (patch)
tree329c337074ffe13f006b3ca3d07b08a7e431680d /src/cRender.cpp
parent28719acc7e73e4ed44af3a40aae06d61ba4da8a5 (diff)
downloadtermgl-02389b39c87d21fa5b38dbe7cf0cb5a83118c4b6.tar.gz
cRender: Added divide by zero check
Diffstat (limited to 'src/cRender.cpp')
-rw-r--r--src/cRender.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/cRender.cpp b/src/cRender.cpp
index 148be91..ddc52df 100644
--- a/src/cRender.cpp
+++ b/src/cRender.cpp
@@ -445,7 +445,10 @@ void cRender::printDebugInfo()
{
char dbgtxt[30];
- sprintf(dbgtxt, "R: %f F: %f", ((float)lastRenderTime) / CLOCKS_PER_SEC, 1/getFrametime());
+ double lrt = (double)lastFrameTime / CLOCKS_PER_SEC;
+ double fps = getFrametime()? 1/getFrametime():0;
+
+ sprintf(dbgtxt, "R: %f F: %f", lrt, fps);
drawText(dbgtxt, {0,0}, _COL_BLACK | _COL_WHITE_BG);
}