Clean some examples code

This commit is contained in:
Crayon2000 2020-01-12 01:49:01 -05:00
parent 19b6f866e0
commit 0f8a1d0e1f
6 changed files with 32 additions and 22 deletions

View file

@ -14,7 +14,6 @@
#include "gfx/font.h" #include "gfx/font.h"
#include "gfx/girl.h" #include "gfx/girl.h"
extern GXRModeObj *rmode;
int main() { int main() {
float a=0; float a=0;

View file

@ -22,7 +22,6 @@
static void ExitGame(); static void ExitGame();
// General Variables // General Variables
extern GXRModeObj *rmode;
ir_t P1Mote; ir_t P1Mote;
// Prepare Graphics // Prepare Graphics
@ -34,21 +33,20 @@ GRRLIB_texImg *GFX_Font;
int main() { int main() {
// Init Variables // Init Variables
u32 WPADKeyDown; u32 WPADKeyDown;
short WinW, WinH;
u8 Stage = 0; u8 Stage = 0;
u8 Blending = 0; u8 Blending = 0;
u8 BlobType = 0; u8 BlobType = 0;
u8 Color = 255; u8 Color;
u16 Step = 0; u16 Step = 0;
// Init GRRLIB & WiiUse // Init GRRLIB & WiiUse
GRRLIB_Init(); GRRLIB_Init();
WinW = rmode->fbWidth; u16 WinW = rmode->fbWidth;
WinH = rmode->efbHeight; u16 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
@ -77,17 +75,20 @@ int main() {
// Update Stage // Update Stage
Step = Step + 1; Step = Step + 1;
if (Step == 720) { Step = 0; } if (Step == 720) {
Step = 0;
}
float SX = 320 + (sin(DegToRad(Step )) * 250); float SX = 320 + (sin(DegToRad(Step )) * 250);
float SY = 240 + (cos(DegToRad(Step*3)) * 100); float SY = 240 + (cos(DegToRad(Step*3)) * 100);
// Draw Stage // Draw Stage
GRRLIB_DrawImg( 0, 0, GFX_Background, 0, 1, 1, RGBA(255, 255, 255, 255) ); GRRLIB_DrawImg( 0, 0, GFX_Background, 0, 1, 1, RGBA(255, 255, 255, 255) );
GRRLIB_SetBlend( (Blending+1) ); Color = 255; GRRLIB_SetBlend( (Blending + 1) );
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;
default: Color = 255; break;
} }
GRRLIB_DrawImg( SX, SY, GFX_Blob[BlobType], 0, 1, 1, RGBA(Color, Color, Color, 255) ); GRRLIB_DrawImg( SX, SY, GFX_Blob[BlobType], 0, 1, 1, RGBA(Color, Color, Color, 255) );
@ -112,10 +113,25 @@ int main() {
} }
GRRLIB_Render(); GRRLIB_Render();
if (WPADKeyDown & WPAD_BUTTON_RIGHT) { if (Stage < 5) { Stage += 1; } } if (WPADKeyDown & WPAD_BUTTON_RIGHT) {
if (WPADKeyDown & WPAD_BUTTON_LEFT ) { if (Stage > 0) { Stage -= 1; } } if (Stage < 5) {
if (WPADKeyDown & WPAD_BUTTON_A ) { BlobType += 1; if (BlobType > 2) { BlobType = 0; } } Stage += 1;
if (WPADKeyDown & WPAD_BUTTON_HOME ) { ExitGame(); } }
}
if (WPADKeyDown & WPAD_BUTTON_LEFT) {
if (Stage > 0) {
Stage -= 1;
}
}
if (WPADKeyDown & WPAD_BUTTON_A) {
BlobType += 1;
if (BlobType > 2) {
BlobType = 0;
}
}
if (WPADKeyDown & WPAD_BUTTON_HOME) {
break;
}
} }
ExitGame(); ExitGame();
return 0; return 0;

View file

@ -7,7 +7,6 @@
#include <wiiuse/wpad.h> #include <wiiuse/wpad.h>
#include "gfx/font3d.h" #include "gfx/font3d.h"
extern GXRModeObj *rmode;
int main() { int main() {

View file

@ -67,10 +67,10 @@ int main() {
// Init GRRLIB & WiiUse // Init GRRLIB & WiiUse
GRRLIB_Init(); GRRLIB_Init();
short WinW = rmode->fbWidth; u16 WinW = rmode->fbWidth;
short WinH = rmode->efbHeight; u16 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
@ -160,7 +160,7 @@ static void createEffect( u8 id, int _x, int _y ) {
createParticle( 3, (_x + (RANDOM * 50)), (_y + (RANDOM * 50)), 1.25f, 1.5f, 92, 92, 92 ); createParticle( 3, (_x + (RANDOM * 50)), (_y + (RANDOM * 50)), 1.25f, 1.5f, 92, 92, 92 );
} }
for (u8 i = 0; i < 5; i++) { for (u8 i = 0; i < 5; i++) {
_ColorAdd = (RANDOM*75); _ColorAdd = (RANDOM * 75);
createParticle( 2, (_x + (RANDOM * 40)), (_y + (RANDOM * 40)), (1.0f+(RANDOM*0.20)), 1.0f, 128+_ColorAdd, 128+_ColorAdd, 128+_ColorAdd ); createParticle( 2, (_x + (RANDOM * 40)), (_y + (RANDOM * 40)), (1.0f+(RANDOM*0.20)), 1.0f, 128+_ColorAdd, 128+_ColorAdd, 128+_ColorAdd );
} }
break; break;

View file

@ -14,7 +14,6 @@
#include "gfx/font.h" #include "gfx/font.h"
#include "gfx/ball.h" #include "gfx/ball.h"
extern GXRModeObj *rmode;
int main() { int main() {
int i; int i;

View file

@ -14,9 +14,6 @@
#include "gfx/logo.h" #include "gfx/logo.h"
#include "gfx/font.h" #include "gfx/font.h"
extern GXRModeObj *rmode;
int main() { int main() {
int i; int i;