#include #define getWidth() (lineCount*HLINE) #define GEN_INC 10 #define GRASS_HEIGHT 4 World::World(unsigned int width){ unsigned int i; float inc; lineCount=width+GEN_INC; line=(struct line_t *)calloc(lineCount,sizeof(struct line_t)); // allocate space for the array of lines line[0].y=80; for(i=GEN_INC;i110)line[i].y=110; } for(i=0;ix-x_start)/HLINE; i=v_offset-SCREEN_WIDTH/2; if(i<0)i=0; ie=v_offset+SCREEN_WIDTH/2; if(ie>lineCount)ie=lineCount; glBegin(GL_QUADS); for(i=i;ix+width/2-x_start)/HLINE; if(v->y<=line[i].y){ vel->y=0; v->y=line[i].y+HLINE/2; return; }else{ vel->y-=.05; return; } }