mirror of
https://github.com/GRRLIB/GRRLIB.git
synced 2024-11-26 08:42:19 +00:00
[CHG] Cleanup
This commit is contained in:
parent
a3024c20b7
commit
740a81df7e
6 changed files with 119 additions and 121 deletions
|
@ -40,30 +40,30 @@ void GRRLIB_Screen2Texture (int posx, int posy, GRRLIB_texImg *tex, bool clear)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start GX Compositing Process.
|
* Start GX compositing process.
|
||||||
|
* @see GRRLIB_CompoEnd
|
||||||
*/
|
*/
|
||||||
void GRRLIB_CompoStart (void){
|
void GRRLIB_CompoStart (void){
|
||||||
GX_SetPixelFmt(GX_PF_RGBA6_Z24,GX_ZC_LINEAR);
|
GX_SetPixelFmt(GX_PF_RGBA6_Z24,GX_ZC_LINEAR);
|
||||||
GX_PokeAlphaRead(GX_READ_NONE);
|
GX_PokeAlphaRead(GX_READ_NONE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* End GX Compositing Process (Make a snapshot of the screen in a texture WITH ALPHA LAYER).
|
* End GX compositing process (Make a snapshot of the screen in a texture WITH ALPHA LAYER).
|
||||||
|
* EFB is cleared after this function.
|
||||||
|
* @see GRRLIB_CompoStart
|
||||||
* @param posx top left corner of the grabbed part.
|
* @param posx top left corner of the grabbed part.
|
||||||
* @param posy top left corner of the grabbed part.
|
* @param posy top left corner of the grabbed part.
|
||||||
* @param tex A pointer to a texture representing the screen or NULL if an error occurs.
|
* @param tex A pointer to a texture representing the screen or NULL if an error occurs.
|
||||||
* @info EFB is cleared after this function.
|
|
||||||
*/
|
*/
|
||||||
void GRRLIB_CompoEnd(int posx, int posy, GRRLIB_texImg *tex){
|
void GRRLIB_CompoEnd(int posx, int posy, GRRLIB_texImg *tex){
|
||||||
GRRLIB_Screen2Texture(posx, posy, tex, FALSE);
|
GRRLIB_Screen2Texture(posx, posy, tex, FALSE);
|
||||||
|
|
||||||
GX_SetTexCopySrc(0, 0, rmode->fbWidth, rmode->efbHeight);
|
GX_SetTexCopySrc(0, 0, rmode->fbWidth, rmode->efbHeight);
|
||||||
GX_SetTexCopyDst(rmode->fbWidth, rmode->efbHeight, GX_TF_RGBA8, GX_FALSE);
|
GX_SetTexCopyDst(rmode->fbWidth, rmode->efbHeight, GX_TF_RGBA8, GX_FALSE);
|
||||||
GX_CopyTex(TrashTex, GX_TRUE);
|
GX_CopyTex(TrashTex, GX_TRUE);
|
||||||
GX_PixModeSync();
|
GX_PixModeSync();
|
||||||
|
|
||||||
if (rmode->aa) GX_SetPixelFmt(GX_PF_RGB565_Z16, GX_ZC_LINEAR) ;
|
|
||||||
else GX_SetPixelFmt(GX_PF_RGB8_Z24 , GX_ZC_LINEAR) ;
|
|
||||||
|
|
||||||
|
if (rmode->aa) GX_SetPixelFmt(GX_PF_RGB565_Z16, GX_ZC_LINEAR) ;
|
||||||
|
else GX_SetPixelFmt(GX_PF_RGB8_Z24 , GX_ZC_LINEAR) ;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,22 +37,20 @@ int main() {
|
||||||
WPAD_ScanPads();
|
WPAD_ScanPads();
|
||||||
if(WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME) exit(0);
|
if(WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME) exit(0);
|
||||||
|
|
||||||
GRRLIB_CompoStart ();
|
GRRLIB_CompoStart();
|
||||||
GRRLIB_SetAlpha(0xff);
|
GRRLIB_SetAlpha(0xff);
|
||||||
for(i=0;i<360;i+=30){
|
for(i=0;i<360;i+=30) {
|
||||||
GRRLIB_Settings.rotation= i+rot;
|
GRRLIB_Settings.rotation= i+rot;
|
||||||
GRRLIB_DrawTile((rmode->fbWidth/2)-(tex_font->tilew/2), (rmode->efbHeight/2)-(tex_font->tileh+circsize),tex_font,65-32+((int)i/45));
|
GRRLIB_DrawTile((rmode->fbWidth/2)-(tex_font->tilew/2), (rmode->efbHeight/2)-(tex_font->tileh+circsize), tex_font, 65-32+((int)i/45));
|
||||||
}
|
}
|
||||||
GRRLIB_CompoEnd(0, 0, tex_screen);
|
GRRLIB_CompoEnd(0, 0, tex_screen);
|
||||||
|
|
||||||
GRRLIB_Settings.rotation=0;
|
GRRLIB_Settings.rotation=0;
|
||||||
rot-=0.6;
|
rot-=0.6;
|
||||||
|
|
||||||
|
GRRLIB_SetAlpha(0xFF);
|
||||||
GRRLIB_SetAlpha(0xff);
|
GRRLIB_DrawImg(50, 50, tex_screen);
|
||||||
GRRLIB_DrawImg(50, 50,tex_screen);
|
GRRLIB_DrawImg(100, 100, tex_screen);
|
||||||
GRRLIB_SetAlpha(0xFF);
|
|
||||||
GRRLIB_DrawImg(100, 100,tex_screen);
|
|
||||||
|
|
||||||
GRRLIB_Render();
|
GRRLIB_Render();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
/*===========================================
|
/*===========================================
|
||||||
GRRLIB (GX Version)
|
GRRLIB (GX Version)
|
||||||
- Example Code -
|
- Example Code -
|
||||||
|
|
||||||
How To use Bitmap Fonts
|
How To use Bitmap Fonts
|
||||||
============================================*/
|
============================================*/
|
||||||
#include <grrlib.h>
|
#include <grrlib.h>
|
||||||
|
|
||||||
#include <ogc/lwp_watchdog.h> // Needed for gettime and ticks_to_millisecs
|
#include <ogc/lwp_watchdog.h> // Needed for gettime and ticks_to_millisecs
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <wiiuse/wpad.h>
|
#include <wiiuse/wpad.h>
|
||||||
#include <wiiuse/wpad.h>
|
#include <wiiuse/wpad.h>
|
||||||
|
|
|
@ -24,7 +24,7 @@ int main() {
|
||||||
// Load the original texture and create empty texture of the same size as the original one
|
// Load the original texture and create empty texture of the same size as the original one
|
||||||
GRRLIB_texImg *tex_pirate = GRRLIB_LoadTexture(pirate);
|
GRRLIB_texImg *tex_pirate = GRRLIB_LoadTexture(pirate);
|
||||||
GRRLIB_texImg *tex_gray = GRRLIB_CreateEmptyTexture(tex_pirate->w, tex_pirate->h);
|
GRRLIB_texImg *tex_gray = GRRLIB_CreateEmptyTexture(tex_pirate->w, tex_pirate->h);
|
||||||
GRRLIB_texImg *tex_sepia = GRRLIB_CreateEmptyTexture(tex_pirate->w, tex_pirate->h);
|
GRRLIB_texImg *tex_sepia = GRRLIB_CreateEmptyTexture(tex_pirate->w, tex_pirate->h);
|
||||||
GRRLIB_texImg *tex_invert = GRRLIB_CreateEmptyTexture(tex_pirate->w, tex_pirate->h);
|
GRRLIB_texImg *tex_invert = GRRLIB_CreateEmptyTexture(tex_pirate->w, tex_pirate->h);
|
||||||
GRRLIB_texImg *tex_blur1 = GRRLIB_CreateEmptyTexture(tex_pirate->w, tex_pirate->h);
|
GRRLIB_texImg *tex_blur1 = GRRLIB_CreateEmptyTexture(tex_pirate->w, tex_pirate->h);
|
||||||
GRRLIB_texImg *tex_blur2 = GRRLIB_CreateEmptyTexture(tex_pirate->w, tex_pirate->h);
|
GRRLIB_texImg *tex_blur2 = GRRLIB_CreateEmptyTexture(tex_pirate->w, tex_pirate->h);
|
||||||
|
@ -122,44 +122,44 @@ int main() {
|
||||||
switch(page)
|
switch(page)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
GRRLIB_SetColorRGBA(0X000000FF);
|
GRRLIB_SetColorRGBA(0X000000FF);
|
||||||
GRRLIB_Printf(10, 10, text_font1, "GRAYSCALE FX");
|
GRRLIB_Printf(10, 10, text_font1, "GRAYSCALE FX");
|
||||||
|
|
||||||
GRRLIB_SetColorRGBA(0xFFFFFFFF);
|
GRRLIB_SetColorRGBA(0xFFFFFFFF);
|
||||||
GRRLIB_DrawImg(10, 60, tex_pirate);
|
GRRLIB_DrawImg(10, 60, tex_pirate);
|
||||||
GRRLIB_DrawImg(10+tex_pirate->w*1, 60, tex_gray);
|
GRRLIB_DrawImg(10+tex_pirate->w*1, 60, tex_gray);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
GRRLIB_SetColorRGBA(0X000000FF);
|
GRRLIB_SetColorRGBA(0X000000FF);
|
||||||
GRRLIB_Printf(10, 10, text_font1, "SEPIA FX");
|
GRRLIB_Printf(10, 10, text_font1, "SEPIA FX");
|
||||||
|
|
||||||
GRRLIB_SetColorRGBA(0xFFFFFFFF);
|
GRRLIB_SetColorRGBA(0xFFFFFFFF);
|
||||||
GRRLIB_DrawImg(10, 60, tex_pirate);
|
GRRLIB_DrawImg(10, 60, tex_pirate);
|
||||||
GRRLIB_DrawImg(10+tex_pirate->w*1, 60, tex_sepia);
|
GRRLIB_DrawImg(10+tex_pirate->w*1, 60, tex_sepia);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
GRRLIB_SetColorRGBA(0X000000FF);
|
GRRLIB_SetColorRGBA(0X000000FF);
|
||||||
GRRLIB_Printf(10, 10, text_font1, "INVERT FX");
|
GRRLIB_Printf(10, 10, text_font1, "INVERT FX");
|
||||||
|
|
||||||
GRRLIB_SetColorRGBA(0xFFFFFFFF);
|
GRRLIB_SetColorRGBA(0xFFFFFFFF);
|
||||||
GRRLIB_DrawImg(10, 60, tex_pirate);
|
GRRLIB_DrawImg(10, 60, tex_pirate);
|
||||||
GRRLIB_DrawImg(10+tex_pirate->w*1, 60, tex_invert);
|
GRRLIB_DrawImg(10+tex_pirate->w*1, 60, tex_invert);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
GRRLIB_SetColorRGBA(0X000000FF);
|
GRRLIB_SetColorRGBA(0X000000FF);
|
||||||
GRRLIB_Printf(10, 10, text_font1, "FLIPH AND FLIPV FX");
|
GRRLIB_Printf(10, 10, text_font1, "FLIPH AND FLIPV FX");
|
||||||
|
|
||||||
GRRLIB_SetColorRGBA(0xFFFFFFFF);
|
GRRLIB_SetColorRGBA(0xFFFFFFFF);
|
||||||
GRRLIB_DrawImg(10, 60, tex_pirate);
|
GRRLIB_DrawImg(10, 60, tex_pirate);
|
||||||
GRRLIB_DrawImg(10+tex_pirate->w*1, 60, tex_fliph);
|
GRRLIB_DrawImg(10+tex_pirate->w*1, 60, tex_fliph);
|
||||||
GRRLIB_DrawImg(10+tex_pirate->w*2, 60, tex_flipv);
|
GRRLIB_DrawImg(10+tex_pirate->w*2, 60, tex_flipv);
|
||||||
GRRLIB_DrawImg(10+tex_pirate->w*3, 60, tex_fliphv);
|
GRRLIB_DrawImg(10+tex_pirate->w*3, 60, tex_fliphv);
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
GRRLIB_SetColorRGBA(0X000000FF);
|
GRRLIB_SetColorRGBA(0X000000FF);
|
||||||
GRRLIB_Printf(10, 10, text_font1, "BLUR FX");
|
GRRLIB_Printf(10, 10, text_font1, "BLUR FX");
|
||||||
|
|
||||||
GRRLIB_SetColorRGBA(0xFFFFFFFF);
|
GRRLIB_SetColorRGBA(0xFFFFFFFF);
|
||||||
GRRLIB_DrawImg(10, 60, tex_pirate);
|
GRRLIB_DrawImg(10, 60, tex_pirate);
|
||||||
GRRLIB_DrawImg(10+tex_pirate->w*1, 60, tex_blur1);
|
GRRLIB_DrawImg(10+tex_pirate->w*1, 60, tex_blur1);
|
||||||
GRRLIB_DrawImg(10+tex_pirate->w*2, 60, tex_blur2);
|
GRRLIB_DrawImg(10+tex_pirate->w*2, 60, tex_blur2);
|
||||||
|
@ -169,10 +169,10 @@ int main() {
|
||||||
GRRLIB_DrawImg(10+tex_pirate->w*2, 60+tex_pirate->h*1, tex_blur6);
|
GRRLIB_DrawImg(10+tex_pirate->w*2, 60+tex_pirate->h*1, tex_blur6);
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
GRRLIB_SetColorRGBA(0X000000FF);
|
GRRLIB_SetColorRGBA(0X000000FF);
|
||||||
GRRLIB_Printf(10, 10, text_font1, "PIXELATE FX");
|
GRRLIB_Printf(10, 10, text_font1, "PIXELATE FX");
|
||||||
|
|
||||||
GRRLIB_SetColorRGBA(0xFFFFFFFF);
|
GRRLIB_SetColorRGBA(0xFFFFFFFF);
|
||||||
GRRLIB_DrawImg(10, 60, tex_pirate);
|
GRRLIB_DrawImg(10, 60, tex_pirate);
|
||||||
GRRLIB_DrawImg(10+tex_pirate->w*1, 60, tex_pixel1);
|
GRRLIB_DrawImg(10+tex_pirate->w*1, 60, tex_pixel1);
|
||||||
GRRLIB_DrawImg(10+tex_pirate->w*2, 60, tex_pixel2);
|
GRRLIB_DrawImg(10+tex_pirate->w*2, 60, tex_pixel2);
|
||||||
|
@ -182,10 +182,10 @@ int main() {
|
||||||
GRRLIB_DrawImg(10+tex_pirate->w*2, 60+tex_pirate->h*1, tex_pixel6);
|
GRRLIB_DrawImg(10+tex_pirate->w*2, 60+tex_pirate->h*1, tex_pixel6);
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
GRRLIB_SetColorRGBA(0X000000FF);
|
GRRLIB_SetColorRGBA(0X000000FF);
|
||||||
GRRLIB_Printf(10, 10, text_font1, "SCATTER FX");
|
GRRLIB_Printf(10, 10, text_font1, "SCATTER FX");
|
||||||
|
|
||||||
GRRLIB_SetColorRGBA(0xFFFFFFFF);
|
GRRLIB_SetColorRGBA(0xFFFFFFFF);
|
||||||
GRRLIB_DrawImg(10, 60, tex_pirate);
|
GRRLIB_DrawImg(10, 60, tex_pirate);
|
||||||
GRRLIB_DrawImg(10+tex_pirate->w*1, 60, tex_scatter1);
|
GRRLIB_DrawImg(10+tex_pirate->w*1, 60, tex_scatter1);
|
||||||
GRRLIB_DrawImg(10+tex_pirate->w*2, 60, tex_scatter2);
|
GRRLIB_DrawImg(10+tex_pirate->w*2, 60, tex_scatter2);
|
||||||
|
@ -195,7 +195,7 @@ int main() {
|
||||||
GRRLIB_DrawImg(10+tex_pirate->w*2, 60+tex_pirate->h*1, tex_scatter6);
|
GRRLIB_DrawImg(10+tex_pirate->w*2, 60+tex_pirate->h*1, tex_scatter6);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
GRRLIB_SetColorRGBA(0X000000FF);
|
GRRLIB_SetColorRGBA(0X000000FF);
|
||||||
GRRLIB_Printf(10, 10, text_font1, "WELCOME TO THE");
|
GRRLIB_Printf(10, 10, text_font1, "WELCOME TO THE");
|
||||||
GRRLIB_Printf(10, 40, text_font1, "GRRLIB FX DEMO.");
|
GRRLIB_Printf(10, 40, text_font1, "GRRLIB FX DEMO.");
|
||||||
GRRLIB_Printf(10, 80, text_font1, "TO QUIT PRESS THE");
|
GRRLIB_Printf(10, 80, text_font1, "TO QUIT PRESS THE");
|
||||||
|
|
|
@ -81,12 +81,12 @@ void GRRLIB_addon_Button(int indice, int x,int y,u32 col, int wpadx, int wpady,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
GRRLIB_SetColorRGBA(0xFFFFFF77);
|
GRRLIB_SetColorRGBA(0xFFFFFF77);
|
||||||
if((toto[0]=='^') && (toto[1]=='U')) GRRLIB_Printf(x+4, y+2, tex_GRRLIBfont, "%c", 0xa1);
|
if((toto[0]=='^') && (toto[1]=='U')) GRRLIB_Printf(x+4, y+2, tex_GRRLIBfont, "%c", 0xa1);
|
||||||
else if((toto[0]=='^') && (toto[1]=='D')) GRRLIB_Printf(x+4, y+2, tex_GRRLIBfont, "%c", 0xa2);
|
else if((toto[0]=='^') && (toto[1]=='D')) GRRLIB_Printf(x+4, y+2, tex_GRRLIBfont, "%c", 0xa2);
|
||||||
else if((toto[0]=='^') && (toto[1]=='L')) GRRLIB_Printf(x+4, y+2, tex_GRRLIBfont, "%c", 0xa3);
|
else if((toto[0]=='^') && (toto[1]=='L')) GRRLIB_Printf(x+4, y+2, tex_GRRLIBfont, "%c", 0xa3);
|
||||||
else if((toto[0]=='^') && (toto[1]=='R')) GRRLIB_Printf(x+4, y+2, tex_GRRLIBfont, "%c", 0xa4);
|
else if((toto[0]=='^') && (toto[1]=='R')) GRRLIB_Printf(x+4, y+2, tex_GRRLIBfont, "%c", 0xa4);
|
||||||
else GRRLIB_Printf(x+4, y+2, tex_GRRLIBfont, toto);
|
else GRRLIB_Printf(x+4, y+2, tex_GRRLIBfont, toto);
|
||||||
GRRLIB_SetColorRGBA(0xFFFFFFFF);
|
GRRLIB_SetColorRGBA(0xFFFFFFFF);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,39 +32,39 @@ GRRLIB_texImg *GFX_Font;
|
||||||
|
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
// Init Variables
|
// Init Variables
|
||||||
u32 WPADKeyDown;
|
u32 WPADKeyDown;
|
||||||
u32 WPADKeyHeld;
|
u32 WPADKeyHeld;
|
||||||
short WinW, WinH;
|
short WinW, WinH;
|
||||||
int P1MX, P1MY;
|
int P1MX, P1MY;
|
||||||
|
|
||||||
u8 Stage = 0, Blending = 0;
|
u8 Stage = 0, Blending = 0;
|
||||||
u8 BlobType = 0;
|
u8 BlobType = 0;
|
||||||
u8 Color = 255;
|
u8 Color = 255;
|
||||||
u16 Step = 0;
|
u16 Step = 0;
|
||||||
float SX, SY;
|
float SX, SY;
|
||||||
|
|
||||||
|
|
||||||
// Init GRRLIB & WiiUse
|
// Init GRRLIB & WiiUse
|
||||||
GRRLIB_Init();
|
GRRLIB_Init();
|
||||||
WinW = rmode->fbWidth;
|
WinW = rmode->fbWidth;
|
||||||
WinH = rmode->efbHeight;
|
WinH = rmode->efbHeight;
|
||||||
WPAD_Init();
|
WPAD_Init();
|
||||||
WPAD_SetIdleTimeout( 60*10 );
|
WPAD_SetIdleTimeout( 60*10 );
|
||||||
WPAD_SetDataFormat( WPAD_CHAN_0, WPAD_FMT_BTNS_ACC_IR );
|
WPAD_SetDataFormat( WPAD_CHAN_0, WPAD_FMT_BTNS_ACC_IR );
|
||||||
|
|
||||||
// Load Textures
|
// Load Textures
|
||||||
GFX_Background = GRRLIB_LoadTextureJPG(RGFX_Background);
|
GFX_Background = GRRLIB_LoadTextureJPG(RGFX_Background);
|
||||||
GFX_Blob[0] = GRRLIB_LoadTexturePNG(RGFX_Blob01);
|
GFX_Blob[0] = GRRLIB_LoadTexturePNG(RGFX_Blob01);
|
||||||
GFX_Blob[1] = GRRLIB_LoadTexturePNG(RGFX_Blob02);
|
GFX_Blob[1] = GRRLIB_LoadTexturePNG(RGFX_Blob02);
|
||||||
GFX_Blob[2] = GRRLIB_LoadTexturePNG(RGFX_Blob03);
|
GFX_Blob[2] = GRRLIB_LoadTexturePNG(RGFX_Blob03);
|
||||||
GFX_Font = GRRLIB_LoadTexturePNG(RGFX_Font);
|
GFX_Font = GRRLIB_LoadTexturePNG(RGFX_Font);
|
||||||
GRRLIB_InitTileSet(GFX_Font, 8, 16, 32);
|
GRRLIB_InitTileSet(GFX_Font, 8, 16, 32);
|
||||||
|
|
||||||
// Set Handles
|
// Set Handles
|
||||||
GRRLIB_SetMidHandle( GFX_Blob[0], true );
|
GRRLIB_SetMidHandle( GFX_Blob[0], true );
|
||||||
GRRLIB_SetMidHandle( GFX_Blob[1], true );
|
GRRLIB_SetMidHandle( GFX_Blob[1], true );
|
||||||
GRRLIB_SetMidHandle( GFX_Blob[2], true );
|
GRRLIB_SetMidHandle( GFX_Blob[2], true );
|
||||||
|
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
|
@ -72,51 +72,51 @@ int main() {
|
||||||
WPADKeyDown = WPAD_ButtonsDown(WPAD_CHAN_0);
|
WPADKeyDown = WPAD_ButtonsDown(WPAD_CHAN_0);
|
||||||
WPADKeyHeld = WPAD_ButtonsHeld(WPAD_CHAN_0);
|
WPADKeyHeld = WPAD_ButtonsHeld(WPAD_CHAN_0);
|
||||||
WPAD_SetVRes(WPAD_CHAN_0, WinW, WinH);
|
WPAD_SetVRes(WPAD_CHAN_0, WinW, WinH);
|
||||||
WPAD_IR(WPAD_CHAN_0, &P1Mote);
|
WPAD_IR(WPAD_CHAN_0, &P1Mote);
|
||||||
|
|
||||||
// WiiMote IR Viewport Correction
|
// WiiMote IR Viewport Correction
|
||||||
P1MX = P1Mote.sx - 150;
|
P1MX = P1Mote.sx - 150;
|
||||||
P1MY = P1Mote.sy - 150;
|
P1MY = P1Mote.sy - 150;
|
||||||
|
|
||||||
// Update Stage
|
// Update Stage
|
||||||
Step = Step + 1;
|
Step = Step + 1;
|
||||||
if (Step == 720) { Step = 0; }
|
if (Step == 720) { Step = 0; }
|
||||||
SX = 320 + (sin(DegToRad(Step )) * 250);
|
SX = 320 + (sin(DegToRad(Step )) * 250);
|
||||||
SY = 240 + (cos(DegToRad(Step*3)) * 100);
|
SY = 240 + (cos(DegToRad(Step*3)) * 100);
|
||||||
|
|
||||||
// Draw Stage
|
// Draw Stage
|
||||||
GRRLIB_SetColorRGBA(RGBA(255, 255, 255, 255));
|
GRRLIB_SetColorRGBA(RGBA(255, 255, 255, 255));
|
||||||
GRRLIB_DrawImg( 0, 0, GFX_Background );
|
GRRLIB_DrawImg( 0, 0, GFX_Background );
|
||||||
GRRLIB_SetBlend( (Blending+1) ); Color = 255;
|
GRRLIB_SetBlend( (Blending+1) ); Color = 255;
|
||||||
switch (Stage) {
|
switch (Stage) {
|
||||||
case 2: Color = 160; break;
|
case 2: Color = 160; break;
|
||||||
case 3: Color = 128; break;
|
case 3: Color = 128; break;
|
||||||
case 4: Color = 64; break;
|
case 4: Color = 64; break;
|
||||||
}
|
}
|
||||||
GRRLIB_SetColorRGBA(RGBA(Color, Color, Color, 255));
|
GRRLIB_SetColorRGBA(RGBA(Color, Color, Color, 255));
|
||||||
GRRLIB_DrawImg( SX, SY, GFX_Blob[BlobType] );
|
GRRLIB_DrawImg( SX, SY, GFX_Blob[BlobType] );
|
||||||
|
|
||||||
// IR Pointer
|
// IR Pointer
|
||||||
if (P1Mote.state == 1) {
|
if (P1Mote.state == 1) {
|
||||||
GRRLIB_DrawImg( P1MX, P1MY, GFX_Blob[BlobType] );
|
GRRLIB_DrawImg( P1MX, P1MY, GFX_Blob[BlobType] );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw Text
|
// Draw Text
|
||||||
GRRLIB_SetBlend ( GRRLIB_BLEND_ALPHA );
|
GRRLIB_SetBlend ( GRRLIB_BLEND_ALPHA );
|
||||||
GRRLIB_SetColorRGBA( RGBA(0, 0, 0, 160) );
|
GRRLIB_SetColorRGBA( RGBA(0, 0, 0, 160) );
|
||||||
GRRLIB_Rectangle( 28, 28, 480 + 16, 76, 1 );
|
GRRLIB_Rectangle( 28, 28, 480 + 16, 76, 1 );
|
||||||
GRRLIB_SetColorRGBA(0xFFFFFFFF);
|
GRRLIB_SetColorRGBA(0xFFFFFFFF);
|
||||||
GRRLIB_Printf ( 32, 32, GFX_Font, "Point your WiiMote on the screen." );
|
GRRLIB_Printf ( 32, 32, GFX_Font, "Point your WiiMote on the screen." );
|
||||||
GRRLIB_Printf ( 32, 48, GFX_Font, "Press LEFT and RIGHT to switch through the different stages." );
|
GRRLIB_Printf ( 32, 48, GFX_Font, "Press LEFT and RIGHT to switch through the different stages." );
|
||||||
GRRLIB_Printf ( 32, 64, GFX_Font, "Press A to change the blob sprite." );
|
GRRLIB_Printf ( 32, 64, GFX_Font, "Press A to change the blob sprite." );
|
||||||
switch (Stage) {
|
switch (Stage) {
|
||||||
case 0: GRRLIB_Printf( 32, 88, GFX_Font, "Stage 1: Additive Blending" ); Blending = 0; break;
|
case 0: GRRLIB_Printf( 32, 88, GFX_Font, "Stage 1: Additive Blending" ); Blending = 0; break;
|
||||||
case 1: GRRLIB_Printf( 32, 88, GFX_Font, "Stage 2: Alpha Light Blending" ); Blending = 1; break;
|
case 1: GRRLIB_Printf( 32, 88, GFX_Font, "Stage 2: Alpha Light Blending" ); Blending = 1; break;
|
||||||
case 2: GRRLIB_Printf( 32, 88, GFX_Font, "Stage 3: Multiply Blending (75%)" ); Blending = 2; break;
|
case 2: GRRLIB_Printf( 32, 88, GFX_Font, "Stage 3: Multiply Blending (75%)" ); Blending = 2; break;
|
||||||
case 3: GRRLIB_Printf( 32, 88, GFX_Font, "Stage 4: Multiply Blending (50%)" ); Blending = 2; break;
|
case 3: GRRLIB_Printf( 32, 88, GFX_Font, "Stage 4: Multiply Blending (50%)" ); Blending = 2; break;
|
||||||
case 4: GRRLIB_Printf( 32, 88, GFX_Font, "Stage 5: Multiply Blending (25%)" ); Blending = 2; break;
|
case 4: GRRLIB_Printf( 32, 88, GFX_Font, "Stage 5: Multiply Blending (25%)" ); Blending = 2; break;
|
||||||
case 5: GRRLIB_Printf( 32, 88, GFX_Font, "Stage 6: Invert Color Blending" ); Blending = 3; break;
|
case 5: GRRLIB_Printf( 32, 88, GFX_Font, "Stage 6: Invert Color Blending" ); Blending = 3; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
GRRLIB_Render();
|
GRRLIB_Render();
|
||||||
if (WPADKeyDown & WPAD_BUTTON_RIGHT) { if (Stage < 5) { Stage += 1; } }
|
if (WPADKeyDown & WPAD_BUTTON_RIGHT) { if (Stage < 5) { Stage += 1; } }
|
||||||
|
@ -129,16 +129,16 @@ int main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ExitGame() {
|
static void ExitGame() {
|
||||||
// Deinitialize GRRLIB & Video
|
// Deinitialize GRRLIB & Video
|
||||||
GRRLIB_Exit();
|
GRRLIB_Exit();
|
||||||
|
|
||||||
// Free all memory used by textures.
|
// Free all memory used by textures.
|
||||||
GRRLIB_FreeTexture(GFX_Background);
|
GRRLIB_FreeTexture(GFX_Background);
|
||||||
GRRLIB_FreeTexture(GFX_Blob[0]);
|
GRRLIB_FreeTexture(GFX_Blob[0]);
|
||||||
GRRLIB_FreeTexture(GFX_Blob[1]);
|
GRRLIB_FreeTexture(GFX_Blob[1]);
|
||||||
GRRLIB_FreeTexture(GFX_Blob[2]);
|
GRRLIB_FreeTexture(GFX_Blob[2]);
|
||||||
GRRLIB_FreeTexture(GFX_Font);
|
GRRLIB_FreeTexture(GFX_Font);
|
||||||
|
|
||||||
// Exit application
|
// Exit application
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue