summaryrefslogtreecommitdiff
path: root/AmpelJonas/cRender.cpp
diff options
context:
space:
mode:
authorGravatar jonas <himself@jonasgunz.de> 2018-12-26 21:18:09 +0100
committerGravatar jonas <himself@jonasgunz.de> 2018-12-26 21:18:09 +0100
commit616951a353caf398908e6e6ce7dddf34a65513e5 (patch)
tree36a5ac46861b3f2c21777d383359f8463676e404 /AmpelJonas/cRender.cpp
parent905f5ad1f16d2ea719eb40c311609f8fad46fd95 (diff)
downloadtermgl-616951a353caf398908e6e6ce7dddf34a65513e5.tar.gz
Added cInput input handler class
cRender: +setConsoleCursor(bool) to disable console cursor main: Example workign with cInput cInput: Input handler class
Diffstat (limited to 'AmpelJonas/cRender.cpp')
-rw-r--r--AmpelJonas/cRender.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/AmpelJonas/cRender.cpp b/AmpelJonas/cRender.cpp
index bc271b8..6d7a70a 100644
--- a/AmpelJonas/cRender.cpp
+++ b/AmpelJonas/cRender.cpp
@@ -23,6 +23,8 @@ cRender::cRender(char _backound, WORD _color, int _sx, int _sy)
if(sizeX < _sx || sizeY < _sy) //Notify Program tha screen is too small for desired Size
iLastError = _ERR_SCREEN_TOO_SMALL_;
+ setConsoleCursor(false);
+
#elif _WIN32 //Windows Specific Code
hstdout = GetStdHandle(STD_OUTPUT_HANDLE); //get handle
@@ -54,6 +56,12 @@ cRender::~cRender()
free(cScreen);
free(wColor);
free(bChanged);
+
+ setConsoleEcho(true);
+
+ #ifdef __linux__
+ setConsoleCursor(true);
+ #endif
}
int cRender::drawPoint(char _c, sPos _pos, bool _overrideCollision, WORD _color)
@@ -185,7 +193,7 @@ int cRender::clear(bool _forceReRender)
int cRender::clear()
{
- return clear(false); //false doesn't work!
+ return clear(false);
}
@@ -336,3 +344,8 @@ void cRender::setConsoleEcho(bool _enable)
(void) tcsetattr(STDIN_FILENO, TCSANOW, &tty);
#endif
}
+
+void cRender::setConsoleCursor(bool _enable)
+{
+ _enable ? write (STDOUT_FILENO, "\e[?25h", 6) : write (STDOUT_FILENO, "\e[?25l", 6);
+}