IR Cursor Problems June 17, 2009 05:01AM | Registered: 15 years ago Posts: 7 |
//DECALRED EARLIER BEFORE LOOP. WPAD_Init(); //THE LOOP GIVING ME THE PROBLEM. while(1) { WPAD_ScanPads(); //Wiimote 1 u32 pressed1 = WPAD_ButtonsDown(0); //For pressed buttons. u32 held1 = WPAD_ButtonsHeld(0); //For held buttons. u32 released1 = WPAD_ButtonsUp(0); //For realeased buttons. //Wiimote 2 u32 pressed2 = WPAD_ButtonsDown(1); //For pressed buttons. u32 held2 = WPAD_ButtonsHeld(1); //For held buttons. u32 released2 = WPAD_ButtonsUp(1); //For realeased buttons. GRRLIB_FillScreen(0xFFFFFFFF); GRRLIB_DrawImg( 0, 0, tex_menu, 0, 1, 1, 0xFFFFFFFF); //IR Movement ir_t ir1, ir2; WPAD_SetDataFormat(WPAD_CHAN_0, WPAD_FMT_BTNS_ACC_IR); WPAD_SetDataFormat(WPAD_CHAN_1, WPAD_FMT_BTNS_ACC_IR); WPAD_SetVRes(0, 640, 480); WPAD_IR(0, &ir1); //For Wiimote 1 IR. WPAD_IR(1, &ir2); //For Wiimote 2 IR. GRRLIB_DrawImg(ir1.x - 48, ir1.y - 45, tex_pointer1, 0, 1, 1, 0xFFFFFFFF);//<========================= // GRRLIB_DrawImg(ir2.x - 48, ir2.y - 45, tex_pointer2, 0, 1, 1, 0xFFFFFFFF); GRRLIB_Render(); if ( ( (ir1.x >= 392) & (ir1.x <= 640) ) & ( (ir1.y >= 0) & (ir1.y <= 96) ) ) { GRRLIB_DrawImg(392, 0, tex_menu_selection_1, 0, 1, 1, 0xFFFFFFFF); GRRLIB_Render(); } if(pressed1 & WPAD_BUTTON_HOME) {exit(0);} }
Re: IR Cursor Problems June 17, 2009 05:57AM | Registered: 15 years ago Posts: 36 |
Re: IR Cursor Problems June 17, 2009 03:43PM | Registered: 16 years ago Posts: 15 |
Re: IR Cursor Problems June 18, 2009 02:26AM | Registered: 15 years ago Posts: 7 |
Quote
speewave
why did you subtract by 48 and 45?
Re: IR Cursor Problems June 18, 2009 03:52PM | Registered: 15 years ago Posts: 47 |
WPAD_SetDataFormat(WPAD_CHAN_0, WPAD_FMT_BTNS_ACC_IR); WPAD_SetDataFormat(WPAD_CHAN_1, WPAD_FMT_BTNS_ACC_IR); WPAD_SetVRes(0, 640, 480);
Re: IR Cursor Problems June 19, 2009 01:50AM | Registered: 15 years ago Posts: 7 |
while(1) { cout<<"ir1.x: "<<ir1.x<<"/tir1.y: "<<ir1.y<<"\n"; GRRLIB_FillScreen(0x0000000F); WPAD_ScanPads(); u32 held1_debug = WPAD_ButtonsHeld(0); if (held1_debug & WPAD_BUTTON_PLUS) {break;} }