|
Input Problem August 22, 2008 01:59AM | Admin Registered: 17 years ago Posts: 5,132 |
int mode = 1;
void Menu(){
// Initialise the video system
VIDEO_Init();
// This function initialises the attached controllers
WPAD_Init();
// Obtain the preferred video mode from the system
// This will correspond to the settings in the Wii menu
rmode = VIDEO_GetPreferredMode(NULL);
// Allocate memory for the display in the uncached region
xfb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
// Initialise the console, required for printf
console_init(xfb,20,20,rmode->fbWidth,rmode->xfbHeight,rmode->fbWidth*VI_DISPLAY_PIX_SZ);
// Set up the video registers with the chosen mode
VIDEO_Configure(rmode);
// Tell the video hardware where our display memory is
VIDEO_SetNextFramebuffer(xfb);
// Make the display visible
VIDEO_SetBlack(FALSE);
// Flush the video register changes to the hardware
VIDEO_Flush();
// Wait for Video setup to complete
VIDEO_WaitVSync();
if(rmode->viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync();
// The console understands VT terminal escape codes
// This positions the cursor on row 2, column 0
// we can use variables for this with format codes too
// e.g. printf ("\x1b[%d;%dH", row, column );
printf("\x1b[2;0H");
printf("Wii Game");
while(true){
WPAD_ScanPads();
printf("\x1b[5;5H");
switch(mode){
case 1:
printf("Mode1");
break;
case 2:
printf("Mode2");
break;
case 3:
printf("Mode3");
break;
case 4:
printf("Mode4");
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_RIGHT)||(WPAD_ButtonsDown(WPAD_CHAN_0)&WPAD_NUNCHUK_BUTTON_C))
mode--;
if(mode < 1)
mode = 4;
if(mode > 4)
mode = 1;
if((WPAD_ButtonsDown(WPAD_CHAN_0)&WPAD_BUTTON_B)||(WPAD_ButtonsDown(WPAD_CHAN_0)&WPAD_BUTTON_A))
break;
if(WPAD_ButtonsDown(WPAD_CHAN_0)&WPAD_BUTTON_HOME){
quit = 1;
break;
}
// Wait for the next frame
VIDEO_WaitVSync();
}
}|
Re: Input Problem August 22, 2008 03:36AM | Registered: 17 years ago Posts: 7 |
|
Re: Input Problem August 22, 2008 08:47AM | Registered: 17 years ago Posts: 109 |
|
Re: Input Problem August 22, 2008 03:17PM | Admin Registered: 17 years ago Posts: 5,132 |
|
Re: Input Problem August 22, 2008 03:23PM | Registered: 17 years ago Posts: 9 |
|
Re: Input Problem August 22, 2008 03:28PM | Admin Registered: 17 years ago Posts: 5,132 |
|
Re: Input Problem August 22, 2008 03:31PM | Registered: 17 years ago Posts: 9 |
|
Re: Input Problem August 22, 2008 03:45PM | Admin Registered: 17 years ago Posts: 5,132 |
|
Re: Input Problem August 22, 2008 05:29PM | Registered: 17 years ago Posts: 265 |
|
Re: Input Problem August 22, 2008 06:21PM | Admin Registered: 17 years ago Posts: 5,132 |