-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathParticleSystem.h
More file actions
72 lines (61 loc) · 1.76 KB
/
ParticleSystem.h
File metadata and controls
72 lines (61 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#pragma once
#include "image.h"
enum SHAPE {
CIRCLE,
HALF
};
struct Particle {
float x, y;
int activeTime;
int duration;
float speedX, speedY;
float gravity;
float angle;
bool isEmission;
int curFrame;
int frameTick;
};
class ParticleSystem :
public Component
{
private:
int _x, _y;
bool _isStop;
image* _particleImage;
vector<Particle> _particle;
int _num;
int _emissionNum;
int _deltaTime;
int _interval;
int _minDuration, _maxDuration;
int _frameTerm;
bool _isLoop;
float _minSpeed, _maxSpeed;
float _minAngle, _maxAngle;
float _gravity;
void Emission(int idx);
void EmissionAll();
public:
ParticleSystem(image* particleImage, int num, int frameTerm);
~ParticleSystem();
virtual void Update();
virtual void Render();
void Play();
void Stop();
float GetX() { return _x; }
float GetY() { return _y; };
void SetAngle(float minAngle, float maxAngle) { _minAngle = minAngle, _maxAngle = maxAngle; }
void SetMinAngle(float minAngle) { _minAngle = minAngle; }
void SetMaxAngle(float maxAngle) { _maxAngle = maxAngle; }
float GetMinAngle() { return _minAngle; }
float GetMaxAngle() { return _maxAngle; }
void SetPosition(int x, int y) { _x = x; _y = y; }
void SetDuration(int duration) { _minDuration = duration; _maxDuration = duration; }
void SetDuration(int minDuration, int maxDuration) { _minDuration = minDuration; _maxDuration = maxDuration; }
void SetInterval(int interval) { _interval = interval; }
void SetSpeed(float speed) { _minSpeed = speed, _maxSpeed = speed; }
void SetSpeed(float minSpeed, float maxSpeed) { _minSpeed = minSpeed; _maxSpeed = maxSpeed; }
void SetLoop(bool isLoop) { _isLoop = isLoop; }
void SetGravity(float gravity) { _gravity = gravity; }
void SetParticleImage(image* newImage) { _particleImage = newImage; }
};