#102900 - jester - Sun Sep 17, 2006 8:37 pm
A Menu helper for my DS Game
Code: |
void show_menu() {
u32 i,j,k,sel; sel=0; while(1) { swiWaitForVBlank(); k=keysDown(); if(mylevel==0) printtext(7,8,(sel==0)?15:6,"Start Game"); else printtext(7,8,(sel==0)?15:6,"Resume Game"); if(mylevel==0) printtext(8,8,(sel==1)?15:6,"Load Game"); else if(mylevel==1) printtext(8,8,(sel==1)?15:6,"Save Game"); else printtext(8,8,(sel==1)?15:6,"Exit Level"); printtext(9,8,(sel==2)?15:6,"Speed: "); if(maxvblanks==15) disp_sub(9,15,(sel==2)?15:6,'S'); if(maxvblanks==7) disp_sub(9,15,(sel==2)?15:6,'M'); if(maxvblanks==2) disp_sub(9,15,(sel==2)?15:6,'F'); printtext(10,8,(sel==3)?15:6,"Backlight"); printtext(11,8,(sel==4)?15:6,"Contrast: "); disp_sub(11,18,(sel==4)?15:6,'0'+pal_main/5); printtext(12,8,(sel==5)?15:6,"Sound Test"); if(k&KEY_UP && sel>0) sel-=1; if(k&KEY_DOWN && sel<5) sel+=1; if(k&KEY_SELECT) { if(sel==0) return; if(sel==1 && mylevel>1) { PlaySound(SNDFX_START); mylevel=1; myhearts=oldhearts; myarrows=oldarrows; mykeys=oldkeys; myscore=oldscore; load_map(); return; } if(sel==2) { if(maxvblanks==15) maxvblanks=7; else if(maxvblanks==7) maxvblanks=2; else maxvblanks=15; } if(sel==3) PlaySound(50); if(sel==4) { pal_main=(pal_main+5)%30; if(pal_main==0) pal_main=5; pal_hi=30-pal_main; load_palette(); } if(sel==5) { cleartext(5,23); soundtest_menu(); cleartext(5,23); } } } } |