Can someone help me coz i can't exit the program. Please correct me if i use the right command in exiting the program.
#include "DarkGDK.h"
void gameTitle(void);
void DarkGDK(void)
{
while ( LoopGDK ( ) )
{
gameTitle();
// update the screen
dbSync ( );
}
}
void gameTitle(void)
{
// load the image for the title screen
dbLoadImage ( "title.png", 32 );
dbSprite(32, 0, 0, 32);
dbSetSpritePriority(32, 2);
dbLoadImage ( "backdrop.png", 33);
dbSprite(33, 0, 0, 33);
dbLoadImage ( "start.png", 34);
dbSprite(34, 680, 210, 34);
dbLoadImage ( "quit.png", 35);
dbSprite(35, 680, 240, 35);
dbLoopSound(4);
//dbLoadImage("03.png", 32 );
dbCreateAnimatedSprite(31, "animFire.png", 3, 4, 31);
dbSetSpritePriority(31, 3);
dbSizeSprite(31, 30, 38);
//dbSprite (32, 90, 361, 32);
dbSprite(31, dbSpriteX(34)-20, dbSpriteY(34)-15, 31);
g_iPlayerLives = 20;
g_playerWin = false;
g_bEnemySpawn = false;
playerReset();
g_iPlayerScore = 0;
g_iLevel = 1;
do
{
dbPlaySprite(31, 1, 12, 100);
if (dbUpKey())
{
// start option
dbSprite (31, dbSpriteX(31), dbSpriteY(34)-20, 31);
choice = 1;
}
else if (dbDownKey ())
{
// quit option
dbSprite (31, dbSpriteX(31), dbSpriteY(35)-20, 31);
choice = 2;
}
// animate cursor and update the screen
dbSync();
} while (! dbReturnKey());
// remove images and sprites used for the title screen
for(int i = 31; i < 37; i++)
{
if(dbSpriteExist(i))
dbDeleteSprite(i);
if(dbImageExist(i))
dbDeleteImage(i);
}
switch(choice)
{
case 1: g_eGameMode = eGameWaitForFire;
break;
case 2:
return;
break;
}
}
when i tried to select the choice 2 my program does not do anything except that i can't exit it manually using ESCAPE button or press the X button at the top right portion of the window.