Example #1
0
File: Main.cpp Project: Seyfel/SGI
void display() {
	timer.stopDeltaChrono();
	timer.startDeltaChrono();

	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	input.update();
	camera.render();
	updateScene();

	//showFPS();
	showSpeed();

	glutSwapBuffers();
	glutPostRedisplay();
}
Example #2
0
//Think method
void 
World::Think(float time)
{
	if(mGameOver){
		if(!mShowFinalUI){
			mShowFinalUI = true;
			showFinalUI();
		} else{
			handleFinalUI();
		}
	} else {

		if(mInputHandler->IsKeyDown(OIS::KC_ESCAPE) && !mShowUI && !mShowInitialUI){
			UICount = UICount + 1;
			if(UICount > 10){
				showUI();
				mShowUI = true;
				UICount = 0;
			}
		
		} else if(mInputHandler->IsKeyDown(OIS::KC_ESCAPE) && mShowUI && !mShowInitialUI){
		
			UICount = UICount + 1;
			if(UICount > 10){
				hideUI();
				mShowUI = false;
				UICount = 0;
			}
		}
		if(mShowUI || mShowInitialUI){
			//Handle UI
			handleUI();
			hideSpeed();
		} else {
			PhysicsWorld::getInstance()->simulate(time);
			//Control Player
			controlPlayer(time);
			updateLaps();
			showSpeed();
		
		}
	}
	
	
	
}
Example #3
0
/*
*   Main function of the program. get terminal settings using tcgetattr()
*   in a local termios object. If no command line arguments given calls
*   displayProperties() to display properties of termios, otherwise
*   calls setProperties() to set command line arguments to termios object.
*   If all the arguments are processed successfully calls tcsetattr() to
*   overwrite terminal settings with local termios object.
*   parameters:
*       o int argc - number of command line arguments
*       o char* argv[] - array of command line arguments
*   Return : exit status of program
*/
int main(int argc,char* argv[])
{
    struct	termios ttyinfo;/* this struct holds tty info */

    if ( tcgetattr( STDIN_FILENO , &ttyinfo ) == -1 ){   /* get info */
        perror("tcgetattr");
        exit(EXIT_FAILURE);
    }
    if(argc == 1){//no arguments : display terminal properties 
        showSpeed(&ttyinfo);//show baud rate
        printf("\n");
        displayProperties(&ttyinfo);//displays ctrl characters and flags
    }
    else{//set properties for given command line arguments
        //set properties in a local termios variable
        setProperties(argc,argv,&ttyinfo);
        //everything good so far, so set local termios into terminal
        if( tcsetattr(STDIN_FILENO , TCSANOW, &ttyinfo) ==  -1){
            perror( "tcsetattr");
            exit(EXIT_FAILURE);
        }
    }
    return EXIT_SUCCESS;//Success exit status
}