Exemple #1
0
void DarkGDK ( void )
{
	loadSettings();
	loadResources();

	//ASTEROID LOADED OBJECTS
	Large_Roid loadLarge(1);
	Big_Roid loadBig(1);
	Medium_Roid loadMedium(1);
	Small_Roid loadSmall(1);
	Tiny_Roid loadTiny(1);

	Ship *player = new Jet;

	Asteroid * roids[NUM_ASTEROIDS];
	setAsteroids(roids, NUM_ASTEROIDS);

	dbMakeObjectSphere(MACH_GUN_FIRE, 2);
	dbTextureObject(MACH_GUN_FIRE, MACH_GUN_FIRE);


	while ( LoopGDK ( ) )
	{
		astroReset(roids, NUM_ASTEROIDS);
		astroidPhysics(roids, NUM_ASTEROIDS);
		collision(roids, NUM_ASTEROIDS, player);
		player->moveShip();

		

		pause();
		if(dbSpaceKey())
		{
			dbWait(1000);
		}
		dbSync ( );
	}
	


	memoryLeak();
	return;
}
Exemple #2
0
void DarkSDK ( void )
{
	// entry point for the application

	//dbSetDir ( "media\\" );

	// initial application set up
	dbSyncOn         ( );				// turn sync on
	dbSyncRate       ( 0 );			// set sync rate to 60
	dbBackdropOn    ( );				// switch backdrop off - no need to clear screen
	dbSetCameraRange ( 0.5f, 30000 );	// set the camera range

	PhysStart ( );

	
		// floor
	dbMakeObjectBox			 ( 1, 100, 1, 100 );
	dbPositionObject		 ( 1, 0, 0, 0 );
	dbColorObject			 ( 1, dbRgb ( 100, 0, 0 ) );
	PhysCreateStaticRigidBodyMesh ( 1 );
	

	/*
	dbLoadObject ( "bin1.x", 2 );
	//dbPositionObject ( 2, 0, 1 + dbObjectCollisionCenterY ( 2 ), 0 );
	dbPositionObject ( 2, 0, 0, 0 );
	//dbOffsetLimb ( 2, 0, dbObjectCollisionCenterX ( 2 ) * -1, dbObjectCollisionCenterY ( 2 ) * -1, dbObjectCollisionCenterZ ( 2 ) * -1 );
	PhysCreateRigidBodyBox ( 2 );

	dbMakeObjectCube ( 3, 5 );
	dbPositionObject ( 3, 20, 10, 0 );
	PhysCreateRigidBodyBox ( 3 );
	*/



	const NxReal height = 0.3;
	const NxReal width = 2;
	const NxReal length = 4;

	

	//dbMakeObjectBox ( 5, length*0.65, height*0.85, width*0.65 );
	dbMakeObjectBox ( 5, 3.5,3,4);
	dbPositionObject ( 5, 3.5,4,0 );

	dbMakeObjectSphere ( 10, 0.8 );
	dbMakeObjectSphere ( 11, 0.8 );
	dbMakeObjectSphere ( 12, 0.8 );
	dbMakeObjectSphere ( 13, 0.8 );

	CreateTruck ( );

	//dbLoadObject ( "corsa.x", 5 );
	//dbPositionObject ( 5, 0, 1, 0 );

	/*
	InitCar ( );
	car = CreateCar(NxVec3(0,5,0));
	*/

	

	dbPositionCamera ( 0, 20, -30 );


	
//	PhysCreateRigidBodyBox ( 10 );
	
	// loop round until escape key is pressed
	while ( LoopSDK ( ) )
	{
		if ( dbEscapeKey ( ) )
			return;

		if ( dbSpaceKey ( ) )
			PhysSetVelocity ( 10, 0, 20, 0 );

		UpdateTruck ( );

		//if ( dbSpaceKey ( ) )
		//	PhysSetVelocity ( 3, -20, 0, 0 );

		/*
		{
			bool bKey = false;

			if ( dbKeyState ( 17 ) == 1 )
			{
				gMotorForce = gMaxMotorPower;
				bKey = true;
			}

			if ( dbKeyState ( 31 ) == 1 )
			{
				gMotorForce = -gMaxMotorPower;
				bKey = true;
			}

			if ( dbKeyState ( 32 ) )
			{
				if (gSteeringValue > (-1.0f + gSteeringDelta))
					gSteeringValue -= gSteeringDelta;

				bKey = true;
			}

			if ( dbKeyState ( 30 ) )
			{
				if (gSteeringValue < (1.0f - gSteeringDelta))
					gSteeringValue += gSteeringDelta;

				bKey = true;
			}

			if ( !bKey )
			{
				gMotorForce = 0.0f;
				gSteeringValue = 0.0f;
			}

		}

		TickCar ( );
		*/
		

		// show the frame rate and handle user input
		showFPS   ( );
		userInput ( );

		PhysRun ( );
		PhysUpdate ( );

		// render everything
		dbSync ( );
	}
}