2009-09-13 14:27:01 +00:00
|
|
|
/*===========================================
|
|
|
|
GRRLIB (GX Version)
|
|
|
|
Example code by NoNameNo
|
|
|
|
|
|
|
|
This code shows how to draw
|
|
|
|
vectors using GRRLIB_DrawImgQuad.
|
|
|
|
============================================*/
|
|
|
|
#include <grrlib.h>
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <math.h>
|
|
|
|
#include <wiiuse/wpad.h>
|
|
|
|
|
|
|
|
#include "gfx/pirate.h"
|
|
|
|
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
u32 wpaddown;
|
|
|
|
|
2009-10-16 21:24:17 +00:00
|
|
|
guVector ln[4];
|
|
|
|
guVector d[4];
|
2009-11-23 19:50:36 +00:00
|
|
|
float xt, yt, zt;
|
2009-09-13 14:27:01 +00:00
|
|
|
int i;
|
2009-10-16 21:24:17 +00:00
|
|
|
float a=0.0, b=0.0;
|
2009-09-13 14:27:01 +00:00
|
|
|
float c=2;
|
2009-10-16 21:24:17 +00:00
|
|
|
guVector l[4]={{-0.8,-0.8,0},{0.8,-0.8,0},{0.8,0.8,0},{-0.8,0.8,0}};
|
2009-09-13 14:27:01 +00:00
|
|
|
|
|
|
|
GRRLIB_Init();
|
|
|
|
WPAD_Init();
|
|
|
|
GRRLIB_texImg *tex_pirate = GRRLIB_LoadTexture(pirate);
|
|
|
|
|
|
|
|
while(1) {
|
|
|
|
WPAD_ScanPads();
|
|
|
|
wpaddown = WPAD_ButtonsDown(0);
|
|
|
|
|
|
|
|
a+=0.04;
|
|
|
|
b+=0.02;
|
2009-11-23 19:50:36 +00:00
|
|
|
for(i=0;i<4;i++) {
|
2009-09-13 14:27:01 +00:00
|
|
|
xt=l[i].x*cos(a)-l[i].z*sin(a);
|
|
|
|
yt=l[i].y;
|
|
|
|
zt=l[i].x*sin(a)+l[i].z*cos(a);
|
|
|
|
ln[i].x=xt;
|
|
|
|
ln[i].y=yt*cos(b)-zt*sin(b);
|
|
|
|
ln[i].z=yt*sin(b)+zt*cos(b)+c;
|
|
|
|
d[i].x=(640/2)+(480*ln[i].x)/(2*ln[i].z);
|
|
|
|
d[i].y=(480/2)+(480*ln[i].y)/(2*ln[i].z);
|
|
|
|
}
|
|
|
|
|
|
|
|
GRRLIB_FillScreen(0xFFFFFFFF);
|
2009-12-02 19:16:28 +00:00
|
|
|
GRRLIB_DrawImgQuad(d, tex_pirate, 0xFFFFFFFF);
|
2009-09-13 14:27:01 +00:00
|
|
|
|
|
|
|
|
|
|
|
GRRLIB_Render();
|
|
|
|
if(wpaddown & WPAD_BUTTON_HOME) {
|
|
|
|
exit(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB
|
|
|
|
GRRLIB_FreeTexture(tex_pirate);
|
|
|
|
return 0;
|
|
|
|
}
|