Example #1
0
void showFPS ( void )
{
	char szFPS [ 256 ] = "";
	strcpy ( szFPS, "fps = " );
	strcat ( szFPS, dbStr ( dbScreenFPS ( ) ) );

	dbSetCursor ( 0, 0 );

	dbPrint ( szFPS );
	dbPrint ( "" );

	//strcpy ( szFPS, dbStr ( dbObjectAngleY ( 6000 ) ) );
	//dbPrint ( szFPS );
	
	
	strcpy ( szFPS, dbStr ( dbCameraPositionX ( ) ) );
	dbPrint ( szFPS );
	strcpy ( szFPS, dbStr ( dbCameraPositionY ( ) ) );
	dbPrint ( szFPS );
	strcpy ( szFPS, dbStr ( dbCameraPositionZ ( ) ) );
	dbPrint ( szFPS );

	/*
	dbPrint ( "" );
	strcpy ( szFPS, dbStr ( dbCameraAngleX ( ) ) );
	dbPrint ( szFPS );
	strcpy ( szFPS, dbStr ( dbCameraAngleY ( ) ) );
	dbPrint ( szFPS );
	strcpy ( szFPS, dbStr ( dbCameraAngleZ ( ) ) );
	dbPrint ( szFPS );
	*/

	
	dbPrint ( "" );
	strcpy ( szFPS, dbStr ( dbStatistic ( 1 ) ) );
	dbPrint ( szFPS );
	

	//dbPrint ( "" );
	//dbPrint ( dbStr ( dbKeyState ( ) ) );

}
Example #2
0
// the main entry point for the application is this function
void DarkGDK ( void ){
	// Seed the random number generator
	srand(time(NULL));

	// Configure the engine to run as fast as possible (no frame rate cap)
	dbSyncOn();
	dbSyncRate(0);

	// If fullscreen, configure to a, currently, hard coded setting
	if (FULLSCREEN) {
		dbSetWindowOff();
		dbMaximizeWindow();
		dbSetDisplayModeAntialias(1680, 1050, 32, 1, 0, 0);
		dbSetCameraAspect(0, 1680.0 / 1050.0);
	}
	// Otherwise, configure a windowed display
	else {
		dbSetDisplayModeAntialias(1280, 800, 32, 1, 0, 0);
		dbSetCameraAspect(0, 1280.0 / 800.0);

		int winPosX = (dbDesktopWidth() - dbScreenWidth()) / 2;
		int winPosY = (dbDesktopHeight() - dbScreenHeight()) / 2;

		dbSetWindowPosition(winPosX, winPosY);
	}
	
	// Hide the mouse pointer; CEGUI handles this
	dbHideMouse();

	// This forces the timer to initialise
	MyTimer *timer = &MyTimer::get();
	float t;


	// Create a new Game State - this is a general game controlling class
	BiPlaneGameState *gsGame = new BiPlaneGameState();

	// We'll need a start-up menu	
	StartMenuGameState *gsMenu = new StartMenuGameState();
	
	// a Loop State holder
	bool loopState = TRUE;

	// This is for the Start Menu loop
	//while (LoopGDK()) {
	do {
		// Tick the timer & frame rate for this loop
		timer->tick();
		t = timer->getT();
		dbText(0, 0, dbStr((float)(1.0 / t)));

		loopState &= gsGame->update(t);
		loopState &= gsMenu->update(t);

		dbSync();
	} while (loopState && LoopGDK());
	


	switch (gsMenu->getState()) {
		// Start Server
		case 1 :
			break;

		// Start Client
		case 2 :
			break;

		// SOMETHING WENT WRONG!!
		default : exit(-5);
	}


	loopState = TRUE;
	// our main loop
	//while (LoopGDK()) {
	do {
		// Tick the timer & frame rate for this loop
		timer->tick();
		t = timer->getT();
		dbText(0, 0, dbStr((float)(1.0 / t)));

		// Issue an Update to the GameState system, passing the frameTime into it
		loopState &= gsGame->update(t);

		// Update the display
		dbSync();
	} while (loopState && LoopGDK());

	// Do a little house keeping
	delete gsGame;
	delete gsMenu;
	return;
}