Libwiisprite GUI/Menu Programming September 07, 2008 12:15AM | Admin Registered: 16 years ago Posts: 5,132 |
Re: Libwiisprite GUI/Menu Programming September 07, 2008 12:17AM | Admin Registered: 16 years ago Posts: 5,132 |
void Menu(){ // This function initialises the attached controllers WPAD_Init(); LayerManager manager(8); GameWindow gwd; gwd.InitVideo(); TextField *text[8]; text[0] = new TextField(30, 0, 30, 5, &manager, "Wii Shooting Gallery!", "data/fonts/font8.png"); text[1] = new TextField(30, 20, 30, 5, &manager, "Wii Shooting Gallery!", "data/fonts/font8.png"); text[2] = new TextField(30, 40, 30, 5, &manager, "Wii Shooting Gallery!", "data/fonts/font8.png"); text[3] = new TextField(30, 60, 30, 5, &manager, "Wii Shooting Gallery!", "data/fonts/font8.png"); text[4] = new TextField(30, 80, 30, 5, &manager, "Wii Shooting Gallery!", "data/fonts/font8.png"); text[5] = new TextField(30, 100, 30, 5, &manager, "Wii Shooting Gallery!", "data/fonts/font8.png"); text[6] = new TextField(30, 120, 30, 5, &manager, "Wii Shooting Gallery!", "data/fonts/font8.png"); text[7] = new TextField(30, 140, 30, 5, &manager, "Score: %d", "data/fonts/font8.png"); while(true){ WPAD_ScanPads(); switch(mode){ case 1: text[1]->SetText("Still Targets"); break; case 2: text[1]->SetText("Horizontal Moving Targets"); break; case 3: text[1]->SetText("Vertical Moving Targets"); break; case 4: text[1]->SetText("Crazy Targets"); break; case 5: text[1]->SetText("Crisscross Targets"); break; case 6: text[1]->SetText("Teleporting Targets"); break; } switch(trans){ case 0: text[2]->SetText("Crosshair 1"); Aim->SetImage(crosshair1); Aim->SetTransparency(0xFF); break; case 1: text[2]->SetText("Crosshair 2"); Aim->SetImage(crosshair2); break; case 2: text[2]->SetText("Crosshair 3"); Aim->SetImage(crosshair3); break; case 3: text[2]->SetText("Crosshair 4"); Aim->SetImage(crosshair4); break; case 4: text[2]->SetText("Crosshair 5"); Aim->SetImage(crosshair5); Aim->SetTransparency(0xFF); break; case 5: text[2]->SetText("Invisible Crosshair"); Aim->SetTransparency(0); break; } switch(backgroundchoice){ case 1: Background->SetTransparency(0xFF); Background->SetImage(background1); text[3]->SetText("Background 1"); break; case 2: Background->SetImage(background2); text[3]->SetText("Background 2"); break; case 3: Background->SetTransparency(0xFF); Background->SetImage(background3); text[3]->SetText("Background 3"); break; case 4: Background->SetTransparency(0); text[3]->SetText("No Background"); break; } switch(anim){ case 1: text[4]->SetText("Animation On"); break; case 2: text[4]->SetText("Animation Off"); break; } switch(rumble){ case 0: text[5]->SetText("Rumble Off"); break; case 1: text[5]->SetText("Rumble On"); break; } switch(maxtime){ case 0: text[6]->SetText("Unlimited Time"); break; case 1000: text[6]->SetText("One minute"); break; case 2000: text[6]->SetText("Two Minutes"); break; case 3000: text[6]->SetText("Three Minutes"); break; case 4000: text[6]->SetText("Four Minutes"); break; case 5000: text[6]->SetText("Five Minutes"); break; } if((WPAD_ButtonsDown(WPAD_CHAN_0)&WPAD_BUTTON_RIGHT)||(WPAD_ButtonsDown(WPAD_CHAN_0)&WPAD_NUNCHUK_BUTTON_Z)) mode++; if((WPAD_ButtonsDown(WPAD_CHAN_0)&WPAD_BUTTON_LEFT)||(WPAD_ButtonsDown(WPAD_CHAN_0)&WPAD_NUNCHUK_BUTTON_C)) mode--; if(mode < 1) mode = 6; if(mode > 6) mode = 1; if(WPAD_ButtonsDown(WPAD_CHAN_0)&WPAD_BUTTON_A) trans++; if(WPAD_ButtonsDown(WPAD_CHAN_0)&WPAD_BUTTON_DOWN) trans--; if(trans > 5) trans = 0; if(trans < 0) trans = 5; if(WPAD_ButtonsDown(WPAD_CHAN_0)&WPAD_BUTTON_2) backgroundchoice++; if(WPAD_ButtonsDown(WPAD_CHAN_0)&WPAD_BUTTON_1) maxtime += 1000; if(backgroundchoice > 4) backgroundchoice = 1; if(maxtime > 5000) maxtime = 0; if(WPAD_ButtonsDown(WPAD_CHAN_0)&WPAD_BUTTON_PLUS) anim++; if(anim > 2) anim = 1; if(WPAD_ButtonsDown(WPAD_CHAN_0)&WPAD_BUTTON_MINUS) rumble--; if(rumble < 0) rumble = 1; if(WPAD_ButtonsDown(WPAD_CHAN_0)&WPAD_BUTTON_B) break; if(WPAD_ButtonsDown(WPAD_CHAN_0)&WPAD_BUTTON_HOME){ quit = 1; break; } Background->Draw(); manager.Draw(0, 0); gwd.Flush(); } }
Re: Libwiisprite GUI/Menu Programming September 07, 2008 08:33AM | Registered: 16 years ago Posts: 211 |
Re: Libwiisprite GUI/Menu Programming September 07, 2008 10:51AM | Registered: 16 years ago Posts: 265 |
Re: Libwiisprite GUI/Menu Programming September 07, 2008 04:07PM | Registered: 16 years ago Posts: 114 |
Re: Libwiisprite GUI/Menu Programming September 07, 2008 11:11PM | Registered: 16 years ago Posts: 265 |
Re: Libwiisprite GUI/Menu Programming September 08, 2008 12:00AM | Admin Registered: 16 years ago Posts: 5,132 |
Re: Libwiisprite GUI/Menu Programming September 08, 2008 12:19AM | Admin Registered: 16 years ago Posts: 5,132 |
Re: Libwiisprite GUI/Menu Programming September 08, 2008 01:07AM | Registered: 16 years ago Posts: 114 |