diff --git a/README.TXT b/README.TXT index 3ad0740..940a021 100644 --- a/README.TXT +++ b/README.TXT @@ -50,6 +50,8 @@ ChangeLog : * InitVideo() and GRRLIB_Start() merge into GRRLIB_Init(). +* add GRRLIB_HotZone that return True/False if the wpad is in a specific zone + have a look at the sample code to see how all this work ;) Remember that 3.0.5 is a WIP preview for the soon coming GRRLIB 4.0 and it's not intend to be publicly released... diff --git a/template/source/GRRLIB/GRRLIB.c b/template/source/GRRLIB/GRRLIB.c index ff6984a..7d39b1b 100644 --- a/template/source/GRRLIB/GRRLIB.c +++ b/template/source/GRRLIB/GRRLIB.c @@ -400,6 +400,26 @@ void GRRLIB_Printf(f32 xpos, f32 ypos, GRRLIB_texImg tex, u32 color, f32 zoom, c } } +/** + * Detect if the wiimote is in a zone + * @param hotx + * @param hoty + * @param hotw + * @param hoth + * @param padx + * @param pady + * @return true/false if you are in or out + */ +bool GRRLIB_HotZone(int hotx, int hoty, int hotw, int hoth, int wpadx, int wpady) { + bool test=false; + + if(((wpadx>hotx) & (wpadx<(hotx+hotw))) & ((wpady>hoty) & (wpady<(hoty+hoth)))){ + test=true; + } + + return(test); +} + /** * * @param v diff --git a/template/source/GRRLIB/GRRLIB.h b/template/source/GRRLIB/GRRLIB.h index c793db4..beb61e8 100644 --- a/template/source/GRRLIB/GRRLIB.h +++ b/template/source/GRRLIB/GRRLIB.h @@ -58,6 +58,7 @@ inline void GRRLIB_DrawTile(f32 xpos, f32 ypos, GRRLIB_texImg tex, float degrees void GRRLIB_Printf(f32 xpos, f32 ypos, GRRLIB_texImg tex, u32 color, f32 zoom, const char *text, ...); +bool GRRLIB_HotZone(int hotx, int hoty, int hotw, int hoth, int wpadx, int wpady); void GRRLIB_GXEngine(Vector v[], u32 color, long count, u8 fmt);