From 3782c6ae9581063b3ed9e45467ce43f0b320bb19 Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Fri, 11 Sep 2015 22:58:02 -0400 Subject: improved layers --- include/World.h | 4 ++-- src/World.cpp | 8 +++++++- src/main.cpp | 6 ++++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/include/World.h b/include/World.h index 91eb81e..13ccafc 100644 --- a/include/World.h +++ b/include/World.h @@ -6,7 +6,7 @@ #define goWorldLeft(w) if(w->toLeft){w=w->toLeft;} #define goWorldRight(w) if(w->toRight){w=w->toRight;} -#define LAYER_SCALE 1 +#define LAYER_SCALE 2 class World { private: @@ -15,7 +15,7 @@ private: double start; // Where to change to dirt, going down (y) } __attribute__ ((packed)) *line; unsigned int lineCount; - bool root; + bool root,drawn; public: World *behind,*infront; World *toLeft,*toRight; diff --git a/src/World.cpp b/src/World.cpp index 6b1b317..f6bb70e 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -54,13 +54,19 @@ static float back=0; void World::draw(void){ unsigned int i; if(behind){ - hline/=1.5; + hline*=.5; back+=.2; behind->draw(); + }else{ + hline*=.5; + back+=.2; } if(root){ hline=HLINE; back=0; + }else{ + hline*=2; + back-=.2; } glBegin(GL_QUADS); for(i=0;iaddLayer(); currentWorld->setRoot(); + currentWorld->addLayer(); + //currentWorld->addLayer(); + //currentWorld->addLayer(); // Save the world if necessary /*FILE *f=fopen("world.dat","r"); @@ -172,7 +174,7 @@ void render(){ **** RENDER STUFF HERE **** **************************/ - currentWorld->draw(); + currentWorld->draw(); // layers dont scale x correctly... glColor3ub(120,30,30); glRectf(player.loci.x, player.loci.y, player.loci.x + player.width, player.loci.y + player.height); -- cgit v1.2.3