Hey,
if i wanted to skip a line between 2 menu items. how would i tell the tempMenuSelection(" -> ") variable to skip that line.
int tempMenuSelection = 14; // variable to store the current menu selection
while(gameState == GAMESTATE_MENU) { // loop while in menu mode
pspDebugScreenSetXY(0, 14); // set the text cursor back to the top left of the screen
pspDebugScreenPrintf(" Menu Item 1\n");
pspDebugScreenPrintf(" Menu Item 2\n");
pspDebugScreenPrintf("\n");
pspDebugScreenPrintf(" Menu Item 3\n");
pspDebugScreenPrintf(" Menu Item 4\n");
pspDebugScreenPrintf(" Exit\n");
pspDebugScreenSetXY(0, tempMenuSelection); // Move the text cursor to the selected item
pspDebugScreenPrintf(" ->"); // draw the selector
wait(5); // wait for 5/60ths of a second then menu
// is a reasonable speed.
sceCtrlReadBufferPositive(&pad, 1); // check the input.
if(pad.Buttons & PSP_CTRL_CROSS) { // if the cross button is pressed
switch(tempMenuSelection) { // choose what to do depending on the menu number
case 14:
screen();
break;
case 18:
gameState = GAMESTATE_END; // change the game state to end, so that the loop exits.
break; // exit this case block otherwise the code below would also execute.
default:
// Do nothing
// The code to deal with an invalid menu selection can go here
break;
}
}
if(pad.Buttons & PSP_CTRL_UP) // if the up button is pressed,
tempMenuSelection--; // decrement the menu selection,
else if(pad.Buttons & PSP_CTRL_DOWN) // otherwise if the down button is pressed,
tempMenuSelection++; // increment the menu selection.
if(tempMenuSelection > 18) // if the menu selector is past the end of the menu,
tempMenuSelection = 14; // move it to the beginning,
else if(tempMenuSelection < 14) // otherwise if it is before the beginning,
tempMenuSelection = 18; // move it to the end.
}
one of the things i tried was this:
if(pad.Buttons & PSP_CTRL_UP) // if the up button is pressed,
tempMenuSelection--; // decrement the menu selection,
else if(pad.Buttons & PSP_CTRL_DOWN) // otherwise if the down button is pressed,
tempMenuSelection++; // increment the menu selection.
if(tempMenuSelection > 18) // if the menu selector is past the end of the menu,
tempMenuSelection = 14; // move it to the beginning,
else if(tempMenuSelection > 15) // otherwise if it is before the beginning,
tempMenuSelection = 17; // move it to the end.
else if(tempMenuSelection < 14) // otherwise if it is before the beginning,
tempMenuSelection = 18; // move it to the end.
}
but i can see why it doesnt work. i would just like to know how i could tell the "->" thing variable(not sure what to call it) to skip a certain line or case(also not sure which word to use).