my menu not doing so well #include <pspkernel.h> #include <pspcallbacks.h> #include <pspctrl.h> #include "graphics.h" #define printf printTextScreen #define RGB(r, g, b) ((r)|((g)<<8)|((b)<<16)) PSP_MODULE_INFO("Menu Example",0,1,1); Color white = RGB(255,255,255), red = RGB(255,0,0), black = RGB(0,0,0); enum {START, CONTROLS, CREDITS, EXIT}; char menuItems[4][30] = { {"START"}, {"CONTROLS"}, {"CREDITS"}, {"EXIT"}, }; int timer,select,foo; SceCtrlData pad; void executeMenu(int select) { switch(select) { case START: break; case CONTROLS: break; case CREDITS: break; case EXIT: sceKernelExitGame(); break; default: return; } return; // suppress compiler warning } int main() { Image* background = loadImage("Background.png"); initGraphics(); SetupCallbacks(); while(1) { sceCtrlReadBufferPositive(&pad,1); blitAlphaImageToScreen(0,0,480,272,background,0,0); fillScreenRect(white,0,0,480,272); blitAlphaImageToScreen(0,0,480,272,background,0,0); timer++; for(foo=0;foo<10;foo++) {printf(200,foo*4+70,menuItems[foo],black);} printf(201,select*4+70,menuItems[select],red); if((pad.Buttons & PSP_CTRL_UP) && (timer > 6) && (select > 0)) {select--;timer = 0;} else if ((pad.Buttons & PSP_CTRL_DOWN) && (timer > 6) && (select < 3)) {select++;timer = 0;} else if (pad.Buttons & PSP_CTRL_CROSS){executeMenu(select);} flipScreen(); } return 0; } Code (markup): the problem is my menu items end up ran together instead of being on there own lines. any suggestions.
#include <pspkernel.h> #include <pspcallbacks.h> #include <pspctrl.h> #include "graphics.h" #define printf printTextScreen #define RGB(r, g, b) ((r)|((g)<<8)|((b)<<16)) PSP_MODULE_INFO("Menu Example",0,1,1); Color white = RGB(255,255,255), red = RGB(255,0,0), black = RGB(0,0,0); enum {START, CONTROLS, CREDITS, EXIT}; char menuItems[4][30] = { {"START"}, {"CONTROLS"}, {"CREDITS"}, {"EXIT"}, }; int timer,select,foo; SceCtrlData pad; void executeMenu(int select) { switch(select) { case START: break; case CONTROLS: break; case CREDITS: break; case EXIT: sceKernelExitGame(); break; default: return; } return; // suppress compiler warning } int main() { Image* background = loadImage("Background.png"); initGraphics(); SetupCallbacks(); while(1) { sceCtrlReadBufferPositive(&pad,1); blitAlphaImageToScreen(0,0,480,272,background,0,0); fillScreenRect(white,0,0,480,272); blitAlphaImageToScreen(0,0,480,272,background,0,0); timer++; for(foo=0;foo<10;foo++) {printf(200,foo*4+70,menuItems[foo],black); printf("/n/n"); } printf(201,select*4+70,menuItems[select],red); printf("/n/n"); if((pad.Buttons & PSP_CTRL_UP) && (timer > 6) && (select > 0)) {select--;timer = 0;} else if ((pad.Buttons & PSP_CTRL_DOWN) && (timer > 6) && (select < 3)) {select++;timer = 0;} else if (pad.Buttons & PSP_CTRL_CROSS){executeMenu(select);} flipScreen(); } return 0; } I think this will work just add "/n" for next line and not anything serious.
uhm yeah that /n only works with undefined printf. mine is printextscreen defined as printf so that wouldnt work.