diff --git a/template/source/GRRLIB/GRRLIB.c b/template/source/GRRLIB/GRRLIB.c index e89f567..057c7cc 100644 --- a/template/source/GRRLIB/GRRLIB.c +++ b/template/source/GRRLIB/GRRLIB.c @@ -424,7 +424,7 @@ void GRRLIB_GXEngine(Vector v[], u32 color, long n, u8 fmt) { void GRRLIB_Init () { f32 yscale; u32 xfbHeight; - Mtx perspective; + Mtx44 perspective; VIDEO_Init(); rmode = VIDEO_GetPreferredMode(NULL); @@ -446,7 +446,8 @@ void GRRLIB_Init () { gp_fifo = (u8 *) memalign(32, DEFAULT_FIFO_SIZE); if(gp_fifo == NULL) return; - GX_Init (gp_fifo, DEFAULT_FIFO_SIZE); + memset(gp_fifo, 0, DEFAULT_FIFO_SIZE); + GX_Init(gp_fifo, DEFAULT_FIFO_SIZE); // clears the bg to color and clears the z buffer GXColor background = { 0, 0, 0, 0xff }; @@ -477,7 +478,7 @@ void GRRLIB_Init () { GX_SetVtxDesc(GX_VA_TEX0, GX_NONE); GX_SetVtxDesc(GX_VA_POS, GX_DIRECT); - GX_SetVtxDesc (GX_VA_CLR0, GX_DIRECT); + GX_SetVtxDesc(GX_VA_CLR0, GX_DIRECT); GX_SetVtxAttrFmt (GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0); @@ -493,9 +494,9 @@ void GRRLIB_Init () { guMtxIdentity(GXmodelView2D); guMtxTransApply (GXmodelView2D, GXmodelView2D, 0.0F, 0.0F, -50.0F); - GX_LoadPosMtxImm(GXmodelView2D,GX_PNMTX0); + GX_LoadPosMtxImm(GXmodelView2D, GX_PNMTX0); - guOrtho(perspective,0, 479, 0, 639, 0, 300); + guOrtho(perspective,0, 479, 0, 639, 0, 300.0F); GX_LoadProjectionMtx(perspective, GX_ORTHOGRAPHIC); GX_SetViewport(0, 0, rmode->fbWidth, rmode->efbHeight, 0, 1); diff --git a/template/source/main.c b/template/source/main.c index 5baec21..7897770 100644 --- a/template/source/main.c +++ b/template/source/main.c @@ -22,7 +22,7 @@ Mtx GXmodelView2D; int main(){ - int rot = 0; + int left = 0; ir_t ir1; GRRLIB_Init(); @@ -58,15 +58,16 @@ int main(){ GRRLIB_DrawImg(10, 10, tex_test_jpg, 0, 1, 1, 0xFFFFFFFF); - GRRLIB_Printf(rot, 200, tex_BMfont1, 0xFFFFFFFF, 1, "X VALUE:%d", (int)ir1.sx); - GRRLIB_Printf(rot, 250, tex_BMfont4, 0xFFFFFFFF, 1, "X VALUE:%d", (int)ir1.sx); - GRRLIB_Printf(rot, 300, tex_BMfont3, 0xFFFFFFFF, 1, "X VALUE : %d", tex_test_jpg.w); - GRRLIB_Printf(rot, 350, tex_BMfont2, 0xFFFFFFFF, 1, "X VALUE : 1"); + GRRLIB_Printf(left, 200, tex_BMfont1, 0xFFFFFFFF, 1, "X VALUE:%d", (int)ir1.sx); + GRRLIB_Printf(left, 250, tex_BMfont4, 0xFFFFFFFF, 1, "X VALUE:%d", (int)ir1.sx); + GRRLIB_Printf(left, 300, tex_BMfont3, 0xFFFFFFFF, 1, "X VALUE : %d", tex_test_jpg.w); + GRRLIB_Printf(left, 350, tex_BMfont2, 0xFFFFFFFF, 1, "X VALUE : 1"); GRRLIB_Render(); if (wpaddown & WPAD_BUTTON_A) exit(0); - if (wpadheld & WPAD_BUTTON_B) rot++; + if (wpadheld & WPAD_BUTTON_LEFT) left--; + if (wpadheld & WPAD_BUTTON_RIGHT) left++; } return 0; }