diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cRender.cpp | 32 | ||||
-rw-r--r-- | src/cRender.h | 6 |
2 files changed, 35 insertions, 3 deletions
diff --git a/src/cRender.cpp b/src/cRender.cpp index 71c4d76..3b4573a 100644 --- a/src/cRender.cpp +++ b/src/cRender.cpp @@ -15,6 +15,9 @@ cRender::cRender(char _backound, WORD _color, unsigned int _sx, unsigned int _sy lastFrameTime = 0; lastRenderTime = 0; + bMute = false; + bLockScreenSize = false; + #ifdef __linux__ //In Linux, setting Console size is not supported, so it gets Size of Console (Window) instead. wDefColor = _COL_DEFAULT; @@ -23,7 +26,7 @@ cRender::cRender(char _backound, WORD _color, unsigned int _sx, unsigned int _sy setAlternateBufferScreen(true); setConsoleCursor(false); - setBufferSize( getConsoleWindowSize() ); + //setBufferSize( getConsoleWindowSize() ); if(sizeX < _sx || sizeY < _sy) //Notify Program tha screen is too small for desired Size iLastError = _ERR_SCREEN_TOO_SMALL_; @@ -40,7 +43,7 @@ cRender::cRender(char _backound, WORD _color, unsigned int _sx, unsigned int _sy #endif //_WIN32 setConsoleEcho(false); - clear(true); //Init backround array + //clear(true); //Init backround array }//render() @@ -240,7 +243,9 @@ int cRender::render(void) int cbuf = sprintf(buffer,"\e[%u;%uH\e[%sm%c\e[0m", i + 1, o + 1, colorstr, cScreen[o][i]); // Position Color Origin is at 1,1 //int cbuf = sprintf(buffer,"\e[%u;%uH%c", i + 1, o + 1, cScreen[o][i]); - write (STDOUT_FILENO, buffer, cbuf); + + if(!bMute) + write (STDOUT_FILENO, buffer, cbuf); #endif //__linux__ } @@ -361,6 +366,9 @@ void cRender::setConsoleCursor(bool _enable) void cRender::setBufferSize(sPos _size) { + if(bLockScreenSize) + return; + if(_size.x == (int)sizeX && _size.y == (int)sizeY) return; @@ -481,3 +489,21 @@ void cRender::waitForFrametime() } + +void cRender::forceScreenSize(sPos _size) +{ + if(_size.x || _size.y) + { + setBufferSize(_size); + bLockScreenSize = true; + } + else + { + bLockScreenSize = false; + } +} + +void cRender::mute(bool _mute) +{ + bMute = _mute; +} diff --git a/src/cRender.h b/src/cRender.h index 19a0367..6aa4cce 100644 --- a/src/cRender.h +++ b/src/cRender.h @@ -142,6 +142,9 @@ public: */ void setTargetFPS(unsigned int _fps); + void forceScreenSize(sPos _size); + + void mute(bool _mute); protected: /** Empty Constructor for being inheritable @@ -156,6 +159,9 @@ protected: bool bBlockRender; //* Used by children to block render function + bool bMute; + bool bLockScreenSize; + char **cScreen; //* Pixel Map WORD **wColor; |