[CHG] All examples have been updated (except nonameno03)

This commit is contained in:
Crayon2000 2009-11-25 19:38:04 +00:00
parent fc3c97d90d
commit 57524607cf
6 changed files with 109 additions and 77 deletions

View file

@ -84,20 +84,22 @@ void test_compose(void)
GRRLIB_FillScreen(0x000000FF);
// Draw frame
GRRLIB_Rectangle(38,38,404,404,0x808080FF,false);
GRRLIB_Rectangle(39,39,402,402,0x808080FF,false);
GRRLIB_SetColorRGBA(0x808080FF);
GRRLIB_Rectangle(38,38,404,404,false);
GRRLIB_Rectangle(39,39,402,402,false);
// Draw Test bar
GRRLIB_Rectangle(283,50,20,380,0xFFFFFFFF, true);
GRRLIB_SetColorRGBA(0xFFFFFFFF);
GRRLIB_Rectangle(283,50,20,380, true);
// Draw Composed Canvas
GRRLIB_DrawImg(40,40, cnv,0.0, 1.0,1.0, 0xFFFFFFFF);
GRRLIB_DrawImg(40,40, cnv);
// Test card (alpha performed by Wii)
GRRLIB_Rectangle(570,50,20,450,0xFFFFFFFF, true);
GRRLIB_DrawImg(450, 65, red,0.0, 1.0,1.0, 0xFFFFFFFF);
GRRLIB_DrawImg(450,165, blu,0.0, 1.0,1.0, 0xFFFFFFFF);
GRRLIB_DrawImg(450,265, red,0.0, 1.0,1.0, 0xFFFFFFFF);
GRRLIB_Rectangle(570,50,20,450, true);
GRRLIB_DrawImg(450, 65, red);
GRRLIB_DrawImg(450,165, blu);
GRRLIB_DrawImg(450,265, red);
// Draw it [and workaround bug in GRRLIB]
GRRLIB_Render();

View file

