2009-12-06 18:41:29 +00:00
|
|
|
/*===========================================
|
2009-12-07 18:29:47 +00:00
|
|
|
NoNameNo
|
|
|
|
Simple Flat 3D cube
|
2009-12-06 18:41:29 +00:00
|
|
|
============================================*/
|
|
|
|
#include <grrlib.h>
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <math.h>
|
|
|
|
#include <malloc.h>
|
|
|
|
#include <wiiuse/wpad.h>
|
|
|
|
|
2009-12-06 20:16:00 +00:00
|
|
|
#include "gfx/font.h"
|
2009-12-06 18:41:29 +00:00
|
|
|
|
|
|
|
int main() {
|
2009-12-06 23:12:49 +00:00
|
|
|
float a=0;
|
2009-12-15 22:32:21 +00:00
|
|
|
u32 col[3] = {0xFFFFFFFF, 0xAAAAAAFF, 0x666666FF};
|
2009-12-06 23:12:49 +00:00
|
|
|
int cubeZ=0;
|
2009-12-06 18:41:29 +00:00
|
|
|
|
|
|
|
GRRLIB_Init();
|
|
|
|
WPAD_Init();
|
|
|
|
|
2009-12-06 20:16:00 +00:00
|
|
|
GRRLIB_texImg *tex_font = GRRLIB_LoadTexture(font);
|
|
|
|
GRRLIB_InitTileSet(tex_font, 16, 16, 32);
|
|
|
|
|
2009-12-06 18:41:29 +00:00
|
|
|
GRRLIB_Settings.antialias = true;
|
|
|
|
|
2009-12-15 22:51:39 +00:00
|
|
|
GRRLIB_SetBackgroundColour(0x00, 0x00, 0x00, 0xFF);
|
|
|
|
GRRLIB_Camera3dSettings(0.0f,0.0f,13.0f, 0,1,0, 0,0,0);
|
2009-12-06 18:41:29 +00:00
|
|
|
|
|
|
|
while(1) {
|
2009-12-07 02:15:48 +00:00
|
|
|
GRRLIB_2dMode();
|
2009-12-06 18:41:29 +00:00
|
|
|
WPAD_ScanPads();
|
|
|
|
if(WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME) exit(0);
|
|
|
|
if(WPAD_ButtonsHeld(0) & WPAD_BUTTON_A) cubeZ++;
|
|
|
|
if(WPAD_ButtonsHeld(0) & WPAD_BUTTON_B) cubeZ--;
|
|
|
|
|
2010-01-05 22:04:33 +00:00
|
|
|
GRRLIB_3dMode(0.1,1000,45,1,0,0);
|
|
|
|
GRRLIB_ObjectView(0,0,cubeZ, a,a*2,a*3,1,1,1);
|
2009-12-06 23:12:49 +00:00
|
|
|
GX_Begin(GX_QUADS, GX_VTXFMT0, 24);
|
|
|
|
GX_Position3f32(-1.0f,1.0f,-1.0f);
|
|
|
|
GX_Color1u32(col[0]);
|
|
|
|
GX_Position3f32(-1.0f,-1.0f,-1.0f);
|
|
|
|
GX_Color1u32(col[0]);
|
|
|
|
GX_Position3f32(1.0f,-1.0f,-1.0f);
|
|
|
|
GX_Color1u32(col[0]);
|
|
|
|
GX_Position3f32(1.0f,1.0f,-1.0f);
|
|
|
|
GX_Color1u32(col[0]);
|
|
|
|
|
|
|
|
GX_Position3f32(-1.0f,1.0f,1.0f);
|
|
|
|
GX_Color1u32(col[0]);
|
|
|
|
GX_Position3f32(-1.0f,-1.0f,1.0f);
|
|
|
|
GX_Color1u32(col[0]);
|
|
|
|
GX_Position3f32(1.0f,-1.0f,1.0f);
|
|
|
|
GX_Color1u32(col[0]);
|
|
|
|
GX_Position3f32(1.0f,1.0f,1.0f);
|
|
|
|
GX_Color1u32(col[0]);
|
|
|
|
|
|
|
|
GX_Position3f32(-1.0f,1.0f,1.0f);
|
|
|
|
GX_Color1u32(col[1]);
|
|
|
|
GX_Position3f32(1.0f,1.0f,1.0f);
|
|
|
|
GX_Color1u32(col[1]);
|
|
|
|
GX_Position3f32(1.0f,1.0f,-1.0f);
|
|
|
|
GX_Color1u32(col[1]);
|
|
|
|
GX_Position3f32(-1.0f,1.0f,-1.0f);
|
|
|
|
GX_Color1u32(col[1]);
|
|
|
|
|
|
|
|
GX_Position3f32(-1.0f,-1.0f,1.0f);
|
|
|
|
GX_Color1u32(col[1]);
|
|
|
|
GX_Position3f32(1.0f,-1.0f,1.0f);
|
|
|
|
GX_Color1u32(col[1]);
|
|
|
|
GX_Position3f32(1.0f,-1.0f,-1.0f);
|
|
|
|
GX_Color1u32(col[1]);
|
|
|
|
GX_Position3f32(-1.0f,-1.0f,-1.0f);
|
|
|
|
GX_Color1u32(col[1]);
|
|
|
|
|
|
|
|
GX_Position3f32(-1.0f,1.0f,1.0f);
|
|
|
|
GX_Color1u32(col[2]);
|
|
|
|
GX_Position3f32(-1.0f,1.0f,-1.0f);
|
|
|
|
GX_Color1u32(col[2]);
|
|
|
|
GX_Position3f32(-1.0f,-1.0f,-1.0f);
|
|
|
|
GX_Color1u32(col[2]);
|
|
|
|
GX_Position3f32(-1.0f,-1.0f,1.0f);
|
|
|
|
GX_Color1u32(col[2]);
|
|
|
|
|
|
|
|
GX_Position3f32(1.0f,1.0f,1.0f);
|
|
|
|
GX_Color1u32(col[2]);
|
|
|
|
GX_Position3f32(1.0f,1.0f,-1.0f);
|
|
|
|
GX_Color1u32(col[2]);
|
|
|
|
GX_Position3f32(1.0f,-1.0f,-1.0f);
|
|
|
|
GX_Color1u32(col[2]);
|
|
|
|
GX_Position3f32(1.0f,-1.0f,1.0f);
|
|
|
|
GX_Color1u32(col[2]);
|
2009-12-06 18:41:29 +00:00
|
|
|
GX_End();
|
2009-12-06 23:12:49 +00:00
|
|
|
a+=0.5f;
|
2009-12-06 20:16:00 +00:00
|
|
|
|
|
|
|
// Switch To 2D Mode to display text
|
|
|
|
GRRLIB_2dMode();
|
|
|
|
GRRLIB_Printf((640-(16*29))/2, 20, tex_font, 0xFFFFFFFF, 1, "PRESS A OR B TO ZOOM THE CUBE");
|
|
|
|
|
2009-12-06 18:41:29 +00:00
|
|
|
GRRLIB_Render();
|
|
|
|
}
|
|
|
|
GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB
|
2009-12-07 18:29:47 +00:00
|
|
|
GRRLIB_FreeTexture(tex_font);
|
2009-12-06 18:41:29 +00:00
|
|
|
|
|
|
|
exit(0);
|
|
|
|
}
|
|
|
|
|