00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00020
00021
00022
00024
00025
00027
00028 #ifndef EMITER_H
00029 #define EMITER_H
00030
00031 #include "Globals.hpp"
00032 #include "Particle.hpp"
00033
00034 #include <vector>
00035 #include <string>
00036
00037
00039
00043 class CEmiter
00044 {
00045 public:
00047 CEmiter();
00048 ~CEmiter();
00049
00051 void Init(const std::string& TexName, float FrameWidth = -1, float FrameHeight = -1, int FrameCount = 1);
00052
00053
00055 void InitFromFile(const std::string& FileName);
00056
00058 void Activate(bool Activate = true) { m_Active = Activate; }
00059
00061 bool IsActivate() const { return m_Active; }
00062
00063
00065 void SetPosition(float X, float Y)
00066 {
00067 m_X = X;
00068 m_Y = Y;
00069 }
00070
00072 float GetXPosition() const { return m_X; }
00073
00075 float GetYPosition() const { return m_Y; }
00076
00078 void SetSize(float X, float Y)
00079 {
00080 m_HalfXSize = X / 2;
00081 m_HalfYSize = Y / 2;
00082 }
00083
00085 float GetXSize() const { return 2.0f*m_HalfXSize; }
00086
00088 float GetYSize() const { return 2.0f*m_HalfYSize; }
00089
00091 void Update();
00092
00094 void Draw();
00095
00097 int GetParticleCount() const { return m_Particels.size(); }
00098
00100 void SetSpawnDelay(int SpawnDelay) { m_SpawnDelay = SpawnDelay; }
00101
00103 int GetSpawnDelay() const { return m_SpawnDelay; }
00104
00105
00107 void SetFrameDelay(int FrameDelay) { m_FrameDelay = FrameDelay; }
00108
00110 int GetFrameDelay() const { return m_FrameDelay; }
00111
00112
00114 void SetLifeSpan(int LifeSpan) { m_ParticleLifeSpan = LifeSpan; }
00115
00117 int GetLifeSpan() const { return m_ParticleLifeSpan; }
00118
00119
00121 void SetStartScale(float ScaleX, float ScaleY)
00122 {
00123 m_StartScaleX = ScaleX;
00124 m_StartScaleY = ScaleY;
00125 }
00126
00128 float GetStartScaleX() const { return m_StartScaleX; }
00129
00131 float GetStartScaleY() const { return m_StartScaleY; }
00132
00133
00135 void SetTargetScale(float ScaleX, float ScaleY)
00136 {
00137 m_TargetScaleX = ScaleX;
00138 m_TargetScaleY = ScaleY;
00139 }
00140
00142 float GetTargetScaleX() const { return m_TargetScaleX; }
00143
00145 float GetTargetScaleY() const { return m_TargetScaleY; }
00146
00147
00149 void SetStartAlpha(int Alpha) { m_StartAlpha = Alpha; }
00150
00152 int GetStartAlpha() const { return m_StartAlpha; }
00153
00154
00156 void SetEndAlpha(int Alpha) { m_EndAlpha = Alpha; }
00157
00159 int GetEndAlpha() const { return m_EndAlpha; }
00160
00161
00163 void SetStartColor(int r, int g, int b)
00164 {
00165 m_StartRed = r;
00166 m_StartGreen = g;
00167 m_StartBlue = b;
00168 }
00169
00171 int GetStartColorR() const { return m_StartRed; }
00172
00174 int GetStartColorG() const { return m_StartGreen; }
00175
00177 int GetStartColorB() const { return m_StartBlue; }
00178
00179
00181 void SetEndColor(int r, int g, int b)
00182 {
00183 m_EndRed = r;
00184 m_EndGreen = g;
00185 m_EndBlue = b;
00186 }
00187
00189 int GetEndColorR() const { return m_EndRed; }
00190
00192 int GetEndColorG() const { return m_EndGreen; }
00193
00195 int GetEndColorB() const { return m_EndBlue; }
00196
00197
00199 void SetStartVelX(float StartVelX) { m_StartVelX = StartVelX; }
00200
00202 float GetStartVelX() const { return m_StartVelX; }
00203
00204
00206 void SetEndVelX(float EndVelX) { m_EndVelX = EndVelX; }
00207
00209 float GetEndVelX() const { return m_EndVelX; }
00210
00211
00213 void SetStartVelY(float StartVelY) { m_StartVelY = StartVelY; }
00214
00216 float GetStartVelY() const { return m_StartVelY; }
00217
00218
00220 void SetEndVelY(float EndVelY) { m_EndVelY = EndVelY; }
00221
00223 float GetEndVelY() const { return m_EndVelY; }
00224
00225
00227 void SetVelXMulti(float Low, float High)
00228 {
00229 m_LowVelXMulti = Low;
00230 m_HighVelXMulti = High;
00231 }
00232
00234 float GetLowVelXMulti() const { return m_LowVelXMulti; }
00235
00237 float GetHighVelXMulti() const { return m_HighVelXMulti; }
00238
00239
00241 void SetVelYMulti(float Low, float High)
00242 {
00243 m_LowVelYMulti = Low;
00244 m_HighVelYMulti = High;
00245 }
00246
00248 float GetLowVelYMulti() const { return m_LowVelYMulti; }
00249
00251 float GetHighVelYMulti() const { return m_HighVelYMulti; }
00252 private:
00254 void SpawnNewParticle();
00255
00256 std::vector<CParticle*> m_Particels;
00257
00258 std::string m_TexName;
00259
00260 bool m_Active;
00261
00262 float m_FrameWidth;
00263 float m_FrameHeight;
00264 int m_FrameCount;
00265 int m_FrameDelay;
00266
00267 float m_X;
00268 float m_Y;
00269
00270 float m_HalfXSize;
00271 float m_HalfYSize;
00272
00273 float m_StartScaleX;
00274 float m_StartScaleY;
00275
00276 float m_TargetScaleX;
00277 float m_TargetScaleY;
00278
00279 int m_StartAlpha;
00280 int m_EndAlpha;
00281
00282 int m_StartRed;
00283 int m_EndRed;
00284
00285 int m_StartGreen;
00286 int m_EndGreen;
00287
00288 int m_StartBlue;
00289 int m_EndBlue;
00290
00291 float m_StartVelX;
00292 float m_EndVelX;
00293
00294 float m_StartVelY;
00295 float m_EndVelY;
00296
00297 float m_LowVelXMulti;
00298 float m_HighVelXMulti;
00299
00300 float m_LowVelYMulti;
00301 float m_HighVelYMulti;
00302
00303 int m_LastSpawn;
00304 int m_SpawnDelay;
00305
00306 int m_ParticleLifeSpan;
00307 };
00308
00309 #endif