mirror of
https://github.com/GRRLIB/GRRLIB.git
synced 2024-11-22 15:02:20 +00:00
[BUG] guOrtho() needs Mtx44 for parameter so perspective should be Mtx44
[CHG] The template is now using the left and right button to move the text
This commit is contained in:
parent
6bc15252a7
commit
66a1014e66
2 changed files with 13 additions and 11 deletions
|
@ -424,7 +424,7 @@ void GRRLIB_GXEngine(Vector v[], u32 color, long n, u8 fmt) {
|
||||||
void GRRLIB_Init () {
|
void GRRLIB_Init () {
|
||||||
f32 yscale;
|
f32 yscale;
|
||||||
u32 xfbHeight;
|
u32 xfbHeight;
|
||||||
Mtx perspective;
|
Mtx44 perspective;
|
||||||
|
|
||||||
VIDEO_Init();
|
VIDEO_Init();
|
||||||
rmode = VIDEO_GetPreferredMode(NULL);
|
rmode = VIDEO_GetPreferredMode(NULL);
|
||||||
|
@ -446,7 +446,8 @@ void GRRLIB_Init () {
|
||||||
gp_fifo = (u8 *) memalign(32, DEFAULT_FIFO_SIZE);
|
gp_fifo = (u8 *) memalign(32, DEFAULT_FIFO_SIZE);
|
||||||
if(gp_fifo == NULL)
|
if(gp_fifo == NULL)
|
||||||
return;
|
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
|
// clears the bg to color and clears the z buffer
|
||||||
GXColor background = { 0, 0, 0, 0xff };
|
GXColor background = { 0, 0, 0, 0xff };
|
||||||
|
@ -477,7 +478,7 @@ void GRRLIB_Init () {
|
||||||
|
|
||||||
GX_SetVtxDesc(GX_VA_TEX0, GX_NONE);
|
GX_SetVtxDesc(GX_VA_TEX0, GX_NONE);
|
||||||
GX_SetVtxDesc(GX_VA_POS, GX_DIRECT);
|
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);
|
GX_SetVtxAttrFmt (GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0);
|
||||||
|
@ -493,9 +494,9 @@ void GRRLIB_Init () {
|
||||||
|
|
||||||
guMtxIdentity(GXmodelView2D);
|
guMtxIdentity(GXmodelView2D);
|
||||||
guMtxTransApply (GXmodelView2D, GXmodelView2D, 0.0F, 0.0F, -50.0F);
|
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_LoadProjectionMtx(perspective, GX_ORTHOGRAPHIC);
|
||||||
|
|
||||||
GX_SetViewport(0, 0, rmode->fbWidth, rmode->efbHeight, 0, 1);
|
GX_SetViewport(0, 0, rmode->fbWidth, rmode->efbHeight, 0, 1);
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
Mtx GXmodelView2D;
|
Mtx GXmodelView2D;
|
||||||
|
|
||||||
int main(){
|
int main(){
|
||||||
int rot = 0;
|
int left = 0;
|
||||||
ir_t ir1;
|
ir_t ir1;
|
||||||
|
|
||||||
GRRLIB_Init();
|
GRRLIB_Init();
|
||||||
|
@ -58,15 +58,16 @@ int main(){
|
||||||
|
|
||||||
GRRLIB_DrawImg(10, 10, tex_test_jpg, 0, 1, 1, 0xFFFFFFFF);
|
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(left, 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(left, 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(left, 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, 350, tex_BMfont2, 0xFFFFFFFF, 1, "X VALUE : 1");
|
||||||
|
|
||||||
GRRLIB_Render();
|
GRRLIB_Render();
|
||||||
|
|
||||||
if (wpaddown & WPAD_BUTTON_A) exit(0);
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue