diff options
author | jonas <himself@jonasgunz.de> | 2019-03-26 11:07:48 +0100 |
---|---|---|
committer | jonas <himself@jonasgunz.de> | 2019-03-26 11:07:48 +0100 |
commit | 02389b39c87d21fa5b38dbe7cf0cb5a83118c4b6 (patch) | |
tree | 329c337074ffe13f006b3ca3d07b08a7e431680d /src/cRender.cpp | |
parent | 28719acc7e73e4ed44af3a40aae06d61ba4da8a5 (diff) | |
download | termgl-02389b39c87d21fa5b38dbe7cf0cb5a83118c4b6.tar.gz |
cRender: Added divide by zero check
Diffstat (limited to 'src/cRender.cpp')
-rw-r--r-- | src/cRender.cpp | 5 |
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); } |