Updating png image based on Wiimote IR x y position January 20, 2009 04:29AM | Registered: 15 years ago Posts: 31 |
/*=========================================== GRRLIB (GX version) 3.0.1 alpha Code : NoNameNo GX hints : RedShade [grrlib.santo.fr] Tutorial : Day 5 (Display an Image) ============================================*/ #include "GRRLIB/GRRLIB.h" #include "gfx/logo.h" #include "gfx/generic_point.h" #include "GRRLIB/fonts/GRRLIB_font1.h" Mtx GXmodelView2D; ir_t ir; int main(){ u8 *tex_logo=GRRLIB_LoadTexture(logo); u8 *genpointer=GRRLIB_LoadTexture(generic_point); u8 *tex_font1=GRRLIB_LoadTexture(GRRLIB_font1); float rot=0; float alpha=255; float x=144; float y=176; VIDEO_Init(); WPAD_Init(); GRRLIB_InitVideo(); GRRLIB_Start(); while(1){ WPAD_ScanPads(); WPAD_IR(0, &ir); u32 wpaddown = WPAD_ButtonsDown(0); u32 wpadheld = WPAD_ButtonsHeld(0); GRRLIB_FillScreen(0xFF000000); GRRLIB_DrawImg(x, y, 352, 128, tex_logo, rot, 1, 1, alpha ); GRRLIB_Printf(50,50,tex_font1,0xFFFFFFFF,1,"x : %f n/ y: %f",ir.x, ir.y); GRRLIB_DrawImg(ir.x, ir.y, 96, 96, genpointer, 0, 1, 1, 255); GRRLIB_Plot(ir.x, ir.y,0xFFFFFFFF); GRRLIB_Render(); if (wpaddown & WPAD_BUTTON_HOME) exit(0); if (wpadheld & WPAD_BUTTON_RIGHT) x+=2;//rot+=2; if (wpadheld & WPAD_BUTTON_LEFT) x-=2;//rot-=2; if (wpadheld & WPAD_BUTTON_UP) y-=2; if (wpadheld & WPAD_BUTTON_DOWN) y+=2; if (wpadheld & WPAD_BUTTON_MINUS) if((alpha-=3)<0) alpha=0; if (wpadheld & WPAD_BUTTON_PLUS) if((alpha+=3)>255) alpha=255; } return 0; }
Re: Updating png image based on Wiimote IR x y position January 20, 2009 04:31AM | Registered: 15 years ago Posts: 3 |
Re: Updating png image based on Wiimote IR x y position January 20, 2009 04:59AM | Registered: 15 years ago Posts: 73 |
Re: Updating png image based on Wiimote IR x y position January 20, 2009 05:12AM | Registered: 15 years ago Posts: 31 |
Re: Updating png image based on Wiimote IR x y position January 20, 2009 05:24AM | Registered: 15 years ago Posts: 441 |
Re: Updating png image based on Wiimote IR x y position January 20, 2009 05:45AM | Registered: 15 years ago Posts: 31 |
Re: Updating png image based on Wiimote IR x y position January 21, 2009 10:02PM | Registered: 15 years ago Posts: 109 |
Re: Updating png image based on Wiimote IR x y position January 22, 2009 07:09PM | Registered: 15 years ago Posts: 2 |
Re: Updating png image based on Wiimote IR x y position January 24, 2009 05:41AM | Registered: 15 years ago Posts: 31 |