////////////////////////////////////////////////// // This is called on a glutPostRedisplay ////////////////////////////////////////////////// static void OnRedisplay() { glClearColor( 1.0f, 1.0f, 1.0f, 1.0f ); glClear( GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT ); glEnable( GL_DEPTH_TEST ); glEnable( GL_BLEND ); glEnable( GL_TEXTURE_2D); // set up the projection matrix glMatrixMode( GL_PROJECTION ); glLoadIdentity(); gluOrtho2D( 0,640,0,480 ); // initialize your matrix stack used for transforming your models glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); // !!!TODO!!!: replace the following with your own opengl commands! count=0; glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear The Screen And The Depth Buffer glLoadIdentity(); // Reset The View app.dek.draw(); app.drawMeter(); app.drawScore(); count=0; // update the last time lasttime = currenttime; currenttime = getTime(); timechange = currenttime - lasttime; app.ltime = app.ltime + timechange; app.myMeter = DIFFI - app.ltime; if(app.ltime >= DIFFI){ for(int i=0;i<12;i++){ if(app.dek.isSelected(i)) app.dek.deselectCard(i); app.dek.setCardAttributeRandom(i); } app.checkForWinner(); } glutSwapBuffers(); }
// Initialize the application // initialize the state of your app here if needed... static int OnApplicationInit() { // Don't put open GL code here, this func may be called at anytime // even before the API is initialized // (like before a graphics context is obtained) app.score=0; app.ltime=0; app.myMeter=10; app.drawScore(); // !!!TODO!!!: put your initialization code here. return 0; }