@ -122,71 +122,86 @@ int main() {
switch(page)
{
case 1:
GRRLIB_Printf(10, 10, text_font1, 0X000000FF, 1, "GRAYSCALE FX");
GRRLIB_SetColorRGBA(0X000000FF);
GRRLIB_Printf(10, 10, text_font1, "GRAYSCALE FX");
GRRLIB_DrawImg(10, 60, tex_pirate, 0, 1, 1, 0xFFFFFFFF);
GRRLIB_DrawImg(10+tex_pirate->w*1, 60, tex_gray, 0, 1, 1, 0xFFFFFFFF);
GRRLIB_SetColorRGBA(0xFFFFFFFF);
GRRLIB_DrawImg(10, 60, tex_pirate);
GRRLIB_DrawImg(10+tex_pirate->w*1, 60, tex_gray);
break;
case 2:
GRRLIB_Printf(10, 10, text_font1, 0X000000FF, 1, "SEPIA FX");
GRRLIB_SetColorRGBA(0X000000FF);
GRRLIB_Printf(10, 10, text_font1, "SEPIA FX");
GRRLIB_DrawImg(10, 60, tex_pirate, 0, 1, 1, 0xFFFFFFFF);
GRRLIB_DrawImg(10+tex_pirate->w*1, 60, tex_sepia, 0, 1, 1, 0xFFFFFFFF);
GRRLIB_SetColorRGBA(0xFFFFFFFF);
GRRLIB_DrawImg(10, 60, tex_pirate);
GRRLIB_DrawImg(10+tex_pirate->w*1, 60, tex_sepia);
break;
case 3:
GRRLIB_Printf(10, 10, text_font1, 0X000000FF, 1, "INVERT FX");
GRRLIB_SetColorRGBA(0X000000FF);
GRRLIB_Printf(10, 10, text_font1, "INVERT FX");
GRRLIB_DrawImg(10, 60, tex_pirate, 0, 1, 1, 0xFFFFFFFF);
GRRLIB_DrawImg(10+tex_pirate->w*1, 60, tex_invert, 0, 1, 1, 0xFFFFFFFF);
GRRLIB_SetColorRGBA(0xFFFFFFFF);
GRRLIB_DrawImg(10, 60, tex_pirate);
GRRLIB_DrawImg(10+tex_pirate->w*1, 60, tex_invert);
break;
case 4:
GRRLIB_Printf(10, 10, text_font1, 0X000000FF, 1, "FLIPH AND FLIPV FX");
GRRLIB_SetColorRGBA(0X000000FF);
GRRLIB_Printf(10, 10, text_font1, "FLIPH AND FLIPV FX");
GRRLIB_DrawImg(10, 60, tex_pirate, 0, 1, 1, 0xFFFFFFFF);
GRRLIB_DrawImg(10+tex_pirate->w*1, 60, tex_fliph, 0, 1, 1, 0xFFFFFFFF);
GRRLIB_DrawImg(10+tex_pirate->w*2, 60, tex_flipv, 0, 1, 1, 0xFFFFFFFF);
GRRLIB_DrawImg(10+tex_pirate->w*3, 60, tex_fliphv, 0, 1, 1, 0xFFFFFFFF);
GRRLIB_SetColorRGBA(0xFFFFFFFF);
GRRLIB_DrawImg(10, 60, tex_pirate);
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*3, 60, tex_fliphv);
break;
case 5:
GRRLIB_Printf(10, 10, text_font1, 0X000000FF, 1, "BLUR FX");
GRRLIB_SetColorRGBA(0X000000FF);
GRRLIB_Printf(10, 10, text_font1, "BLUR FX");
GRRLIB_DrawImg(10, 60, tex_pirate, 0, 1, 1, 0xFFFFFFFF);
GRRLIB_DrawImg(10+tex_pirate->w*1, 60, tex_blur1, 0, 1, 1, 0xFFFFFFFF);
GRRLIB_DrawImg(10+tex_pirate->w*2, 60, tex_blur2, 0, 1, 1, 0xFFFFFFFF);
GRRLIB_DrawImg(10+tex_pirate->w*3, 60, tex_blur3, 0, 1, 1, 0xFFFFFFFF);
GRRLIB_DrawImg(10, 60+tex_pirate->h*1, tex_blur4, 0, 1, 1, 0xFFFFFFFF);
GRRLIB_DrawImg(10+tex_pirate->w*1, 60+tex_pirate->h*1, tex_blur5, 0, 1, 1, 0xFFFFFFFF);
GRRLIB_DrawImg(10+tex_pirate->w*2, 60+tex_pirate->h*1, tex_blur6, 0, 1, 1, 0xFFFFFFFF);
GRRLIB_SetColorRGBA(0xFFFFFFFF);
GRRLIB_DrawImg(10, 60, tex_pirate);
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*3, 60, tex_blur3);
GRRLIB_DrawImg(10, 60+tex_pirate->h*1, tex_blur4);
GRRLIB_DrawImg(10+tex_pirate->w*1, 60+tex_pirate->h*1, tex_blur5);
GRRLIB_DrawImg(10+tex_pirate->w*2, 60+tex_pirate->h*1, tex_blur6);
break;
case 6:
GRRLIB_Printf(10, 10, text_font1, 0X000000FF, 1, "PIXELATE FX");
GRRLIB_SetColorRGBA(0X000000FF);
GRRLIB_Printf(10, 10, text_font1, "PIXELATE FX");
GRRLIB_DrawImg(10, 60, tex_pirate, 0, 1, 1, 0xFFFFFFFF);
GRRLIB_DrawImg(10+tex_pirate->w*1, 60, tex_pixel1, 0, 1, 1, 0xFFFFFFFF);
GRRLIB_DrawImg(10+tex_pirate->w*2, 60, tex_pixel2, 0, 1, 1, 0xFFFFFFFF);
GRRLIB_DrawImg(10+tex_pirate->w*3, 60, tex_pixel3, 0, 1, 1, 0xFFFFFFFF);
GRRLIB_DrawImg(10, 60+tex_pirate->h*1, tex_pixel4, 0, 1, 1, 0xFFFFFFFF);
GRRLIB_DrawImg(10+tex_pirate->w*1, 60+tex_pirate->h*1, tex_pixel5, 0, 1, 1, 0xFFFFFFFF);
GRRLIB_DrawImg(10+tex_pirate->w*2, 60+tex_pirate->h*1, tex_pixel6, 0, 1, 1, 0xFFFFFFFF);
GRRLIB_SetColorRGBA(0xFFFFFFFF);
GRRLIB_DrawImg(10, 60, tex_pirate);
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*3, 60, tex_pixel3);
GRRLIB_DrawImg(10, 60+tex_pirate->h*1, tex_pixel4);
GRRLIB_DrawImg(10+tex_pirate->w*1, 60+tex_pirate->h*1, tex_pixel5);
GRRLIB_DrawImg(10+tex_pirate->w*2, 60+tex_pirate->h*1, tex_pixel6);
break;
case 7:
GRRLIB_Printf(10, 10, text_font1, 0X000000FF, 1, "SCATTER FX");
GRRLIB_SetColorRGBA(0X000000FF);
GRRLIB_Printf(10, 10, text_font1, "SCATTER FX");
GRRLIB_DrawImg(10, 60, tex_pirate, 0, 1, 1, 0xFFFFFFFF);
GRRLIB_DrawImg(10+tex_pirate->w*1, 60, tex_scatter1, 0, 1, 1, 0xFFFFFFFF);
GRRLIB_DrawImg(10+tex_pirate->w*2, 60, tex_scatter2, 0, 1, 1, 0xFFFFFFFF);
GRRLIB_DrawImg(10+tex_pirate->w*3, 60, tex_scatter3, 0, 1, 1, 0xFFFFFFFF);
GRRLIB_DrawImg(10, 60+tex_pirate->h*1, tex_scatter4, 0, 1, 1, 0xFFFFFFFF);
GRRLIB_DrawImg(10+tex_pirate->w*1, 60+tex_pirate->h*1, tex_scatter5, 0, 1, 1, 0xFFFFFFFF);
GRRLIB_DrawImg(10+tex_pirate->w*2, 60+tex_pirate->h*1, tex_scatter6, 0, 1, 1, 0xFFFFFFFF);
GRRLIB_SetColorRGBA(0xFFFFFFFF);
GRRLIB_DrawImg(10, 60, tex_pirate);
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*3, 60, tex_scatter3);
GRRLIB_DrawImg(10, 60+tex_pirate->h*1, tex_scatter4);
GRRLIB_DrawImg(10+tex_pirate->w*1, 60+tex_pirate->h*1, tex_scatter5);
GRRLIB_DrawImg(10+tex_pirate->w*2, 60+tex_pirate->h*1, tex_scatter6);
break;
default:
GRRLIB_Printf(10, 10, text_font1, 0X000000FF, 1, "WELCOME TO THE");
GRRLIB_Printf(10, 40, text_font1, 0X000000FF, 1, "GRRLIB FX DEMO.");
GRRLIB_Printf(10, 80, text_font1, 0X000000FF, 1, "TO QUIT PRESS THE");
GRRLIB_Printf(10, 120, text_font1, 0X000000FF, 1, "HOME BUTTON.");
GRRLIB_Printf(10, 160, text_font1, 0X000000FF, 1, "USE + OR - TO MOVE");
GRRLIB_Printf(10, 200, text_font1, 0X000000FF, 1, "ACROSS PAGES.");
GRRLIB_SetColorRGBA(0X000000FF);
GRRLIB_Printf(10, 10, text_font1, "WELCOME TO THE");
GRRLIB_Printf(10, 40, text_font1, "GRRLIB FX DEMO.");
GRRLIB_Printf(10, 80, text_font1, "TO QUIT PRESS THE");
GRRLIB_Printf(10, 120, text_font1, "HOME BUTTON.");
GRRLIB_Printf(10, 160, text_font1, "USE + OR - TO MOVE");
GRRLIB_Printf(10, 200, text_font1, "ACROSS PAGES.");
}
GRRLIB_Render();

