Hey everybody,
I started to program my final project for the university.
I got stucked in the menu logic.
My drawing function works perfect and the psp enter in the section.
But there is something wrong with my variable "menusetting" in the case "OnMainDictionaryMenu"
Can you tell me where is the mistake?
Here is my main with the control logic of the keyboards.
int main(int argc, char *args[])
{
SetupCallbacks();
TCONTROL *CONTROL = new TCONTROL();
extern int menuSetting;
CONTROL->ControlInit();
SceCtrlData pad, lastpad;
sceCtrlReadBufferPositive(&lastpad, 1);
while(1)
{
sceCtrlReadBufferPositive(&pad, 1);
if(pad.Buttons != lastpad.Buttons)
{
lastpad = pad;
if(pad.Buttons & PSP_CTRL_START)
{
if(OnMainMenu || OnMainDictionaryMenu)
{
SetAllMenusOff();
OnMainMenu = true;
menuSetting = 1;
CONTROL->LOADMainMenu();
CONTROL->FlipScreen();
}
}
if(pad.Buttons & PSP_CTRL_CIRCLE)
{
}
if(pad.Buttons & PSP_CTRL_UP)
{
if(OnMainMenu)
{
SetAllMenusOff();
OnMainMenu = true;
menuSetting--;
if (menuSetting < 1) menuSetting = 1;
CONTROL->ControlMainMenu(menuSetting);
CONTROL->FlipScreen();
}
else if(OnMainDictionaryMenu)
{
menuSetting--;
if (menuSetting < 1) menuSetting = 1;
CONTROL->ControlMainDictionaryMenu(menuSetting);
CONTROL->FlipScreen();
}
}
if(pad.Buttons & PSP_CTRL_DOWN)
{
if(OnMainMenu)
{
SetAllMenusOff();
OnMainMenu = true;
menuSetting++;
if (menuSetting > 4) menuSetting = 4;
CONTROL->ControlMainMenu(menuSetting);
CONTROL->FlipScreen();
}
else if(OnMainDictionaryMenu)
{
menuSetting--;
if (menuSetting < 1) menuSetting = 1;
CONTROL->ControlMainDictionaryMenu(menuSetting);
CONTROL->FlipScreen();
}
}
if(pad.Buttons & PSP_CTRL_CROSS)
{
if(OnStartGameMenu)
{
SetAllMenusOff();
OnMainMenu = true;
menuSetting = 1;
CONTROL->LOADMainMenu();
CONTROL->FlipScreen();
}
else if(OnMainMenu)
{
if(menuSetting == 2)
{
SetAllMenusOff();
OnMainDictionaryMenu = true;
menuSetting = 1;
CONTROL->LOADMainDictionaryMenu();
CONTROL->FlipScreen();
}
}
}
if(pad.Buttons & PSP_CTRL_CIRCLE)
{
}
}
}
sceKernelSleepThread();
delete CONTROL;
}