OK, I really need help. PLEASE HELP!!! This is the code that I have:
void DarkGDK ( void )
{
dbSetDisplayMode ( ResWidth, ResHeight, 32);
dbSetImageColorKey ( 255, 0, 255 );
dbSyncOn ( );
dbSyncRate ( 60 );
dbSetWindowOn();
StartMenu* SMenu = new StartMenu;
bool Exit = false;
while ( LoopGDK ( ) && !Exit )
{
switch (GameMode)
{
case GameModeStartMenu:
{
break;
}
case GameModeToFullScreen:
{
delete SMenu;
dbSetWindowOff();
StartMenu* SMenu = new StartMenu;
GameMode = GameModeStartMenu;
break;
}
case GameModeToWindowScreen:
{
delete SMenu;
dbSetWindowOn();
StartMenu* SMenu = new StartMenu;
GameMode = GameModeStartMenu;
break;
}
case GameModeExit:
{
Exit = true;
break;
}
}
//dbInk ( 255+256*255, 0 );
//dbLine (66, 5, 3, 300 );
//dbLine (3, 5, 600, 500 );
MxMouseChecker::scanForMouseAction();
dbSync ( );
}
delete SMenu;
// return back to windows
return;
}
StartMenu is class that creates and draws my menu, it loads some images, creates some sprites, draws buttons using those sprites, sets up some variables for the function "MxMouseChecker::scanForMouseAction()". The later checks if mouse is clicked and then it changes the variable "GameMode" depending on what is clicked.
Interesting thing, that the program works if I put dbSetWindowOn instead of dbSetWindowOff (i.e. when I still delete and recreate menu, but I do not actually switch the window mode off).
But if I keep dbSetWindowOff, then it does switch to full screen, and even draws the menu, and even has some rudimentary functions (for example the button is highlighted when I mouse it over - functionality I programed through MxMouseChecker::scanForMouseAction() ) But if I click any of my buttons, including my button "Exit" that should set GameMode into GameModeExit or simply hit escape (which should end the program) then my program simply freeze, including vc++ itself, so I can not debug it - I have to kill the process through task manager.
Again, the program just works if I use dbSetWindowOn everywhere, which is useless for me, but it shows that my classes that are not shown here are written correctly, probably.
So, what do I miss here? PLEASE HELP, I AM GOING CRAZY WITH THIS.