aboutsummaryrefslogtreecommitdiff
path: root/AmpelJonas/cRender.cpp
diff options
context:
space:
mode:
authorGravatar jonas <himself@jonasgunz.de> 2018-12-07 13:10:00 +0100
committerGravatar jonas <himself@jonasgunz.de> 2018-12-07 13:10:00 +0100
commitc7ee3d48002585362505b68aabd1093a2877e1cc (patch)
tree1e84a4a7290eb7c984683980c260658a85a91f5d /AmpelJonas/cRender.cpp
parent8c81604b5a22a72885ff5d6270a251172fa90319 (diff)
downloadtermgl-c7ee3d48002585362505b68aabd1093a2877e1cc.tar.gz
cRender ported to Linux.
Functional
Diffstat (limited to 'AmpelJonas/cRender.cpp')
-rw-r--r--AmpelJonas/cRender.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/AmpelJonas/cRender.cpp b/AmpelJonas/cRender.cpp
index 4f18df5..61d4843 100644
--- a/AmpelJonas/cRender.cpp
+++ b/AmpelJonas/cRender.cpp
@@ -13,8 +13,8 @@ cRender::cRender(char _backound, WORD _color, int _sx, int _sy)
struct winsize w;
ioctl(STDOUT_FILENO, TIOCGWINSZ, &w);
- sizeX = w.ws_row;
- sizeY = w.ws_col;
+ sizeX = w.ws_col;
+ sizeY = w.ws_row - 1;
if(sizeX < _sx || sizeY < _sy) //Notify Program tha screen is too small for desired Size
iLastError = _ERR_SCREEN_TOO_SMALL_;
@@ -38,11 +38,11 @@ cRender::cRender(char _backound, WORD _color, int _sx, int _sy)
//Initialize 2D array
cScreen = (char**)malloc(sizeof *cScreen * sizeX);
- for (int i = 0; i < _sx; i++)
+ for (int i = 0; i < sizeX; i++)
cScreen[i] = (char*)malloc(sizeof *cScreen[i] * sizeY);
wColor = (WORD**)malloc(sizeof *wColor * sizeX);
- for (int i = 0; i < _sx; i++)
+ for (int i = 0; i < sizeX; i++)
wColor[i] = (WORD*)malloc(sizeof *wColor[i] * sizeY);
clear(); //Init backround array
@@ -150,7 +150,7 @@ int cRender::render(void)
SetConsoleTextAttribute(hstdout, wColor[o][i] | _COL_INTENSITY);
cout << cScreen[o][i];
#elif __linux__
- cout << "\033["<< wColor[o][i] <<"m"<< cScreen[o][i] <<"\033[0m";
+ cout << "\033["<< wColor[o][i] <<"m"<< cScreen[o][i];
#endif
}
cout << endl; //New Line Feed