Reading ir input / multiple wiimotes November 16, 2008 10:40PM | Registered: 16 years ago Posts: 10 |
WPAD_ReadPending(WPAD_CHAN_ALL, countevs); u32 type; for(int i=0;i<4;i++) { int res = WPAD_Probe(i, &type); if(res == WPAD_ERR_NONE) { wd = WPAD_Data(i); if(wd->btns_h & WPAD_BUTTON_1) doreload=1; // other button handling here like above, works as should // ... // ir works only for wiimote 1 if(wd->ir.valid) { // draw test dot straight to texture float theta = wd->ir.angle / 180.0 * 3.1415; drawdot((u8*)texture, vmode, vmode->fbWidth, vmode->xfbHeight, wd->ir.x, wd->ir.y, RGBToColor(255, 0, 0)); drawdot((u8*)texture, vmode, vmode->fbWidth, vmode->xfbHeight, wd->ir.x + 10*sinf(theta), wd->ir.y - 10*cosf(theta), RGBToColor(0, 0, 255)); } } }
Re: Reading ir input / multiple wiimotes November 16, 2008 10:45PM | Registered: 16 years ago Posts: 443 |
WPAD_SetDataFormat(WPAD_CHAN_0, WPAD_FMT_BTNS_ACC_IR); WPAD_SetDataFormat(WPAD_CHAN_1, WPAD_FMT_BTNS_ACC_IR); WPAD_SetDataFormat(WPAD_CHAN_2, WPAD_FMT_BTNS_ACC_IR); WPAD_SetDataFormat(WPAD_CHAN_3, WPAD_FMT_BTNS_ACC_IR);
WPAD_ScanPads(); WPAD_IR(WPAD_CHAN_0, ¤tCursorLocation); [snip - wiimote 1 IR] WPAD_IR(WPAD_CHAN_1, ¤tCursorLocation); [snip - wiimote 2 IR] WPAD_IR(WPAD_CHAN_2, ¤tCursorLocation); [snip - wiimote 3 IR] WPAD_IR(WPAD_CHAN_3, ¤tCursorLocation); [snip - wiimote 4 IR]
Re: Reading ir input / multiple wiimotes November 16, 2008 11:32PM | Registered: 16 years ago Posts: 51 |
WPAD_SetDataFormat(WPAD_CHAN_ALL, WPAD_FMT_BTNS_ACC_IR); WPAD_SetVRes(WPAD_CHAN_ALL, rmode->fbWidth, rmode->xfbHeight);
WPAD_ScanPads(); u32 wpad_one_down = WPAD_ButtonsDown(0); u32 wpad_two_down = WPAD_ButtonsDown(1); u32 type; WPADData *wd_one, *wd_two; WPAD_ReadPending(WPAD_CHAN_ALL, countevs); WPAD_Probe(WPAD_CHAN_ALL, &type); wd_one = WPAD_Data(0); wd_two = WPAD_Data(1);
if(wd_one->ir.valid) { GRRLIB_DrawColImg(wd_one->ir.x - 9,wd_one->ir.y - 7,68,80,tex_ptrone,0,1,1,0xEEFFFFFF); } if(wd_two->ir.valid) { GRRLIB_DrawColImg(wd_two->ir.x - 9,wd_two->ir.y - 7,68,80,tex_ptrtwo,0,1,1,0xEEFFFFFF); }
Re: Reading ir input / multiple wiimotes November 17, 2008 09:23AM | Registered: 16 years ago Posts: 10 |
WPAD_SetDataFormat(WPAD_CHAN_ALL, WPAD_FMT_BTNS_ACC_IR); WPAD_SetVRes(WPAD_CHAN_ALL, rmode->fbWidth, rmode->xfbHeight);