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,19 +33,18 @@ 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 );
@ -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,8 +67,8 @@ 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 );

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;