mirror of
https://github.com/GRRLIB/GRRLIB.git
synced 2024-11-22 15:02:20 +00:00
Use an enum in particle example instead of a macro
This commit is contained in:
parent
506df6ad66
commit
3ee20bffc2
5 changed files with 12 additions and 10 deletions
|
@ -20,8 +20,10 @@
|
||||||
#include "RGFX_Font_png.h"
|
#include "RGFX_Font_png.h"
|
||||||
|
|
||||||
|
|
||||||
// Define Effects
|
// Effects
|
||||||
#define EFFECT_SMOKEBOMB 1
|
enum class Effect : u8 {
|
||||||
|
SMOKEBOMB
|
||||||
|
};
|
||||||
|
|
||||||
// Random Number (0 - 1) in float
|
// Random Number (0 - 1) in float
|
||||||
#define RANDOM ((((float)(rand() % 12))/12)-0.5)
|
#define RANDOM ((((float)(rand() % 12))/12)-0.5)
|
||||||
|
@ -47,7 +49,7 @@ static std::vector<Particle *> ParticleListTmp;
|
||||||
|
|
||||||
// Declare static functions
|
// Declare static functions
|
||||||
static void ExitGame();
|
static void ExitGame();
|
||||||
static void createEffect( u8 id, int _x, int _y );
|
static void createEffect( Effect id, int _x, int _y );
|
||||||
static void createParticle( u8 _id, int _x, int _y, float _scale, float _alpha, u8 _red, u8 _green, u8 _blue );
|
static void createParticle( u8 _id, int _x, int _y, float _scale, float _alpha, u8 _red, u8 _green, u8 _blue );
|
||||||
static bool updateParticle( Particle *part );
|
static bool updateParticle( Particle *part );
|
||||||
static u8 CalculateFrameRate();
|
static u8 CalculateFrameRate();
|
||||||
|
@ -137,7 +139,7 @@ int main() {
|
||||||
FPS = CalculateFrameRate();
|
FPS = CalculateFrameRate();
|
||||||
|
|
||||||
if (WPADKeyDown & WPAD_BUTTON_B) {
|
if (WPADKeyDown & WPAD_BUTTON_B) {
|
||||||
createEffect( EFFECT_SMOKEBOMB, P1MX, P1MY );
|
createEffect( Effect::SMOKEBOMB, P1MX, P1MY );
|
||||||
}
|
}
|
||||||
if (WPADKeyDown & WPAD_BUTTON_HOME) {
|
if (WPADKeyDown & WPAD_BUTTON_HOME) {
|
||||||
break;
|
break;
|
||||||
|
@ -147,9 +149,9 @@ int main() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void createEffect( u8 id, int _x, int _y ) {
|
static void createEffect( Effect id, int _x, int _y ) {
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case EFFECT_SMOKEBOMB:
|
case Effect::SMOKEBOMB:
|
||||||
for (u8 i = 0; i < 5; i++) {
|
for (u8 i = 0; i < 5; i++) {
|
||||||
createParticle( 1, (_x + (RANDOM * 10)), (_y + (RANDOM * 10)), (1.4f+(RANDOM*0.20)), 1.0f, 64, 64, 64 );
|
createParticle( 1, (_x + (RANDOM * 10)), (_y + (RANDOM * 10)), (1.4f+(RANDOM*0.20)), 1.0f, 64, 64, 64 );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue