예제 #1
0
void glutSwapBuffers(void)
{
   glFlush();

   if(!(DisplayMode & GLUT_DOUBLE))
      return;

   if(ActiveMenu)
      DrawMenus();
   DrawCursor();

   if(Visible) {
      Swapping = 1;
      glFBDevSwapBuffers(Buffer);
      Swapping = 0;
   }

   /* if there was a vt switch while swapping, switch now */
   if(VTSwitch) {
      if(ioctl(ConsoleFD, VT_ACTIVATE, VTSwitch) < 0)
	 sprintf(exiterror, "Error switching console\n");
      VTSwitch = 0;
   }
}
예제 #2
0
void glutMainLoop(void)
{
   int idleiters;

   if(ReshapeFunc)
      ReshapeFunc(VarInfo.xres, VarInfo.yres);

   if(!DisplayFunc) {
      sprintf(exiterror, "Fatal Error: No Display Function registered\n");
      exit(0);
   }   

   for(;;) {
      ProcessTimers();

      if(Active)
	 ReceiveInput();
      else
	 if(VisiblePoll)
	    TestVisible();

      if(IdleFunc)
	 IdleFunc();
      
      if(VisibleSwitch) {
	 VisibleSwitch = 0;
	 if(VisibilityFunc)
	    VisibilityFunc(Visible ? GLUT_VISIBLE : GLUT_NOT_VISIBLE);
      }

      if(Resized) {
         SetVideoMode();
         CreateBuffer();

         if(!glFBDevMakeCurrent( Context, Buffer, Buffer )) {
            sprintf(exiterror, "Failure to Make Current\n");
            exit(0);
         }

         InitializeMenus();

         if(ReshapeFunc)
            ReshapeFunc(VarInfo.xres, VarInfo.yres);

         Redisplay = 1;
         Resized = 0;
      }

      if(Visible && Redisplay) {
	 Redisplay = 0;
         EraseCursor();
	 DisplayFunc();
	 if(!(DisplayMode & GLUT_DOUBLE)) {
	    if(ActiveMenu)
	       DrawMenus();
            DrawCursor();
	 }
         idleiters = 0;
      } else {
         /* we sleep if not receiving redisplays, and
            the main loop is running faster than 2khz */

         static int lasttime;
         int time = glutGet(GLUT_ELAPSED_TIME);
         if(time > lasttime) {
            if(idleiters >= 2)
               usleep(100);

            idleiters = 0;
            lasttime = time;
         }
         idleiters++;         
      }
   }
}
예제 #3
0
파일: game.c 프로젝트: jc429/276game
void DrawMainMenu(){
	DrawMenus();
	DrawMouse();
}