mirror of
https://github.com/GRRLIB/GRRLIB.git
synced 2024-11-22 06:52:20 +00:00
Clean some examples code
This commit is contained in:
parent
19b6f866e0
commit
0f8a1d0e1f
6 changed files with 32 additions and 22 deletions
|
@ -14,7 +14,6 @@
|
|||
#include "gfx/font.h"
|
||||
#include "gfx/girl.h"
|
||||
|
||||
extern GXRModeObj *rmode;
|
||||
|
||||
int main() {
|
||||
float a=0;
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
static void ExitGame();
|
||||
|
||||
// General Variables
|
||||
extern GXRModeObj *rmode;
|
||||
ir_t P1Mote;
|
||||
|
||||
// Prepare Graphics
|
||||
|
@ -34,21 +33,20 @@ GRRLIB_texImg *GFX_Font;
|
|||
int main() {
|
||||
// Init Variables
|
||||
u32 WPADKeyDown;
|
||||
short WinW, WinH;
|
||||
|
||||
u8 Stage = 0;
|
||||
u8 Blending = 0;
|
||||
u8 BlobType = 0;
|
||||
u8 Color = 255;
|
||||
u8 Color;
|
||||
u16 Step = 0;
|
||||
|
||||
|
||||
// Init GRRLIB & WiiUse
|
||||
GRRLIB_Init();
|
||||
WinW = rmode->fbWidth;
|
||||
WinH = rmode->efbHeight;
|
||||
u16 WinW = rmode->fbWidth;
|
||||
u16 WinH = rmode->efbHeight;
|
||||
WPAD_Init();
|
||||
WPAD_SetIdleTimeout( 60*10 );
|
||||
WPAD_SetIdleTimeout( 60 * 10 );
|
||||
WPAD_SetDataFormat( WPAD_CHAN_0, WPAD_FMT_BTNS_ACC_IR );
|
||||
|
||||
// Load Textures
|
||||
|
@ -77,17 +75,20 @@ int main() {
|
|||
|
||||
// Update Stage
|
||||
Step = Step + 1;
|
||||
if (Step == 720) { Step = 0; }
|
||||
if (Step == 720) {
|
||||
Step = 0;
|
||||
}
|
||||
float SX = 320 + (sin(DegToRad(Step )) * 250);
|
||||
float SY = 240 + (cos(DegToRad(Step*3)) * 100);
|
||||
|
||||
// Draw Stage
|
||||
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) {
|
||||
case 2: Color = 160; break;
|
||||
case 3: Color = 128; 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) );
|
||||
|
||||
|
@ -112,10 +113,25 @@ int main() {
|
|||
}
|
||||
|
||||
GRRLIB_Render();
|
||||
if (WPADKeyDown & WPAD_BUTTON_RIGHT) { if (Stage < 5) { Stage += 1; } }
|
||||
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 ) { ExitGame(); }
|
||||
if (WPADKeyDown & WPAD_BUTTON_RIGHT) {
|
||||
if (Stage < 5) {
|
||||
Stage += 1;
|
||||
}
|
||||
}
|
||||
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();
|
||||
return 0;
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#include <wiiuse/wpad.h>
|
||||
|
||||
#include "gfx/font3d.h"
|
||||
extern GXRModeObj *rmode;
|
||||
|
||||
|
||||
int main() {
|
||||
|
|
|
@ -67,10 +67,10 @@ int main() {
|
|||
|
||||
// Init GRRLIB & WiiUse
|
||||
GRRLIB_Init();
|
||||
short WinW = rmode->fbWidth;
|
||||
short WinH = rmode->efbHeight;
|
||||
u16 WinW = rmode->fbWidth;
|
||||
u16 WinH = rmode->efbHeight;
|
||||
WPAD_Init();
|
||||
WPAD_SetIdleTimeout( 60*10 );
|
||||
WPAD_SetIdleTimeout( 60 * 10 );
|
||||
WPAD_SetDataFormat( WPAD_CHAN_0, WPAD_FMT_BTNS_ACC_IR );
|
||||
|
||||
// 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 );
|
||||
}
|
||||
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 );
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "gfx/font.h"
|
||||
#include "gfx/ball.h"
|
||||
|
||||
extern GXRModeObj *rmode;
|
||||
|
||||
int main() {
|
||||
int i;
|
||||
|
|
|
@ -14,9 +14,6 @@
|
|||
#include "gfx/logo.h"
|
||||
#include "gfx/font.h"
|
||||
|
||||
extern GXRModeObj *rmode;
|
||||
|
||||
|
||||
|
||||
int main() {
|
||||
int i;
|
||||
|
|
Loading…
Reference in a new issue