//defines pi as 3.14ect strait replacement by compiler

void  drawStar( int points, Vec2d center,float inRadius, float outRadius){

Vec2d cp; //circle points as vector

for (int i = 0; i<points; i++){

  float angle = ((2*PI)/points)*i; //2*pi is 360 divided into degree segments based on points multiplied by what point your on


   if (i % 2 == 0){

    cp.x= cos(angle) * inRadius;  //gets the length of x and muiltiplies by stretch

    cp.y= sin(angle) * inRadius;  //gets the length of y and muiltiplies by stretch

}  else{ 

    cp.x= cos(angle) * outRadius;  //gets the length of x and muiltiplies by stretch

    cp.y= sin(angle) * outRadius;  //gets the length of y and muiltiplies by stretch

    }

cp = cp+center; //sets the offset center point

    //cp.x += 300; //adds in the of set

    //cp.y += 300; //adds in the of set

    glVertex2f(cp.x,cp.y);

   // glEnd( );

   }

}




int timeGet(){



  

  

  if (timeFlag == false){

  seconds = time (NULL);

  timeFlag = true;

    }

  seconds1 = time (NULL);

  seconds1 = seconds1 - seconds;

  // printf ("%ld seconds since start", seconds1);

  minutes = seconds1/60;

   hours = minutes/60;

  return seconds1;




}







///plots out arc points

Vec2d  drawArc(float radius, int points, Vec2d center,int _spot){

Vec2d centerp; //circle points as vector


 float angle = ((2*PI)/points)*_spot; //2*pi is 360 divided into degree segments based on points multiplied by what spot you want +15 to get twelve oclock


 centerp.x= cos(angle) * radius;  //gets the length of x in unit circle and muiltiplies by radius the size out

 centerp.y= sin(angle) * radius;  //gets the length of y and muiltiplies by radius

 centerp = centerp + center; //sets the offset center point


return centerp;


 }




void  drawCircle(float radius, int points, Vec2d center){

Vec2d cp; //circle points as vector

 glBegin(GL_TRIANGLE_FAN);

for (int i = 0; i<points; i++){

 float angle = ((2*PI)/points)*i; //2*pi is 360 divided into degree segments based on points multiplied by what point your on


 cp.x= cos(angle) * radius;  //gets the length of x in unit circle and muiltiplies by radius the size out

 cp.y= sin(angle) * radius;  //gets the length of y and muiltiplies by radius

 cp = cp+center; //sets the offset center point

 //cp.x += 300; //adds in the of set

 //cp.y += 300; //adds in the of set

 glColor3f( (mouseX/windowW),(mouseY/windowH),0.0f);

 // printf( "%f \n",  mouseX );

 glVertex2f(cp.x,cp.y);



 }

  glEnd( );

}








void displayFunc ( void )  //arg void returns void

{

glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );//clears buffers(what buffers?) by setting bit mask or.

timeGet();

glColor3f( 1,0,0 );//sets color can add a alpha on end 255,255,255,255

//glRectf( mouseX-rectSize, mouseY-rectSize, mouseX+rectSize, mouseY+rectSize); //two arguments cords of perp corners this case based on mouse

    Vec2d center(500,400);

// place your drawing code here

   // glBegin(GL_LINE_LOOP);

    drawElipse(800,center,25,25,seconds1);

/*if (seconds1 % 60 == 0){ // minutes

  if (clocked == true){

  pendulumSpot++;

  clocked =false;

  }

   

//printf( "%d \n",pendulumSpot );

}else{clocked == true;}

if (seconds1 % 3600 == 0){// hours

pendulumSpot2++;

}*/

Vec2d minute = drawArc(200, 60, center, minutes);

Vec2d hour = drawArc(400, 12, center, hours);

//minute.print();

drawCircle(20, 30,minute );// minutes

drawCircle(40, 30,hour );// hours

   // glEnd( );


 

   

glutPostRedisplay(); //tags the current window to be redisplayed or shown through the

                    //next iteration loop. will stop all animation

glutSwapBuffers(); //calls for the display of a the current buffer for the curretn window 

                  // i assume to cut down on jerky motion

}