drawOffsetY=0;\r
void World::draw(void){\r
unsigned int i;\r
- float x,y;\r
+ float x,y,hline=HLINE;\r
static World *root,*cur;\r
root=cur=this;\r
LOOP:\r
if(cur->behind){\r
drawOffsetX+=(cur->getWidth()-cur->behind->getWidth())/2;\r
drawOffsetY+=.3;\r
+ hline/=2;\r
cur=cur->behind;\r
goto LOOP;\r
//behind->draw();\r
LOOP2:\r
glBegin(GL_QUADS);\r
for(i=0;i<cur->lineCount-10;i++){\r
- x=(HLINE*i)-1+drawOffsetX;\r
+ x=(hline*i)-1+drawOffsetX;\r
y=cur->line[i].start+drawOffsetY;\r
glColor3ub(0,200,0);\r
glVertex2f(x ,y);\r
- glVertex2f(x+HLINE,y);\r
- y-=HLINE*2;\r
- glVertex2f(x+HLINE,y);\r
+ glVertex2f(x+hline,y);\r
+ y-=hline*2;\r
+ glVertex2f(x+hline,y);\r
glVertex2f(x ,y);\r
glColor3ub(150,100,50);\r
glVertex2f(x ,y);\r
- glVertex2f(x+HLINE,y);\r
- glVertex2f(x+HLINE,-1);\r
+ glVertex2f(x+hline,y);\r
+ glVertex2f(x+hline,-1);\r
glVertex2f(x ,-1);\r
}\r
glEnd();\r
cur=cur->infront;\r
drawOffsetX-=(cur->getWidth()-cur->behind->getWidth())/2;\r
drawOffsetY-=.3;\r
+ hline*=2;\r
goto LOOP2;\r
}else{\r
drawOffsetX=drawOffsetY=0;\r
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){
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;