Sky Zone Omega - PC Version
 All Classes Namespaces Files Functions Variables Macros
PS_ParticleEffect.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <SDL.h>
4 #include <vector>
5 #include <time.h>
6 #include <string>
7 #include "PS_Particle.h"
8 #include "../Core/C_Vec2.h"
9 #include "../Core/C_Utilities.h"
10 #include "../Core/C_Timer.h"
11 
13 #define MAX_NUMBER_OF_PARTICLES 100
14 
20 {
21 public:
31 
41  PS_ParticleEffect(C_Texture* texture, C_Vec2 emitter, bool emit, float moveSpeed, float scale, float timerLength);
42 
53  PS_ParticleEffect(C_Texture* texture, C_Vec2 emitter, bool emit, float moveSpeed, float scale,
54  SDL_Colour minTint, SDL_Colour maxTint);
55 
67  PS_ParticleEffect(C_Texture* texture, C_Vec2 emitter, bool emit, float moveSpeed, float scale, float timerLength,
68  SDL_Colour minTint, SDL_Colour maxTint);
69 
74 
79  void update(float dt);
80 
85  void draw(SDL_Renderer* renderer);
86 
91  void setEmitter(C_Vec2 emitter);
92 
97  void setEmitting(bool emit);
98 
103  void setMoveSpeed(float moveSpeed);
104 
109  void setParticleScale(float scale);
110 
115  C_Timer* getLifeSpan();
116 
121  void setDead(bool dead);
122 
127  bool getDead();
128 
129 private:
131  std::vector<PS_Particle*> particles;
135  float moveSpeed;
139  bool emit;
141  float scale;
145  bool dead;
147  bool tint;
149  SDL_Colour maxTint;
151  SDL_Colour minTint;
152 
156  void makeNewParticles();
157 };
void setEmitting(bool emit)
Set the value of the emit boolean.
Definition: PS_ParticleEffect.cpp:113
~PS_ParticleEffect()
Destructs the ParticleEffect Object deleting the Particle Object from memory.
Definition: PS_ParticleEffect.cpp:49
bool getDead()
Get the value of dead.
Definition: PS_ParticleEffect.cpp:138
void setMoveSpeed(float moveSpeed)
Set the value of the movement speed.
Definition: PS_ParticleEffect.cpp:118
Handles Particle objects and Particle Effect functions.
Definition: PS_ParticleEffect.h:19
C_Timer * getLifeSpan()
Get the timer for the lifespan of the effect.
Definition: PS_ParticleEffect.cpp:128
float scale
The scale of the particles.
Definition: PS_ParticleEffect.h:141
void draw(SDL_Renderer *renderer)
Draws the ParticleEffect.
Definition: PS_ParticleEffect.cpp:99
void update(float dt)
A function that updates the ParticleEffect.
Definition: PS_ParticleEffect.cpp:59
void setDead(bool dead)
Set the value of dead.
Definition: PS_ParticleEffect.cpp:133
C_Texture * texture
A pointer to the Texture of the particles.
Definition: PS_ParticleEffect.h:133
Contains the Vec2 structure with functions and overloaded operators.
Definition: C_Vec2.h:7
PS_ParticleEffect(C_Texture *texture, C_Vec2 emitter, bool emit, float moveSpeed, float scale)
Constructs the ParticleEffect Object.
Definition: PS_ParticleEffect.cpp:3
bool tint
A boolean for if the texture will be tinted.
Definition: PS_ParticleEffect.h:147
SDL_Colour maxTint
The max colour tint.
Definition: PS_ParticleEffect.h:149
void setParticleScale(float scale)
Set the scale of the particles.
Definition: PS_ParticleEffect.cpp:123
bool dead
A boolean for if the particle effect should be deleted.
Definition: PS_ParticleEffect.h:145
std::vector< PS_Particle * > particles
A vector of Particle objects.
Definition: PS_ParticleEffect.h:131
Handles timer functions.
Definition: C_Timer.h:7
SDL_Colour minTint
The min colour tint.
Definition: PS_ParticleEffect.h:151
C_Timer * lifeSpan
A timer for the lifespan of the particle effect.
Definition: PS_ParticleEffect.h:143
void makeNewParticles()
Creates the new Particle objects.
Definition: PS_ParticleEffect.cpp:143
bool emit
A boolean for if the ParticleEffect should emit.
Definition: PS_ParticleEffect.h:139
C_Vec2 emitter
The position of the Particle emitter.
Definition: PS_ParticleEffect.h:137
void setEmitter(C_Vec2 emitter)
Set the position of the emitter.
Definition: PS_ParticleEffect.cpp:108
Creates a Texture for use with a renderer.
Definition: C_Texture.h:13
float moveSpeed
The move speed of the particles.
Definition: PS_ParticleEffect.h:135