Skip to: Site menu | Main content


Welcome to PSP-Programming.com, a place for developers to get together.

Welcome to the forums. Here you can find other user tutorials as well as homebrew releases and the source code repository. You can also ask for help with your code here and post your own homebrew!

PSP-Programming.com Forums
February 11, 2012, 01:04:09 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

News: Welcome to PSP-Programming.com
Home Help Search Shop Login Register
Digg This!
Pages: [1]
Print
Author Topic: Menu Problem  (Read 314 times)
Kahori
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 42
4311.90 points

View Inventory
Send Money to Kahori

View Profile
« on: June 22, 2011, 09:38:38 AM »

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.
Code:
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;
}
« Last Edit: June 22, 2011, 11:09:17 AM by Kahori » Logged


mowglisanu

C/C++ Developer
Hero Member
*

Karma: +36/-11
Offline Offline

Posts: 787
0.00 points

View Inventory
Send Money to mowglisanu


View Profile
« Reply #1 on: June 22, 2011, 11:51:24 AM »

Hi Kahori, if you look over your code you will notice that you have the same logic for PSP_CTRL_UP and PSP_CTRL_DOWN on OnMainDictionaryMenu.
Logged

Check out my:
 Audio lib
 Pmf Viewer
Kahori
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 42
4311.90 points

View Inventory
Send Money to Kahori

View Profile
« Reply #2 on: June 22, 2011, 12:26:52 PM »

Oh thanks... and I was searching the whole time where is the mistake o_O!
that's embarrassing Rolling Eyes

Thank you alot!!!
Logged
Pages: [1]
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.195 seconds with 27 queries.
Sister Sites: Guitar Hero 4   BrokeniTouch.com