Hi
When the program first starts and goes to the title screen, the background gets loaded and everything fine. But after going to the main game loop and coming back, the background no longer shows up. Whats happening?
Code:
#include "DarkGDK.h"
#include "Game.h"
#include "Input.h"
#include "Camera.h"
#include "Player.h"
float ScW;
float SpW;
float ScH;
float SpH;
enum eMode
{
eGameTitleSetup,
eGameTitle,
eGameMainSetup,
eGameMain,
eGameSetup
};
eMode g_eGameMode = eGameSetup;
void DarkGDK (void)
{
while ( LoopGDK() )
{
game();
dbSync();
}
}
void game ( void )
{
switch (g_eGameMode)
{
case eGameSetup:
gameSetup(); break;
case eGameTitleSetup:
gameTitleSetup(); break;
case eGameTitle:
gameTitle(); break;
case eGameMainSetup:
gameMainSetup(); break;
case eGameMain:
gameMain(); break;
}
}
void gameSetup (void)
{
dbSyncOn ( );
dbSyncRate ( 60 );
dbSetDisplayMode ( 1024 , 768 , 32 );
dbSetWindowOff();
dbDrawSpritesFirst();
dbSetTextFont ("Courier");
dbSetTextSize (20);
dbLoadImage ("futuristic-sci-fi-01.jpg",1);
dbAutoCamOff();
g_eGameMode = eGameTitleSetup;
}
void gameTitleSetup (void)
{
dbShowMouse();
dbSprite (1,0,0,1);
ScW=dbScreenWidth();
SpW=dbSpriteWidth(1);
ScW=dbScreenHeight();
SpW=dbSpriteHeight(1);
dbStretchSprite (1,ScW/SpW*100,ScH/SpH*100);
g_eGameMode = eGameTitle;
}
void gameTitle (void)
{
dbText(dbScreenWidth()/4*3,dbScreenHeight()/4*3,"Play Game");
if (dbMouseX()>(dbScreenWidth()/4*3) && dbMouseX()<(dbScreenWidth()/4*3)+dbTextWidth("Play Game"))
{
if (dbMouseY()>(dbScreenHeight()/4*3) && dbMouseY()<(dbScreenHeight()/4*3)+dbTextHeight("Play Game"))
{
if (checkClick())
{
g_eGameMode = eGameMainSetup;
}
}
}
}
void gameMainSetup (void)
{
dbLoadObject ("Colonel-X.dbo",1);
dbRotateObject (1,0,180,0);
dbFixObjectPivot (1);
dbPositionObject (1,500,0,500);
dbLoadImage ("grass_T.BMP",2);
dbMakeMatrix (1,1000,1000,10,10);
dbPrepareMatrixTexture (1,2,1,1);
dbFillMatrix (1,0,1);
dbSetObjectSpeed ( 1, 40 );
dbMakeCamera(1);
dbSetCurrentCamera(1);
g_eGameMode = eGameMain;
}
void gameMain (void)
{
if (dbUpKey()==1)
{
dbDeleteSprite(2);
dbDeleteObject (1);
dbDeleteMatrix(1);
//dbSetCurrentCamera (0);
//dbDeleteCamera (1);
dbCLS();
dbBackdropOff();
g_eGameMode=eGameTitleSetup;
}
Player();
CameraControl();
}
Thanks