From 931de7809213903c2a349c93b049afebda2b0242 Mon Sep 17 00:00:00 2001 From: Jonas Gunz Date: Thu, 7 Mar 2019 02:41:26 +0100 Subject: Deactivated color to fix #5 temporarily --- Makefile | 2 +- example/pong.cpp | 8 ++++---- src/cObjectHandler.cpp | 2 +- src/cRender.cpp | 13 +++++++++++-- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index c948060..4a44197 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ CC = /usr/bin/g++ -CFLAGS = -Wall -std=c++11 -shared -fPIC +CFLAGS = -Wall -g -std=c++11 -shared -fPIC DEBUGFLAGS = -Wall -g -std=c++11 LDFLAGS = SONAME = engine diff --git a/example/pong.cpp b/example/pong.cpp index ff84639..093338c 100644 --- a/example/pong.cpp +++ b/example/pong.cpp @@ -75,16 +75,16 @@ int main() edget edgeBottom; int iEdgeTop = screen.createObject(&edgeTop); - screen.moveObject(iEdgeTop, {2,0}, _MOVE_FORCE_ABSOLUTE); + screen.moveObject(iEdgeTop, {0,0}, _MOVE_FORCE_ABSOLUTE); int iEdgeBottom = screen.createObject(&edgeBottom); - screen.moveObject(iEdgeBottom, {0,21}, _MOVE_FORCE_ABSOLUTE); + screen.moveObject(iEdgeBottom, {0,20}, _MOVE_FORCE_ABSOLUTE); int iEdgeLeft = screen.createObject(&edgeLeft); screen.moveObject(iEdgeLeft, {0,0}, _MOVE_FORCE_ABSOLUTE); int iEdgeRight = screen.createObject(&edgeRight); - screen.moveObject(iEdgeRight, {43,0}, _MOVE_FORCE_ABSOLUTE); + screen.moveObject(iEdgeRight, {40,0}, _MOVE_FORCE_ABSOLUTE); int iAball= screen.createObject(&aball); @@ -138,7 +138,7 @@ int main() } } - //screen.moveObject(iAball, aball.getV(), _MOVE_RELATIVE); + screen.moveObject(iAball, aball.getV(), _MOVE_RELATIVE); screen.write(); render.render(); diff --git a/src/cObjectHandler.cpp b/src/cObjectHandler.cpp index 3b69cfb..da0dcc9 100644 --- a/src/cObjectHandler.cpp +++ b/src/cObjectHandler.cpp @@ -163,7 +163,7 @@ void cObjectHandler::buildHitmap() iHitMap.push_back(cp); } - while (size.x <= (int)iHitMap.size()) + while (size.x < (int)iHitMap.size()) { iHitMap.pop_back(); } diff --git a/src/cRender.cpp b/src/cRender.cpp index 874b955..9d13b7c 100644 --- a/src/cRender.cpp +++ b/src/cRender.cpp @@ -41,7 +41,15 @@ cRender::cRender(char _backound, WORD _color, unsigned int _sx, unsigned int _sy }//render() -cRender::cRender() {} +cRender::cRender() +{ + cScreen = NULL; + wColor = NULL; + bBlockRender = false; + cBackound = 0; + wBackColor = 0; + sizeX = sizeY = 0; +} cRender::~cRender() { @@ -191,8 +199,9 @@ int cRender::render(void) #elif __linux__ //gotoxy(x,y) now included!! char buffer[20]; - int cbuf = sprintf(buffer,"\e[%u;%uH\e[%im%c", i + 1, o + 1, wColor[o][i], cScreen[o][i]); + //int cbuf = sprintf(buffer,"\e[%u;%uH\e[%im%c", i + 1, o + 1, wColor[o][i], 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); #endif //__linux__ -- cgit v1.2.3