The entire game:
#include "DarkGDK.h"
void DarkGDK(void)
{
dbSyncOn();
dbSyncRate(60);
return;
}
void mainmenu()
{
dbLoadImage("Play.png",1);
dbLoadImage("Helpabout.png",2);
dbLoadImage("Quit.png",3);
dbLoadImage("splash.png",4);
while((dbReturnKey()==0)&&(LoopGDK())){
dbPasteImage(4,0,0);
dbSync();
}
dbSprite(1,300,100,1);
dbSprite(2,300,200,2);
dbSprite(3,300,300,3);
while(LoopGDK())
{
if( dbMouseX() > dbSpriteX(1) && dbMouseX() < dbSpriteX(1) + dbSpriteScaleX(1) && dbMouseY() > dbSpriteY(1) && dbMouseY() < dbSpriteY(1) + dbSpriteScaleY(1) && dbMouseClick())
{
{
dbDeleteSprite(1);
dbDeleteSprite(2);
dbDeleteSprite(3);
}
}
if( dbMouseX() > dbSpriteX(2) && dbMouseX() < dbSpriteX(2) + dbSpriteScaleX(2) && dbMouseY() > dbSpriteY(2) && dbMouseY() < dbSpriteY(2) + dbSpriteScaleY(2) && dbMouseClick())
{
{
dbDeleteSprite(2);
}
}
if( dbMouseX() > dbSpriteX(3) && dbMouseX() < dbSpriteX(3) + dbSpriteScaleX(3) && dbMouseY() > dbSpriteY(3) && dbMouseY() < dbSpriteY(3) + dbSpriteScaleY(3) && dbMouseClick())
{
{
return;
}
}
dbSync();
}
}
void gameplay()
{
dbSetCameraRange ( 1.0f, 30000.0f );
dbLoadImage ( "texture.jpg", 1 );
dbLoadImage ( "detail.jpg", 2);
dbSetupTerrain ( );
dbMakeObjectTerrain ( 1 );
dbSetTerrainHeightMap ( 1, "map.bmp" );
dbSetTerrainScale ( 1, 3.0f, 0.6f, 3.0f );
dbSetTerrainLight ( 1, 1.0f, -0.25f, 0.0f, 1.0f, 1.0f, 0.78f, 0.5f );
dbSetTerrainTexture ( 1, 1, 2 );
dbBuildTerrain ( 1 );
dbLoadObject ( "skybox2.x", 2 );
dbSetObjectLight ( 2, 0 );
dbScaleObject ( 2, 30000, 30000, 30000 );
dbLoadObject ( "CamrySE.dbo", 3 );
dbPositionObject (3,150,18,150);
float angle=0;
while ( LoopGDK ( ) )
{
dbYRotateObject(3,angle);
if (dbUpKey())
{
dbMoveObject(3,-1);
}
if (dbDownKey())
{
dbMoveObject(3,1);
}
if (dbLeftKey())
{
angle-=3;
}
if (dbRightKey())
{
angle+=3;
}
float fHeight = dbGetTerrainGroundHeight( 1, dbObjectPositionX(3), dbObjectPositionZ(3));
dbPositionObject ( 3, dbObjectPositionX (3), fHeight, dbObjectPositionZ(3));
dbSetCameraToFollow(dbObjectPositionX(3),dbObjectPositionY(3),dbObjectPositionZ(3),dbObjectAngleY(3),-30,11,10,0);
dbUpdateTerrain ( );
dbSync ( );
}
}
Help me! I want to go to the game from the main menu.