ir help!!! March 08, 2009 06:12AM | Registered: 15 years ago Posts: 444 |
#include#include #include #include #include #include #include #include static u32 *xfb; static GXRModeObj *rmode; ir_t ir; 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(); while(1) { WPAD_ScanPads(); WPAD_IR(0, &ir); WPAD_SetDataFormat(0, WPAD_FMT_BTNS_ACC_IR); WPAD_SetVRes(0, 640, 480); u32 buttonsDown = WPAD_ButtonsDown(0); if( buttonsDown & WPAD_BUTTON_B ) { //Prints wiimote position printf("X= %e Y= %e\n", ir.x, ir.y); } //Exit if (buttonsDown & WPAD_BUTTON_HOME) { exit(0); } } return 0; }
Re: ir help!!! March 08, 2009 06:27AM | Registered: 15 years ago Posts: 42 |
Re: ir help!!! March 08, 2009 06:32AM | Registered: 15 years ago Posts: 703 |
Re: ir help!!! March 08, 2009 06:36AM | Registered: 15 years ago Posts: 444 |
Re: ir help!!! March 08, 2009 08:56AM | Registered: 15 years ago Posts: 703 |
int main() { Initialise(); WPAD_SetDataFormat(0, WPAD_FMT_BTNS_ACC_IR); WPAD_SetVRes(0, 640, 480); while(1) { WPAD_ScanPads(); WPAD_IR(0, &ir); u32 buttonsDown = WPAD_ButtonsDown(0); if( buttonsDown & WPAD_BUTTON_B ) { //Prints wiimote position printf("X= %f Y= %f\n", ir.x, ir.y); } //Exit if (buttonsDown & WPAD_BUTTON_HOME) { exit(0); } } return 0; }
Re: ir help!!! March 08, 2009 09:56PM | Registered: 15 years ago Posts: 444 |
Re: ir help!!! March 10, 2009 10:47AM | Registered: 15 years ago Posts: 18 |
Re: ir help!!! March 11, 2009 01:33AM | Registered: 15 years ago Posts: 444 |
static u32 *xfb; static GXRModeObj *rmode; ir_t ir; 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(); WPAD_SetDataFormat(0, WPAD_FMT_BTNS_ACC_IR); WPAD_SetVRes(0, 640, 480); while(1) { WPAD_ScanPads(); WPAD_IR(0, &ir); u32 buttonsDown = WPAD_ButtonsDown(0); if( buttonsDown & WPAD_BUTTON_B ) { //Prints wiimote position printf("X= %f Y= %f\n", ir.x, ir.y); } //Exit if (buttonsDown & WPAD_BUTTON_HOME) { exit(0); } } return 0; }
Re: ir help!!! March 11, 2009 07:37AM | Registered: 15 years ago Posts: 68 |
Re: ir help!!! March 16, 2009 05:37AM | Registered: 15 years ago Posts: 444 |