int main(int argc, char **argv) { int done = 0; yeti_pvr_init(); /* Initialize the PVR, set up vertex buffers, etc... call this first! */ yeti_pvr_def_pal(); /* Use the palette defined in the original Yeti source code. */ yeti_pvr_def_tex(); /* Use the textures defined in the original Yeti source code. */ LoadSprites(); yeti_init(&yeti, &framebuffer, &framebuffer, textures, palette, lua); game_init(&yeti); while(done==0) /* While we're not done playing, keep looping. */ { IdleFunc(); } return 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++; } } }