aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar jonas <himself@jonasgunz.de> 2019-03-26 13:38:14 +0100
committerGravatar jonas <himself@jonasgunz.de> 2019-03-26 13:38:14 +0100
commit2187b2dbd6107835868f2b464dac076792545b9a (patch)
tree81110eb35f5239c5e82fa338dcca50aa3b362ba7 /src
parent02389b39c87d21fa5b38dbe7cf0cb5a83118c4b6 (diff)
downloadtermgl-2187b2dbd6107835868f2b464dac076792545b9a.tar.gz
cRender: Added enableDebugInfo() to print debug info
Diffstat (limited to 'src')
-rw-r--r--src/cRender.cpp13
-rw-r--r--src/cRender.h5
2 files changed, 16 insertions, 2 deletions
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;
+}
diff --git a/src/cRender.h b/src/cRender.h
index 41dd0c6..4aa2c4d 100644
--- a/src/cRender.h
+++ b/src/cRender.h
@@ -151,6 +151,10 @@ public:
*/
void mute(bool _mute);
+ /** Enables Debug info Printing to screen
+ */
+ void enableDebugInfo(bool _enable);
+
protected:
/** Empty Constructor for being inheritable
*/
@@ -166,6 +170,7 @@ protected:
bool bMute;
bool bLockScreenSize;
+ bool bPrintDebugInfo;
char **cScreen;
//* Pixel Map