TGC Codebase Backup



tree party easy version dgdk by 3d point in space

4th Sep 2009 19:45
Summary

easy version of tree party



Description



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    // Dark GDK - The Game Creators - www.thegamecreators.com

// include Dark GDK header file
#include "DarkGDK.h"
#include "Treeparty.h"

// global variables - used for the camera

int Stage;

// forward declaration for functions
void LoadSomeTrees( void );     // homemade function to load some trees

void LoadOurSky( void );




void DarkGDK ( void )
{

	// get Scene Mode
	int window;
	 Stage =1; 
	
	window =1;
		

	
	int width=1680;
	int height=1050;
	
	dbSync();


	//set screen mode
	dbSetDisplayMode ( width, height, 32 );
	dbSetWindowPosition ( 0,0 ); 
	if (window==1) { dbSetWindowOn(); } else { dbSetWindowOff(); }


	//mouse
	dbHideMouse ( ) ;

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

	// load images for the terrain
	//dbLoadImage ( "demomedia\terrain\texture.jpg", 1 );	// diffuse texture
	//dbLoadImage ( "demomedia\terrain\texture2.jpg", 3 );	// diffuse texture
	//dbLoadImage ( "demomedia\terrain\detail.jpg",  2 );	// detail texture
	
	// load logo image
	//dbLoadImage( "demomedia\logo.png", 344);

	// set starting camera position
	dbAutoCamOff();
	dbPositionCamera ( 0, 50,-200 );


	// setup a light / enviro
	LoadOurSky( );


	// initialize Treeparty
	tpInit();

	// load some trees
	LoadSomeTrees ( );

	//misc objs
	//LoadMiscObjs( );

	// load the grass
	//LoadGrassObjs( );




	int a=0;
	// loop round until escape key is pressed-------------------------------------------
	while ( LoopGDK ( ) )
	{

				if ( dbEscapeKey ( ) )
					return;
	
				// show the frame rate and handle user input
				//showFPS   ( );
				//userInput ( );
				//MyKepPresses( );

				// update the terrain
				//dbUpdateTerrain ( );
	
				// update treeparty
				a++;
					if ( a == 2 ){ tpUpdate ( 0 ); a = 0 ;}  // send it our dbCamera ID 

				// render everything
				dbSync ( );
	}
}
	//-------------------------------------------------------------------------------------












void LoadSomeTrees( ) {
	int mytree=2;
	
	
	dbOpenToRead ( 32, "Tree.loc" );

		
	mytree= tpLoadtree( "tpDemo2_dgdk.tree" );
			

	tpPositionTree( mytree , 0, 0, 0 );
	tpXScaleX( mytree , .25 );
	
		
	dbCloseFile(32);

}




void LoadOurSky( void){


	if ( Stage == 1 ){
	// create our skybox
	dbLoadObject       ( "demomedia\skybox\skybox2.x", 200 );		// load the skybox model
	dbSetObjectLight   ( 200, 0 );						// turn lighting off
	dbSetObjectTexture ( 200, 3, 1 );					// set texture properties
	dbPositionObject   ( 200, 1000, 500, 4000 );		// position the skybox
	dbScaleObject      ( 200, 30000, 30000, 30000 );	// and finally scale
	dbRotateObject     ( 200, 0, 90, 0 );
	dbFogOff();

	
	
	}








}