ManaPlus
particleemitter.h
Go to the documentation of this file.
1 /*
2  * The ManaPlus Client
3  * Copyright (C) 2006-2009 The Mana World Development Team
4  * Copyright (C) 2009-2010 The Mana Developers
5  * Copyright (C) 2011-2019 The ManaPlus Developers
6  *
7  * This file is part of The ManaPlus Client.
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program. If not, see <http://www.gnu.org/licenses/>.
21  */
22 
23 #ifndef PARTICLE_PARTICLEEMITTER_H
24 #define PARTICLE_PARTICLEEMITTER_H
25 
27 
29 
30 #include "utils/xml.h"
31 
32 #include <list>
33 
34 class Image;
35 class ImageSet;
36 class Map;
37 class Particle;
38 
44 {
45  public:
46  ParticleEmitter(XmlNodeConstPtrConst emitterNode,
47  Particle *const target,
48  Map *const map,
49  const int rotation,
50  const std::string& dyePalettes) A_NONNULL(3);
51 
56 
58 
59 
63 
68 
72  void createParticles(const int tick,
73  STD_VECTOR<Particle*> &newParticles);
74 
78  void setTarget(Particle *const target)
79  { mParticleTarget = target; }
80 
85  void adjustSize(const int w, const int h);
86 
87  private:
88  template <typename T> static ParticleEmitterProp<T>
89  readParticleEmitterProp(XmlNodePtrConst propertyNode, T def);
90 
91  static ImageSet *getImageSet(XmlNodePtrConst node);
92 
97 
103 
108 
109  /*
110  * Vector changing of particles:
111  */
115 
116  /*
117  * Properties of targeting particles:
118  */
123 
124  /*
125  * Behavior over time of the particles:
126  */
130 
131  // Map the particles are spawned on
133 
134  // Number of particles spawned per update
136 
137  // Pause in frames between two spawns
139 
140  /*
141  * Graphical representation of the particles
142  */
143  // Particle image, if used
145 
146  // Filename of particle animation file
148 
149  // Filename of particle rotation file
151 
152  // Opacity of the graphical representation of the particles
154 
155  /*
156  * Death effect of the particles
157  */
158  std::string mDeathEffect;
159 
160  // List of emitters the spawned particles are equipped with
161  std::list<ParticleEmitter> mParticleChildEmitters;
162 
163  STD_VECTOR<ImageSet*> mTempSets;
164 
166 
168 
170 };
171 #endif // PARTICLE_PARTICLEEMITTER_H
ParticleEmitter::adjustSize
void adjustSize(const int w, const int h)
Definition: particleemitter.cpp:605
particleemitterprop.h
animation.h
ParticleEmitter::mParticleDieDistance
ParticleEmitterProp< float > mParticleDieDistance
Definition: particleemitter.h:121
ParticleEmitter::mParticlePosY
ParticleEmitterProp< float > mParticlePosY
Definition: particleemitter.h:96
ParticleEmitter::mParticlePosX
ParticleEmitterProp< float > mParticlePosX
Definition: particleemitter.h:96
ParticleEmitter::mMap
Map * mMap
Definition: particleemitter.h:132
ParticleEmitter::operator=
ParticleEmitter & operator=(const ParticleEmitter &o)
Definition: particleemitter.cpp:410
ParticleEmitter::mTempSets
std::vector< ImageSet * > mTempSets
Definition: particleemitter.h:163
Particle
Definition: particle.h:44
ParticleEmitter::ParticleEmitter
ParticleEmitter(const xmlNode *const emitterNode, Particle *const target, Map *const map, const int rotation, const std::string &dyePalettes)
Definition: particleemitter.cpp:53
ParticleEmitter::mParticleRandomness
ParticleEmitterProp< int > mParticleRandomness
Definition: particleemitter.h:113
ParticleEmitter::readParticleEmitterProp
static ParticleEmitterProp< T > readParticleEmitterProp(xmlNode *const propertyNode, T def)
Definition: particleemitter.cpp:472
ParticleEmitter::mOutputPauseLeft
int mOutputPauseLeft
Definition: particleemitter.h:165
ParticleEmitter::mParticleRotation
Animation mParticleRotation
Definition: particleemitter.h:150
ParticleEmitter::mParticleTarget
Particle * mParticleTarget
Definition: particleemitter.h:119
ParticleEmitter::mParticleFollow
bool mParticleFollow
Definition: particleemitter.h:169
ParticleEmitter::mOutputPause
ParticleEmitterProp< int > mOutputPause
Definition: particleemitter.h:138
Image
Definition: image.h:67
ParticleEmitter::getImageSet
static ImageSet * getImageSet(xmlNode *const node)
Definition: particleemitter.cpp:373
xml.h
ParticleEmitter::mParticleBounce
ParticleEmitterProp< float > mParticleBounce
Definition: particleemitter.h:114
A_DEFAULT_COPY
#define A_DEFAULT_COPY(func)
Definition: localconsts.h:40
ParticleEmitter::mDeathEffectConditions
signed char mDeathEffectConditions
Definition: particleemitter.h:167
ParticleEmitter::mOutput
ParticleEmitterProp< int > mOutput
Definition: particleemitter.h:135
final
#define final
Definition: localconsts.h:45
ParticleEmitterProp
Definition: particleemitterprop.h:32
ParticleEmitter::~ParticleEmitter
~ParticleEmitter()
Definition: particleemitter.cpp:455
ParticleEmitter::mParticleFadeOut
ParticleEmitterProp< int > mParticleFadeOut
Definition: particleemitter.h:128
ParticleEmitter::mParticleAnimation
Animation mParticleAnimation
Definition: particleemitter.h:147
ParticleEmitter::mParticleChildEmitters
std::list< ParticleEmitter > mParticleChildEmitters
Definition: particleemitter.h:161
ParticleEmitter
Definition: particleemitter.h:43
ParticleEmitter::mParticleAlpha
ParticleEmitterProp< float > mParticleAlpha
Definition: particleemitter.h:153
ParticleEmitter::mParticleFadeIn
ParticleEmitterProp< int > mParticleFadeIn
Definition: particleemitter.h:129
ParticleEmitter::mParticleAngleHorizontal
ParticleEmitterProp< float > mParticleAngleHorizontal
Definition: particleemitter.h:101
ParticleEmitter::mParticleLifetime
ParticleEmitterProp< int > mParticleLifetime
Definition: particleemitter.h:127
Animation
Definition: animation.h:40
ParticleEmitter::mParticleAngleVertical
ParticleEmitterProp< float > mParticleAngleVertical
Definition: particleemitter.h:102
ParticleEmitter::mParticleImage
Image * mParticleImage
Definition: particleemitter.h:144
ParticleEmitter::mParticleMomentum
ParticleEmitterProp< float > mParticleMomentum
Definition: particleemitter.h:122
ParticleEmitter::mDeathEffect
std::string mDeathEffect
Definition: particleemitter.h:158
ActorType::T
T
Definition: actortype.h:27
Map
Definition: map.h:71
ParticleEmitter::mParticlePosZ
ParticleEmitterProp< float > mParticlePosZ
Definition: particleemitter.h:96
ImageSet
Definition: imageset.h:37
ParticleEmitter::mParticleGravity
ParticleEmitterProp< float > mParticleGravity
Definition: particleemitter.h:112
A_NONNULL
#define A_NONNULL(...)
Definition: localconsts.h:167
ParticleEmitter::mParticleAcceleration
ParticleEmitterProp< float > mParticleAcceleration
Definition: particleemitter.h:120
ParticleEmitter::mParticlePower
ParticleEmitterProp< float > mParticlePower
Definition: particleemitter.h:107
ParticleEmitter::createParticles
void createParticles(const int tick, std::vector< Particle * > &newParticles)
Definition: particleemitter.cpp:513
ParticleEmitter::setTarget
void setTarget(Particle *const target)
Definition: particleemitter.h:78