mirror of
https://github.com/GRRLIB/GRRLIB.git
synced 2024-11-21 22:42: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
|
@ -240,7 +240,7 @@ int main() {
|
|||
bgy++;
|
||||
else if(diry<0)
|
||||
bgy--;
|
||||
if((bgy>-1) ||(bgy<-63))
|
||||
if((bgy>-1) || (bgy<-63))
|
||||
bgy=-32;
|
||||
|
||||
if(cpty==32) {
|
||||
|
|
|
@ -208,7 +208,7 @@ int main() {
|
|||
bgx++;
|
||||
else if(dirx<0)
|
||||
bgx--;
|
||||
if((bgx>-1) ||(bgx<-63))
|
||||
if((bgx>-1) || (bgx<-63))
|
||||
bgx=-32;
|
||||
|
||||
if(cptx==32) {
|
||||
|
|
|
@ -240,7 +240,7 @@ int main() {
|
|||
bgy++;
|
||||
else if(diry<0)
|
||||
bgy--;
|
||||
if((bgy>-1) ||(bgy<-63))
|
||||
if((bgy>-1) || (bgy<-63))
|
||||
bgy=-32;
|
||||
|
||||
if(cpty==32) {
|
||||
|
|
|
@ -208,7 +208,7 @@ int main() {
|
|||
bgx++;
|
||||
else if(dirx<0)
|
||||
bgx--;
|
||||
if((bgx>-1) ||(bgx<-63))
|
||||
if((bgx>-1) || (bgx<-63))
|
||||
bgx=-32;
|
||||
|
||||
if(cptx==32) {
|
||||
|
|
|
@ -20,8 +20,10 @@
|
|||
#include "RGFX_Font_png.h"
|
||||
|
||||
|
||||
// Define Effects
|
||||
#define EFFECT_SMOKEBOMB 1
|
||||
// Effects
|
||||
enum class Effect : u8 {
|
||||
SMOKEBOMB
|
||||
};
|
||||
|
||||
// Random Number (0 - 1) in float
|
||||
#define RANDOM ((((float)(rand() % 12))/12)-0.5)
|
||||
|
@ -47,7 +49,7 @@ static std::vector<Particle *> ParticleListTmp;
|
|||
|
||||
// Declare static functions
|
||||
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 bool updateParticle( Particle *part );
|
||||
static u8 CalculateFrameRate();
|
||||
|
@ -137,7 +139,7 @@ int main() {
|
|||
FPS = CalculateFrameRate();
|
||||
|
||||
if (WPADKeyDown & WPAD_BUTTON_B) {
|
||||
createEffect( EFFECT_SMOKEBOMB, P1MX, P1MY );
|
||||
createEffect( Effect::SMOKEBOMB, P1MX, P1MY );
|
||||
}
|
||||
if (WPADKeyDown & WPAD_BUTTON_HOME) {
|
||||
break;
|
||||
|
@ -147,9 +149,9 @@ int main() {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void createEffect( u8 id, int _x, int _y ) {
|
||||
static void createEffect( Effect id, int _x, int _y ) {
|
||||
switch (id) {
|
||||
case EFFECT_SMOKEBOMB:
|
||||
case Effect::SMOKEBOMB:
|
||||
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 );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue