I need help. I'm working on a very important project and I encountered a problem when making the main menu.
After starting the game all the files are loaded correctly. But when using the arrow keys on the keyboard trying to change the menu option, then there is a problem.
After pressing the DOWN KEY option pointer jumps to the selected option, but a moment after he returns to the original settings. This is shown in the Annex (the menu is in Polish. Nowa gra - new game. Wczytaj - load game,Wyjdź - exit).
And this is my code. Main CPP file:
// Nagłówek podstawowy
#include "DarkGDK.h"
// Nagłówki pomocnicze
#include "Menu.h"
int SW;
int SH;
#define THANKS "Thank You, Karolina"
#define DEDICATION "Karolina Stachura"
void DarkGDK()
{
dbSetWindowOff();
dbSyncOn();
dbSyncRate(60);
SW=GetSystemMetrics(0);
SH=GetSystemMetrics(1);
dbSetDisplayMode (1280, 800, 32 );
SetCurrentDirectory(L"Media");
dbHideMouse();
while (LoopGDK())
{
Menu();
dbSync ( );
}
return;
}
And this is Menu.h file:
#pragma once
// #include "Level.h"
#include "DarkGDK.h"
#include "Input.h"
// IMPLEMENTACJA
void MenuItems()
{
dbLoadImage("BackGround.dds", 1);
dbSprite(1, 0, 0,1);
dbLoadImage("Pointer.dds", 2);
dbLoadImage("Dedication",3);
dbSprite(3,50,600,3);
}
void Menu ( void )
{
MenuItems();
/////////////////////////////////////////////////////////
MenuLoop:
dbSprite(2,100,325,2);
///////////////////////////////
if(dbDownKey())
{
dbDeleteSprite(2);
dbSprite(2,100,395,2);
goto RESUME;
}
else if(dbReturnKey())
{
// LoadLevel(1);
}
///////////////////////////////
RESUME:
if(dbDownKey())
{
dbDeleteSprite(2);
dbSprite(2,100,495,2);
goto EXIT;
}
else if(dbReturnKey())
{
// Resume Game
}
///////////////////////////////
EXIT:
if(dbDownKey())
{
goto MenuLoop;
}
else if(dbReturnKey())
{
// Exit Game
}
}