aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorClyne Sullivan <tullivan99@gmail.com>2015-09-12 20:01:45 -0400
committerClyne Sullivan <tullivan99@gmail.com>2015-09-12 20:01:45 -0400
commitd6412a6210d4fa25f8c97a98132d27db66ca4514 (patch)
tree610582245c9ed1608b06e42712f787f655636d9f /src
parentce7a96683ee94f8764e7811a5d6167b248accb7c (diff)
uh
Diffstat (limited to 'src')
-rw-r--r--src/World.cpp16
-rw-r--r--src/main.cpp49
2 files changed, 19 insertions, 46 deletions
diff --git a/src/World.cpp b/src/World.cpp
index 8f9308e..790a8e0 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -52,13 +52,14 @@ static float drawOffsetX=0,
drawOffsetY=0;
void World::draw(void){
unsigned int i;
- float x,y;
+ float x,y,hline=HLINE;
static World *root,*cur;
root=cur=this;
LOOP:
if(cur->behind){
drawOffsetX+=(cur->getWidth()-cur->behind->getWidth())/2;
drawOffsetY+=.3;
+ hline/=2;
cur=cur->behind;
goto LOOP;
//behind->draw();
@@ -66,18 +67,18 @@ LOOP:
LOOP2:
glBegin(GL_QUADS);
for(i=0;i<cur->lineCount-10;i++){
- x=(HLINE*i)-1+drawOffsetX;
+ x=(hline*i)-1+drawOffsetX;
y=cur->line[i].start+drawOffsetY;
glColor3ub(0,200,0);
glVertex2f(x ,y);
- glVertex2f(x+HLINE,y);
- y-=HLINE*2;
- glVertex2f(x+HLINE,y);
+ glVertex2f(x+hline,y);
+ y-=hline*2;
+ glVertex2f(x+hline,y);
glVertex2f(x ,y);
glColor3ub(150,100,50);
glVertex2f(x ,y);
- glVertex2f(x+HLINE,y);
- glVertex2f(x+HLINE,-1);
+ glVertex2f(x+hline,y);
+ glVertex2f(x+hline,-1);
glVertex2f(x ,-1);
}
glEnd();
@@ -85,6 +86,7 @@ LOOP2:
cur=cur->infront;
drawOffsetX-=(cur->getWidth()-cur->behind->getWidth())/2;
drawOffsetY-=.3;
+ hline*=2;
goto LOOP2;
}else{
drawOffsetX=drawOffsetY=0;
diff --git a/src/main.cpp b/src/main.cpp
index ed82e5e..25d76b5 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -16,34 +16,21 @@ static unsigned int tickCount = 0,
currentTime = 0,
deltaTime = 0;
-Entity *entPlay; //The player base
-Entity *entnpc; //The NPC base
-Player player; //The actual player object
-NPC npc;
-UIClass ui; //Yep
-World *currentWorld;//u-huh
-
-//static int randNext=1;
-
-void irand(unsigned int seed){
- srand(seed);
-}
-
-int grand(void){
- return rand();
-}
-
-void logic();
+Entity *entPlay; //The player base
+Entity *entnpc; //The NPC base
+Player player; //The actual player object
+NPC npc; // A test NPC
+UIClass ui; // Handles the user interface
+World *currentWorld; // Points to the current 'world' the player is in
float interpolate(float goal, float current, float dt){
- float difference = goal - current;
- if(difference > dt){
- return current + dt;}
- if(difference < dt){
- return current - dt;}
+ float difference=goal-current;
+ if(difference>dt)return current+dt;
+ if(difference<dt)return current-dt;
return goal;
}
+void logic();
void render();
int main(int argc,char **argv){
@@ -102,22 +89,6 @@ int main(int argc,char **argv){
currentWorld=w;
currentWorld->addLayer(3);
currentWorld->addEntity((void *)entnpc);
- //currentWorld->addLayer();
-
- // Save the world if necessary
- /*FILE *f=fopen("world.dat","r");
- unsigned int fSave;
- if(!f){
- f=fopen("world.dat","w");
- if(f){
- fSave=time(NULL);
- fwrite(&fSave,sizeof(unsigned int),1,f);
- fclose(f);
- }
- }else{
- fread(&fSave,sizeof(unsigned int),1,f);
- fclose(f);
- }*/
float gw;