From 905f5ad1f16d2ea719eb40c311609f8fad46fd95 Mon Sep 17 00:00:00 2001 From: jonas Date: Wed, 26 Dec 2018 15:18:23 +0100 Subject: Fixed render problem in performance Render mode. in render.cpp:render() moved gotoxy() out of if(bChanged) fixed Issue. Not optimal --- AmpelJonas/main.cpp | 44 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 40 insertions(+), 4 deletions(-) (limited to 'AmpelJonas/main.cpp') diff --git a/AmpelJonas/main.cpp b/AmpelJonas/main.cpp index ea729ac..18b483e 100644 --- a/AmpelJonas/main.cpp +++ b/AmpelJonas/main.cpp @@ -9,7 +9,45 @@ int main() unsigned long int framecounter = 0; cRender a(' ', _COL_DEFAULT, 10,10); a.render(); - cObjectHandler b(&a); + + sPos pos = {0,10}; + int dirX = 1; + int dirY = -1; + + while(1) + { + pos.x += 2 * dirX; + pos.y += 1 * dirY; + + if(pos.x >= a.getSize().x) { + pos.x = a.getSize().x; + dirX *= -1; + } + if(pos.x <= 0) { + pos.x = 0; + dirX *= -1; + } + + if(pos.y >= a.getSize().y) { + pos.y = a.getSize().y; + dirY *= -1; + } + if(pos.y <= 0) { + pos.y = 0; + dirY *= -1; + } + + a.clear(); + a.drawPoint('X', pos, true, _COL_GREEN); + a.drawText(to_string(framecounter), {0,0}, _COL_RED); + a.render(); + + framecounter++; + //cin.get(); + //usleep(100*1000); + } + + /*cObjectHandler b(&a); cObject x(1,1); int i = b.createObject(&x); @@ -48,8 +86,6 @@ int main() framecounter++; //cin.get(); usleep(100*1000); - //for(unsigned int i = 0; i < 6000; i++) - //for(unsigned int o = 0; o < 3000; o++); - } + }*/ return 0; } -- cgit v1.2.3