Motion Sensing help February 23, 2009 12:23AM | Registered: 14 years ago Posts: 2 |
#include#include #include #include #include #include #include static u32 *xfb; static GXRModeObj *rmode; void Initialise() { VIDEO_Init(); WPAD_Init(); rmode = VIDEO_GetPreferredMode(NULL); xfb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode)); console_init(xfb,20,20,rmode->fbWidth,rmode->xfbHeight,rmode->fbWidth*VI_DISPLAY_PIX_SZ); VIDEO_Configure(rmode); VIDEO_SetNextFramebuffer(xfb); VIDEO_SetBlack(FALSE); VIDEO_Flush(); VIDEO_WaitVSync(); if(rmode->viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync(); } int main() { Initialise(); printf("\x1b[2;0H"); printf("Hello World!\n"); struct expansion_t exp; struct orient_t orient; struct vec3w_t accel; while(1) { WPAD_ScanPads(); u16 buttonsDown = WPAD_ButtonsDown(0); u16 buttonsHeld = WPAD_ButtonsHeld(0); WPAD_Expansion(WPAD_CHAN_0, &exp); WPAD_Orientation(WPAD_CHAN_0, &orient); WPAD_Accel(WPAD_CHAN_0, &accel); if( buttonsDown & WPAD_BUTTON_A ) { printf("Button A pressed.\n"); } //.... a bunch of similar code checking the buttons presses and holdings. if (buttonsHeld & WPAD_BUTTON_B ) { printf("\x1b[2;0H"); printf("Wiimote yaw : %f\n" "Wiimote pitch: %f\n" "Wiimote roll : %f\n", orient.yaw, orient.pitch, orient.roll); } if (buttonsHeld & WPAD_BUTTON_MINUS ) { printf("\x1b[2;0H"); printf("Wiimote acceleration:\n" "X: %f\n" "Y: %f\n" "Z: %f\n", accel.x, accel.y, accel.z); } if (buttonsDown & WPAD_BUTTON_HOME) { exit(0); } } return 0; }
Re: Motion Sensing help February 23, 2009 12:42AM | Registered: 15 years ago Posts: 441 |
Re: Motion Sensing help February 23, 2009 12:49AM | Registered: 15 years ago Posts: 441 |
Re: Motion Sensing help February 23, 2009 01:03PM | Registered: 14 years ago Posts: 2 |