void grlib_DrawTile (int x, int y, int w, int h, GRRLIB_texImg * tex, f32 angle, u32 color, int frame) { f32 zx, zy; if (!tex) return; zx = (f32)w / tex->tilew; zy = (f32)h / tex->tileh; GRRLIB_DrawTile (x, y, tex, angle, zx, zy, color, frame); }
int main() { float rot=0; float i; int circsize=150; char text[]="GRRLIB ROXX "; GRRLIB_Init(); PAD_Init(); GRRLIB_texImg *tex_font = GRRLIB_LoadTexture(font3d); GRRLIB_InitTileSet(tex_font, 64, 64, 32); GRRLIB_SetHandle (tex_font, tex_font->tilew/2, tex_font->tileh+circsize); GRRLIB_texImg *tex_screen; tex_screen = GRRLIB_CreateEmptyTexture(rmode->fbWidth,rmode->efbHeight); GRRLIB_Settings.antialias = true; while(1) { PAD_ScanPads(); if(PAD_ButtonsDown(0) & PAD_BUTTON_START) exit(0); // we say thant we will want to capture to a texture all the following GRRLIB_CompoStart(); for(i=0;i<360;i+=30) { // We draw some letters GRRLIB_DrawTile((rmode->fbWidth/2)-(tex_font->tilew/2), (rmode->efbHeight/2)-(tex_font->tileh+circsize), tex_font, rot+i, 1, 1, 0xFFFFFFFF, text[(int)(i/30)]-32); } // we say we want to capture now, (the buffer will be cleared after the capture) GRRLIB_CompoEnd(0, 0, tex_screen); rot-=0.6; // we now draw 3 times the captured buffer playing with color GRRLIB_DrawImg(0, 0, tex_screen, 0, 1, 1, 0xFF00FFFF); GRRLIB_DrawImg(50, 50, tex_screen, 0, 1, 1, 0xFFFF00FF); GRRLIB_DrawImg(100, 100, tex_screen, 0, 1, 1, 0xFFFFFFFF); GRRLIB_Render(); } GRRLIB_FreeTexture(tex_screen); GRRLIB_FreeTexture(tex_font); GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB exit(0); }
/** * Print formatted output. * @param xpos Specifies the x-coordinate of the upper-left corner of the text. * @param ypos Specifies the y-coordinate of the upper-left corner of the text. * @param tex The texture containing the character set. * @param color Text color in RGBA format. The alpha channel is used to change the opacity of the text. * @param zoom This is a factor by which the text size will be increase or decrease. * @param text Text to draw. * @param ... Optional arguments. */ void GRRLIB_Printf (const f32 xpos, const f32 ypos, const GRRLIB_texImg *tex, const u32 color, const f32 zoom, const char *text, ...) { if (tex == NULL || tex->data == NULL) { return; } int i, size; char tmp[1024]; f32 offset = tex->tilew * zoom; va_list argp; va_start(argp, text); size = vsnprintf(tmp, sizeof(tmp), text, argp); va_end(argp); for (i = 0; i < size; i++) { GRRLIB_DrawTile(xpos+i*offset, ypos, tex, 0, zoom, zoom, color, tmp[i] - tex->tilestart); } }
int main() { int startx=0, starty=0; int x=0, y=0; int dirx=0, diry=0; int cptx=0, cpty=0; int bgx=-32, bgy=-32; float idperso=0; int i=0; float sinnonameno=0, oldsinnonameno=0; float camZ=1400.0f; float a=0; GRRLIB_Init(); GRRLIB_Settings.antialias = false; WPAD_Init(); GRRLIB_ClipDrawing(0,0,rmode->fbWidth,rmode->efbHeight); GRRLIB_texImg *tex_tile1 = GRRLIB_LoadTexture(tile1); GRRLIB_InitTileSet(tex_tile1, TileMap1Width, TileMap1Height, 0); GRRLIB_texImg *tex_perso = GRRLIB_LoadTexture(perso); GRRLIB_InitTileSet(tex_perso, 64, 64, 0); GRRLIB_texImg *tex_bg = GRRLIB_LoadTexture(bg); GRRLIB_texImg *tex_nonameno = GRRLIB_LoadTexture(nonameno); GRRLIB_InitTileSet(tex_nonameno, 32, 32, 0); GRRLIB_texImg *tex_screen = GRRLIB_CreateEmptyTexture(rmode->fbWidth, rmode->efbHeight); GRRLIB_SetBackgroundColour(0x00, 0x00, 0x00, 0xFF); while(1) { GRRLIB_2dMode(); WPAD_ScanPads(); if (WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME) break; if (WPAD_ButtonsHeld(0) & WPAD_BUTTON_PLUS) camZ+=20.0f; if (WPAD_ButtonsHeld(0) & WPAD_BUTTON_MINUS) camZ-=20.0f; if((dirx==0) && (diry==0)) { if (WPAD_ButtonsHeld(0) & WPAD_BUTTON_LEFT) { diry=-4; idperso=15;} else if (WPAD_ButtonsHeld(0) & WPAD_BUTTON_RIGHT) { diry=4; idperso=15;} else if (WPAD_ButtonsHeld(0) & WPAD_BUTTON_DOWN) { dirx=-4 ; idperso=1;} else if (WPAD_ButtonsHeld(0) & WPAD_BUTTON_UP) { dirx=4 ; idperso=8;} } if((dirx==0) && (diry==0)) { idperso=0; } if(((Map1Info[9+starty][10+startx]==1) || (Map1Info[9+starty][11+startx]==1)) || ((Map1Info[9+starty][10+startx]==43521) || (Map1Info[9+starty][11+startx]==43521))) { } else{ dirx=0; diry=-4; } if(dirx<0) { if((Map1Info[7+starty][12+startx]==8) || (Map1Info[7+starty][12+startx]==2) || (Map1Info[8+starty][12+startx]==8) || (Map1Info[8+starty][12+startx]==2)) { dirx=0; } else { idperso++; if(idperso>7) idperso=1; } } if(dirx>0) { if((Map1Info[7+starty][9+startx]==8) || (Map1Info[7+starty][9+startx]==2) || (Map1Info[8+starty][9+startx]==8) || (Map1Info[8+starty][9+startx]==2)) { dirx=0; } else { idperso++; if(idperso>14) idperso=8; } } if(diry<0) { if((Map1Info[9+starty][10+startx]==1) || (Map1Info[9+starty][11+startx]==1)) { diry=0; } } if(diry!=0) { idperso++; if(idperso>22) idperso=16; } cptx+=dirx; if(dirx>0) bgx++; else if(dirx<0) bgx--; if((bgx>-1) || (bgx<-63)) bgx=-32; if(cptx==32) { cptx=0; dirx=0; startx--; } else if(cptx==-32) { cptx=0; dirx=0; startx++; } cpty+=diry; if(diry>0) bgy++; else if(diry<0) bgy--; if((bgy>-1) ||(bgy<-63)) bgy=-32; if(cpty==32) { cpty=0; diry=0; starty--; } else if(cpty==-32) { cpty=0; if(((Map1Info[9+starty][10+startx]==1) || (Map1Info[9+starty][11+startx]==1)) || ((Map1Info[9+starty][10+startx]==43521) || (Map1Info[9+starty][11+startx]==43521))) { diry=0; } starty++; } GRRLIB_DrawImg(bgx, bgy, tex_bg, 0, 1, 1, 0xFFFFFFFF); for(y=0;y<=(17);y++) { for(x=0;x<=(21);x++) { if(Map1Data[y+starty][x+startx] != 0) { GRRLIB_DrawTile(x*TileMap1Width+cptx-TileMap1Width,y*TileMap1Height+cpty-TileMap1Height,tex_tile1,0,1,1,0xFFFFFFFF,Map1Data[y+starty][x+startx]-1); } } } GRRLIB_DrawTile(TileMap1Width*9,TileMap1Height*6,tex_perso,0,1,1,0xFFFFFFFF,(int)idperso); oldsinnonameno=sinnonameno; for(i=0; i<8; i++) { GRRLIB_DrawTile(TileMap1Width*(6+i),(TileMap1Height*10)+sin(sinnonameno)*64,tex_nonameno,0,1,1,0xFFFFFFFF,i); sinnonameno+=0.4F; } sinnonameno=oldsinnonameno+0.08F; GRRLIB_Screen2Texture(0, 0, tex_screen, GX_TRUE); GRRLIB_Camera3dSettings(0.0f,0.0f,camZ, 0,1,0, 0,0,0); GRRLIB_3dMode(0.1,3000,45,1,0); GRRLIB_SetTexture(tex_screen,0); GRRLIB_ObjectView(0,0,0, a,a*2,a*3,1,1,1); GX_Begin(GX_QUADS, GX_VTXFMT0, 16); GX_Position3f32(-rmode->fbWidth/2,rmode->efbHeight/2,rmode->fbWidth/2); GX_Color1u32(0xFFFFFFFF); GX_TexCoord2f32(0.0f,0.0f); GX_Position3f32(rmode->fbWidth/2,rmode->efbHeight/2,rmode->fbWidth/2); GX_Color1u32(0xFFFFFFFF); GX_TexCoord2f32(1.0f,0.0f); GX_Position3f32(rmode->fbWidth/2,-rmode->efbHeight/2,rmode->fbWidth/2); GX_Color1u32(0xFFFFFFFF); GX_TexCoord2f32(1.0f,1.0f); GX_Position3f32(-rmode->fbWidth/2,-rmode->efbHeight/2,rmode->fbWidth/2); GX_Color1u32(0xFFFFFFFF); GX_TexCoord2f32(0.0f,1.0f); GX_Position3f32(rmode->fbWidth/2,rmode->efbHeight/2,-rmode->fbWidth/2); GX_Color1u32(0xFFFFFFFF); GX_TexCoord2f32(0.0f,0.0f); GX_Position3f32(-rmode->fbWidth/2,rmode->efbHeight/2,-rmode->fbWidth/2); GX_Color1u32(0xFFFFFFFF); GX_TexCoord2f32(1.0f,0.0f); GX_Position3f32(-rmode->fbWidth/2,-rmode->efbHeight/2,-rmode->fbWidth/2); GX_Color1u32(0xFFFFFFFF); GX_TexCoord2f32(1.0f,1.0f); GX_Position3f32(rmode->fbWidth/2,-rmode->efbHeight/2,-rmode->fbWidth/2); GX_Color1u32(0xFFFFFFFF); GX_TexCoord2f32(0.0f,1.0f); GX_Position3f32(rmode->fbWidth/2,rmode->efbHeight/2,rmode->fbWidth/2); GX_Color1u32(0xFFFFFFFF); GX_TexCoord2f32(0.0f,0.0f); GX_Position3f32(rmode->fbWidth/2,rmode->efbHeight/2,-rmode->fbWidth/2); GX_Color1u32(0xFFFFFFFF); GX_TexCoord2f32(1.0f,0.0f); GX_Position3f32(rmode->fbWidth/2,-rmode->efbHeight/2,-rmode->fbWidth/2); GX_Color1u32(0xFFFFFFFF); GX_TexCoord2f32(1.0f,1.0f); GX_Position3f32(rmode->fbWidth/2,-rmode->efbHeight/2,rmode->fbWidth/2); GX_Color1u32(0xFFFFFFFF); GX_TexCoord2f32(0.0f,1.0f); GX_Position3f32(-rmode->fbWidth/2,rmode->efbHeight/2,-rmode->fbWidth/2); GX_Color1u32(0xFFFFFFFF); GX_TexCoord2f32(0.0f,0.0f); GX_Position3f32(-rmode->fbWidth/2,rmode->efbHeight/2,rmode->fbWidth/2); GX_Color1u32(0xFFFFFFFF); GX_TexCoord2f32(1.0f,0.0f); GX_Position3f32(-rmode->fbWidth/2,-rmode->efbHeight/2,rmode->fbWidth/2); GX_Color1u32(0xFFFFFFFF); GX_TexCoord2f32(1.0f,1.0f); GX_Position3f32(-rmode->fbWidth/2,-rmode->efbHeight/2,-rmode->fbWidth/2); GX_Color1u32(0xFFFFFFFF); GX_TexCoord2f32(0.0f,1.0f); GX_End(); a+=0.2f; GRRLIB_Render(); } GRRLIB_FreeTexture(tex_tile1); GRRLIB_FreeTexture(tex_perso); GRRLIB_FreeTexture(tex_bg); GRRLIB_FreeTexture(tex_nonameno); GRRLIB_FreeTexture(tex_screen); GRRLIB_Exit(); exit(0); }
int main() { // Perso init position int startPosX = 9; int startPosY = 6; // Perso size int persoHalfHeight = 1; int persoHeight = 2; int persoHalfWidth = 1; int persoWidth = 2; // Map position int posX = startPosX; int posY = startPosY; int cptx = 0, cpty = 0; int bgx = -32, bgy = -32; // Counters used to process each tile of the map int x = 0; int y = 0; // Directions X/Y, defined by controls int dirx = 0; int diry = 0; // Frame number to draw of the perso float idperso = 0; // Counter of letters displaying on top layer int i = 0; // Used to move letters following a sinusoidal signal float sinnonameno = 0; float oldsinnonameno = 0; //////////////// // SYSTEM INITS //////////////// // Init Video mode, aspect ratio, FIFO buffer, FAT system, so on. GRRLIB_Init(); // Init Controls (Wiimote, Balance board, Sensor bar, so on.) WPAD_Init(); ///////////////////////////// // LOAD TEXTURES / TILESETS ///////////////////////////// // Load texture from image (c array) GRRLIB_texImg *tex_tile1 = GRRLIB_LoadTexture(tile1); // Handle the texture to be used (set number of tiles, start position, offset position, so on) GRRLIB_InitTileSet(tex_tile1, TileMapWidth, TileMapHeight, 0); // Load texture from image (c array) GRRLIB_texImg *tex_perso = GRRLIB_LoadTexture(perso); // Handle the texture to be used (set number of tiles, start position, offset position, so on) GRRLIB_InitTileSet(tex_perso, 64, 64, 0); // Load texture from image (c array) GRRLIB_texImg *tex_bg = GRRLIB_LoadTexture(bg); // Load texture from image (c array) GRRLIB_texImg *tex_nonameno = GRRLIB_LoadTexture(nonameno); // Handle the texture to be used (set number of tiles, start position, offset position, so on) GRRLIB_InitTileSet(tex_nonameno, 32, 32, 0); // Load texture to draw text (native printf doesn't work with GRRLib) GRRLIB_texImg *tex_BMfont1 = GRRLIB_LoadTexture(BMfont1); // Handle the texture to be used, in order to draw characters from the fonttype GRRLIB_InitTileSet(tex_BMfont1, 32, 32, 32); //////////////// // ENDLESS LOOP //////////////// while(1) { // Get status of Wii controller WPAD_ScanPads(); // If HOME button is pressed, the loop is interrupted. 0 is the Wiimote channel (Wiimote number 1 out of 4). // WPAD_ButtonsXXX returns a hexadecimal value representing all buttons down. The mask on HOME button allows to check if this buttons is pressed // (HOME button hexadecimal value: 0x0080) if (WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME) { break; } // Set directions X/Y values and perso frame to display, depending controls if ((dirx == 0) && (diry == 0)) { if (WPAD_ButtonsHeld(0) & WPAD_BUTTON_LEFT) { // If LEFT button is held : go bottom diry = -4; // move perso 4px on bottom idperso = 15; // select frame 15 of the perso (back) } else if (WPAD_ButtonsHeld(0) & WPAD_BUTTON_RIGHT) { // If RIGHT button is held : go top diry = 4; // move perso 4px on top idperso = 15; // select frame 15 of the perso (back) } else if (WPAD_ButtonsHeld(0) & WPAD_BUTTON_DOWN) { // If DOWN button is held : go right dirx = -4; // move perso 4px on right idperso = 1; // select frame 1 of the perso (watching on his right) } else if (WPAD_ButtonsHeld(0) & WPAD_BUTTON_UP) { // If UP button is held : go left dirx = 4; // move perso 4px on left idperso = 8; // select frame 4 of the perso (watching on his left) } } // If no movement, select frame 0 of the perso (front of the screen) if ((dirx == 0) && (diry == 0)) { idperso = 0; } if ( ( // Checks if ground at bottom (grey ground only) (Map1Info[posY + persoHeight + 1][posX + persoWidth] == 1) || (Map1Info[posY + persoHeight + 1][posX + persoHalfWidth] == 1) ) || ( // Checks if ladder at bottom. Allow to move freely on ladders (Map1Info[posY + persoHeight + 1][posX + persoWidth] == 10064) || (Map1Info[posY + persoHeight + 1][posX + persoHalfWidth] == 10064) ) ) { // Does nothing there } else { // Any case: fall dirx = 0; diry = -4; } // Debug (got the values at this step, but printed later) int printDirX = dirx; int printDirY = diry; int printPosX = posX; int printPosY = posY; if (dirx < 0) { // If goes on RIGHT // Checks collide on right to column if ( (Map1Info[posY + persoHalfHeight][posX + persoWidth + 1] == 8) || (Map1Info[posY + persoHalfHeight][posX + persoWidth + 1] == 2) || (Map1Info[posY + persoHeight][posX + persoWidth + 1] == 8) || (Map1Info[posY + persoHeight][posX + persoWidth + 1] == 2) ) { dirx = 0; } else { // Animation walking on right idperso++; if (idperso > 7) { idperso = 1; } } } else if (dirx > 0) { // If goes on LEFT // Checks collide on left to column if ( (Map1Info[posY + persoHalfHeight][posX] == 8) || (Map1Info[posY + persoHalfHeight][posX] == 2) || (Map1Info[posY + persoHeight][posX] == 8) || (Map1Info[posY + persoHeight][posX] == 2) ) { dirx = 0; } else { // Animation walking on left idperso++; if (idperso > 14) { idperso = 8; } } } // Jumping if (diry < 0) { // Checks if bottom tile is grey ground if ((Map1Info[posY + persoHeight + 1][posX + persoWidth] == 1) || (Map1Info[posY + persoHeight + 1][posX + persoHalfWidth] == 1)) { diry = 0; } } // Animation while jumping / falling / climbing a ladder if (diry != 0) { idperso++; if (idperso > 22) { idperso = 16; } } // Move the background horizontally if (dirx > 0) { bgx++; } else if (dirx < 0) { bgx--; } if ((bgx > -1) || (bgx < -63)) { bgx = -32; } // Move the map horizontally depending perso movements. // This allows to display map 4pixels per 4pixels, instead of tile per tile cptx += dirx; if (cptx == TileMapWidth) { cptx = 0; dirx = 0; posX--; } else if (cptx == -TileMapWidth) { cptx = 0; dirx = 0; posX++; } // Move the background vertically if (diry > 0) { bgy++; } else if (diry < 0) { bgy--; } if ((bgy > -1) || (bgy < -63)) { bgy = -32; } // Move the map vertically depending perso movements // This allows to display map 4pixels per 4pixels, instead of tile per tile cpty += diry; if (cpty == TileMapHeight) { cpty = 0; diry = 0; posY--; } else if (cpty == -TileMapHeight) { cpty = 0; // We check if perso is on the ground or on a ladder. // It allows to let the animation of fall/jump to continue to run instead. if ( ( (Map1Info[posY + persoHeight + 1][posX + persoWidth] == 1) || (Map1Info[posY + persoHeight + 1][posX + persoHalfWidth] == 1) ) || ( (Map1Info[posY + persoHeight + 1][posX + persoWidth] == 10064) || (Map1Info[posY + persoHeight + 1][posX + persoHalfWidth] == 10064) ) ) { diry = 0; } posY++; } ////////////////////////// // DRAWING THE BACKGROUND ////////////////////////// GRRLIB_DrawImg(bgx, // X of upper left corner bgy, // Y of upper left corner tex_bg, // texture 0, // rotation 1, // scale X 1, // scale Y 0xFFFFFFFF // color ); //////////////////////////////// // DRAWING EACH TILE OF THE MAP //////////////////////////////// // Reminder: // TileMapWidth = 32px // TileMapHeight = 32px // Process 17 tiles on height of the screen (17 x 32px = 512px) for (y = 0; y <= (16); y++) { // Process 22 tiles on width of the screen (22 * 32 = 704px) for (x = 0; x <= (21); x++) { // Only displays tiles with content (others are "transparent" on the screen) if (Map1Data[y + posY - startPosY][x + posX - startPosX] != 0) { GRRLIB_DrawTile(x * TileMapWidth + cptx - TileMapWidth, // X position to draw (upper left) y * TileMapHeight + cpty - TileMapHeight, // Y position to draw (upper left) tex_tile1, // texture of the tileset 0, // rotation 1, // scale X 1, // scale Y 0xFFFFFFFF, // color Map1Data[y + posY - startPosY][x + posX - startPosX] - 1 // Frame to display (from the tileset) ); } } } ///////////////////// // DRAWING THE PERSO ///////////////////// GRRLIB_DrawTile(TileMapWidth * startPosX, // horizontal center of the screen TileMapHeight * startPosY, // vertical center of the screen tex_perso, // texture of the tileset 0, // rotation 1, // scale X 1, // scale Y 0xFFFFFFFF, // color (int)idperso // Frame to display (from the tileset) ); /////////////////////////////////// // LETTERS MOVING ON A SIN SIGNAL /////////////////////////////////// oldsinnonameno = sinnonameno; for (i = 0; i < 8; i++) { GRRLIB_DrawTile(TileMapWidth * (6 + i), (TileMapHeight * 10) + sin(sinnonameno) * 64, tex_nonameno, 0, // rotation 1, // scale X 1, // scale Y 0xFFFFFFFF, // color i ); sinnonameno += 0.4F; } sinnonameno = oldsinnonameno + 0.08F; // Debugging GRRLIB_Printf(0, 0, tex_BMfont1, 0xFFFFFFFF, 1, "X:%d Y:%d SX:%d SY:%d", printDirX, printDirY, printPosX, printPosY); GRRLIB_Printf(0, 32, tex_BMfont1, 0xFFFFFFFF, 1, "CX:%d CY:%d", cptx, cpty); ///////////// // RENDERING ///////////// GRRLIB_Render(); } // Free textures GRRLIB_FreeTexture(tex_tile1); GRRLIB_FreeTexture(tex_perso); GRRLIB_FreeTexture(tex_bg); GRRLIB_FreeTexture(tex_nonameno); GRRLIB_FreeTexture(tex_BMfont1); // Free screen access / frame buffers / FIFO to allow // next app to handle the system without any trouble GRRLIB_Exit(); exit(0); }
int main() { float a=0; int cubeZ=5; int i=0; float sinx=0, oldsinx=0; GRRLIB_Init(); WPAD_Init(); GRRLIB_texImg *tex_screen = GRRLIB_CreateEmptyTexture(rmode->fbWidth,rmode->efbHeight); GRRLIB_InitTileSet(tex_screen, rmode->fbWidth, 1, 0); GRRLIB_texImg *tex_girl= GRRLIB_LoadTexture(girl); GRRLIB_texImg *tex_font = GRRLIB_LoadTexture(font); GRRLIB_InitTileSet(tex_font, 16, 16, 32); GRRLIB_Settings.antialias = true; GRRLIB_SetBackgroundColour(0x00, 0x00, 0x00, 0xFF); GRRLIB_Camera3dSettings(0.0f,0.0f,13.0f, 0,1,0, 0,0,0); while(1) { GRRLIB_2dMode(); 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--; GRRLIB_3dMode(0.1,1000,45,1,0); GRRLIB_SetTexture(tex_girl,0); GRRLIB_ObjectView(0,0,cubeZ, a,a*2,a*3,1,1,1); GX_Begin(GX_QUADS, GX_VTXFMT0, 24); GX_Position3f32(-1.0f,1.0f,1.0f); GX_Color1u32(0xFFFFFFFF); GX_TexCoord2f32(0.0f,0.0f); GX_Position3f32(1.0f,1.0f,1.0f); GX_Color1u32(0xFFFFFFFF); GX_TexCoord2f32(1.0f,0.0f); GX_Position3f32(1.0f,-1.0f,1.0f); GX_Color1u32(0xFFFFFFFF); GX_TexCoord2f32(1.0f,1.0f); GX_Position3f32(-1.0f,-1.0f,1.0f); GX_Color1u32(0xFFFFFFFF); GX_TexCoord2f32(0.0f,1.0f); GX_Position3f32(1.0f,1.0f,-1.0f); GX_Color1u32(0xFFFFFFFF); GX_TexCoord2f32(0.0f,0.0f); GX_Position3f32(-1.0f,1.0f,-1.0f); GX_Color1u32(0xFFFFFFFF); GX_TexCoord2f32(1.0f,0.0f); GX_Position3f32(-1.0f,-1.0f,-1.0f); GX_Color1u32(0xFFFFFFFF); GX_TexCoord2f32(1.0f,1.0f); GX_Position3f32(1.0f,-1.0f,-1.0f); GX_Color1u32(0xFFFFFFFF); GX_TexCoord2f32(0.0f,1.0f); GX_Position3f32(1.0f,1.0f,1.0f); GX_Color1u32(0xFFFFFFFF); GX_TexCoord2f32(0.0f,0.0f); GX_Position3f32(1.0f,1.0f,-1.0f); GX_Color1u32(0xFFFFFFFF); GX_TexCoord2f32(1.0f,0.0f); GX_Position3f32(1.0f,-1.0f,-1.0f); GX_Color1u32(0xFFFFFFFF); GX_TexCoord2f32(1.0f,1.0f); GX_Position3f32(1.0f,-1.0f,1.0f); GX_Color1u32(0xFFFFFFFF); GX_TexCoord2f32(0.0f,1.0f); GX_Position3f32(-1.0f,1.0f,-1.0f); GX_Color1u32(0xFFFFFFFF); GX_TexCoord2f32(0.0f,0.0f); GX_Position3f32(-1.0f,1.0f,1.0f); GX_Color1u32(0xFFFFFFFF); GX_TexCoord2f32(1.0f,0.0f); GX_Position3f32(-1.0f,-1.0f,1.0f); GX_Color1u32(0xFFFFFFFF); GX_TexCoord2f32(1.0f,1.0f); GX_Position3f32(-1.0f,-1.0f,-1.0f); GX_Color1u32(0xFFFFFFFF); GX_TexCoord2f32(0.0f,1.0f); GX_Position3f32(-1.0f,1.0f,-1.0f); GX_Color1u32(0xFFFFFFFF); GX_TexCoord2f32(0.0f,0.0f); GX_Position3f32(1.0f,1.0f,-1.0f); GX_Color1u32(0xFFFFFFFF); GX_TexCoord2f32(1.0f,0.0f); GX_Position3f32(1.0f,1.0f,1.0f); GX_Color1u32(0xFFFFFFFF); GX_TexCoord2f32(1.0f,1.0f); GX_Position3f32(-1.0f,1.0f,1.0f); GX_Color1u32(0xFFFFFFFF); GX_TexCoord2f32(0.0f,1.0f); GX_Position3f32(1.0f,-1.0f,-1.0f); GX_Color1u32(0xFFFFFFFF); GX_TexCoord2f32(0.0f,0.0f); GX_Position3f32(-1.0f,-1.0f,-1.0f); GX_Color1u32(0xFFFFFFFF); GX_TexCoord2f32(1.0f,0.0f); GX_Position3f32(-1.0f,-1.0f,1.0f); GX_Color1u32(0xFFFFFFFF); GX_TexCoord2f32(1.0f,1.0f); GX_Position3f32(1.0f,-1.0f,1.0f); GX_Color1u32(0xFFFFFFFF); GX_TexCoord2f32(0.0f,1.0f); GX_End(); GRRLIB_Screen2Texture(0,0,tex_screen,1); a+=0.5f; // Switch To 2D Mode to display text GRRLIB_2dMode(); oldsinx=sinx; for(i=0; i<rmode->efbHeight; i++) { GRRLIB_DrawTile(0+sin(sinx)*60,i,tex_screen,0,1,1,0xFFFFFFFF,i); sinx+=0.02f; } sinx=oldsinx+0.02f; GRRLIB_Printf((640-(16*29))/2, 20, tex_font, 0xFFFFFFFF, 1, "PRESS A OR B TO ZOOM THE CUBE"); GRRLIB_Render(); } GRRLIB_FreeTexture(tex_girl); GRRLIB_FreeTexture(tex_font); GRRLIB_FreeTexture(tex_screen); GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB exit(0); }