From 2187b2dbd6107835868f2b464dac076792545b9a Mon Sep 17 00:00:00 2001 From: jonas Date: Tue, 26 Mar 2019 13:38:14 +0100 Subject: cRender: Added enableDebugInfo() to print debug info --- src/cRender.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/cRender.cpp') diff --git a/src/cRender.cpp b/src/cRender.cpp index ddc52df..818b11b 100644 --- a/src/cRender.cpp +++ b/src/cRender.cpp @@ -17,6 +17,7 @@ cRender::cRender(char _backound, WORD _color) bMute = false; bLockScreenSize = false; + bPrintDebugInfo = false; #ifdef __linux__ //In Linux, setting Console size is not supported, so it gets Size of Console (Window) instead. @@ -443,12 +444,15 @@ void cRender::setTargetFPS(unsigned int _fps) void cRender::printDebugInfo() { + if(!bPrintDebugInfo) + return; + char dbgtxt[30]; double lrt = (double)lastFrameTime / CLOCKS_PER_SEC; - double fps = getFrametime()? 1/getFrametime():0; + double fps = getFrametime() ? 1/getFrametime() : 0; - sprintf(dbgtxt, "R: %f F: %f", lrt, fps); + sprintf(dbgtxt, "R: %f F: %f ", lrt, fps); drawText(dbgtxt, {0,0}, _COL_BLACK | _COL_WHITE_BG); } @@ -490,3 +494,8 @@ void cRender::mute(bool _mute) { bMute = _mute; } + +void cRender::enableDebugInfo(bool _enable) +{ + bPrintDebugInfo = _enable; +} -- cgit v1.2.3