View file

@ -47,7 +47,7 @@ int main() {
}
GRRLIB_FillScreen(0xFFFFFFFF);
GRRLIB_DrawImgQuad(d, tex_pirate, 0xFFFFFFFF);
GRRLIB_DrawImgQuad(d, tex_pirate);
GRRLIB_Render();

View file

@ -36,8 +36,8 @@ int main() {
WPADDown = WPAD_ButtonsDown(0);
for(i=0; i<10; i++) {
GRRLIB_DrawImg(0, 0, tex_screen[i], 0, 1, 1, 0xFFFFFFFF);
GRRLIB_DrawImg(((640-64)/2)+sin(sinx[0])*160+sin(sinx[1])*sin(sinx[2])*50,((480-64)/2)+sin(siny[0])*120+sin(siny[1])*sin(siny[2])*50, tex_ball, 0, 1, 1, 0xFFFFFFFF);
GRRLIB_DrawImg(0, 0, tex_screen[i]);
GRRLIB_DrawImg(((640-64)/2)+sin(sinx[0])*160+sin(sinx[1])*sin(sinx[2])*50,((480-64)/2)+sin(siny[0])*120+sin(siny[1])*sin(siny[2])*50, tex_ball);
sinx[0]+=0.02;sinx[1]+=0.03;sinx[2]+=0.05;siny[0]+=0.03;siny[1]+=0.01;siny[2]+=0.06;
GRRLIB_Screen2Texture(0, 0, tex_screen[i], false);
GRRLIB_Render();

View file

@ -85,33 +85,37 @@ int main() {
SY = 240 + (cos(DegToRad(Step*3)) * 100);
// Draw Stage
GRRLIB_DrawImg( 0, 0, GFX_Background, 0, 1, 1, GRRLIB_GetColor(255, 255, 255, 255) );
GRRLIB_SetColorRGBA(RGBA(255, 255, 255, 255));
GRRLIB_DrawImg( 0, 0, GFX_Background );
GRRLIB_SetBlend( (Blending+1) ); Color = 255;
switch (Stage) {
case 2: Color = 160; break;
case 3: Color = 128; break;
case 4: Color = 64; break;
}
GRRLIB_DrawImg( SX, SY, GFX_Blob[BlobType], 0, 1, 1, GRRLIB_GetColor(Color, Color, Color, 255) );
GRRLIB_SetColorRGBA(RGBA(Color, Color, Color, 255));
GRRLIB_DrawImg( SX, SY, GFX_Blob[BlobType] );
// IR Pointer
if (P1Mote.state == 1) {
GRRLIB_DrawImg( P1MX, P1MY, GFX_Blob[BlobType], 0, 1, 1, GRRLIB_GetColor(Color, Color, Color, 255) );
GRRLIB_DrawImg( P1MX, P1MY, GFX_Blob[BlobType] );
}
// Draw Text
GRRLIB_SetBlend ( GRRLIB_BLEND_ALPHA );
GRRLIB_Rectangle( 28, 28, 480 + 16, 76, GRRLIB_GetColor(0, 0, 0, 160), 1 );
GRRLIB_Printf ( 32, 32, GFX_Font, 0xFFFFFFFF, 1, "Point your WiiMote on the screen." );
GRRLIB_Printf ( 32, 48, GFX_Font, 0xFFFFFFFF, 1, "Press LEFT and RIGHT to switch through the different stages." );
GRRLIB_Printf ( 32, 64, GFX_Font, 0xFFFFFFFF, 1, "Press A to change the blob sprite." );
GRRLIB_SetColorRGBA( RGBA(0, 0, 0, 160) );
GRRLIB_Rectangle( 28, 28, 480 + 16, 76, 1 );
GRRLIB_SetColorRGBA(0xFFFFFFFF);
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, 64, GFX_Font, "Press A to change the blob sprite." );
switch (Stage) {
case 0: GRRLIB_Printf( 32, 88, GFX_Font, 0xFFFFFFFF, 1, "Stage 1: Additive Blending" ); Blending = 0; break;
case 1: GRRLIB_Printf( 32, 88, GFX_Font, 0xFFFFFFFF, 1, "Stage 2: Alpha Light Blending" ); Blending = 1; break;
case 2: GRRLIB_Printf( 32, 88, GFX_Font, 0xFFFFFFFF, 1, "Stage 3: Multiply Blending (75%)" ); Blending = 2; break;
case 3: GRRLIB_Printf( 32, 88, GFX_Font, 0xFFFFFFFF, 1, "Stage 4: Multiply Blending (50%)" ); Blending = 2; break;
case 4: GRRLIB_Printf( 32, 88, GFX_Font, 0xFFFFFFFF, 1, "Stage 5: Multiply Blending (25%)" ); Blending = 2; break;
case 5: GRRLIB_Printf( 32, 88, GFX_Font, 0xFFFFFFFF, 1, "Stage 6: Invert Color Blending" ); Blending = 3; 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 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 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;
}
GRRLIB_Render();

View file

@ -118,7 +118,8 @@ int main() {
P1MY = P1Mote.sy - 150;
// Drawing Background
GRRLIB_DrawImg( 0, 0, GFX_Background, 0, 1, 1, GRRLIB_GetColor(255, 255, 255, 255) );
GRRLIB_SetColorRGBA( RGBA(255, 255, 255, 255) );
GRRLIB_DrawImg( 0, 0, GFX_Background );
// Add any pending objects into the main container
if (ParticleListTmp.size()) {
@ -131,7 +132,10 @@ int main() {
// Update and draw all particles
for (vector<Particle *>::iterator PartIter = ParticleList.begin(); PartIter != ParticleList.end();) {
if (updateParticle((*PartIter)) == true) {
GRRLIB_DrawImg( (*PartIter)->x, (*PartIter)->y, (*PartIter)->tex, (*PartIter)->rot, (*PartIter)->scale, (*PartIter)->scale, GRRLIB_GetColor( (*PartIter)->red, (*PartIter)->green, (*PartIter)->blue, GRRLIB_ClampVar8((*PartIter)->alpha*255) ) );
GRRLIB_SetColorRGBA( RGBA( (*PartIter)->red, (*PartIter)->green, (*PartIter)->blue, GRRLIB_ClampVar8((*PartIter)->alpha*255) ) );
GRRLIB_SetScale ( (*PartIter)->scale, (*PartIter)->scale );
GRRLIB_SetRotation ( (*PartIter)->rot );
GRRLIB_DrawImg( (*PartIter)->x, (*PartIter)->y, (*PartIter)->tex );
} else {
free( (*PartIter) );
ParticleList.erase(PartIter);
@ -142,15 +146,22 @@ int main() {
}
// Draw Crosshair
GRRLIB_DrawImg( P1MX, P1MY, GFX_Crosshair, 0, 1, 1, GRRLIB_GetColor(255, 255, 255, 255) );
GRRLIB_ResetSettings();
GRRLIB_DrawImg( P1MX, P1MY, GFX_Crosshair );
// Draw Text
GRRLIB_Rectangle( 28, 28, 280, 20, GRRLIB_GetColor(0, 0, 0, 160), 1 );
GRRLIB_Printf ( 32, 32, GFX_Font, 0xFFFFFFFF, 1, "Point your WiiMote on the screen." );
GRRLIB_Rectangle( 28, 48, 200, 16, GRRLIB_GetColor(0, 0, 0, 160), 1 );
GRRLIB_Printf ( 32, 48, GFX_Font, 0xFFFFFFFF, 1, "Number of Particle: %d", ParticleCnt );
GRRLIB_Rectangle( 28, 64, 64, 16, GRRLIB_GetColor(0, 0, 0, 160), 1 );
GRRLIB_Printf ( 32, 64, GFX_Font, 0xFFFFFFFF, 1, "FPS: %d", FPS );
GRRLIB_SetColorRGBA( RGBA(0, 0, 0, 160) );
GRRLIB_Rectangle( 28, 28, 280, 20, 1 );
GRRLIB_SetColorRGBA( 0xFFFFFFFF );
GRRLIB_Printf ( 32, 32, GFX_Font, "Point your WiiMote on the screen." );
GRRLIB_SetColorRGBA( RGBA(0, 0, 0, 160) );
GRRLIB_Rectangle( 28, 48, 200, 16, 1 );
GRRLIB_SetColorRGBA( 0xFFFFFFFF );
GRRLIB_Printf ( 32, 48, GFX_Font, "Number of Particle: %d", ParticleCnt );
GRRLIB_SetColorRGBA( RGBA(0, 0, 0, 160) );
GRRLIB_Rectangle( 28, 64, 64, 16, 1 );
GRRLIB_SetColorRGBA( 0xFFFFFFFF );
GRRLIB_Printf ( 32, 64, GFX_Font, "FPS: %d", FPS );
// Renders the Scene
GRRLIB_Render();