Mana
Loading...
Searching...
No Matches
particleemitter.h
Go to the documentation of this file.
1/*
2 * The Mana Client
3 * Copyright (C) 2006-2009 The Mana World Development Team
4 * Copyright (C) 2009-2012 The Mana Developers
5 *
6 * This file is part of The Mana Client.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22#pragma once
23
24#include "particleemitterprop.h"
25
26#include "resources/animation.h"
27#include "resources/resource.h"
28
29#include "utils/xml.h"
30
31#include <list>
32
33class Image;
34class Map;
35class Particle;
36
42{
43 public:
44 ParticleEmitter(XML::Node emitterNode, Particle *target, Map *map,
45 int rotation = 0,
46 const std::string& dyePalettes = std::string());
47
52
57
59
64 std::list<Particle *> createParticles(int tick);
65
69 void setTarget(Particle *target)
70 { mParticleTarget = target; };
71
76 void adjustSize(int w, int h);
77
78 private:
79 template <typename T> ParticleEmitterProp<T> readParticleEmitterProp(XML::Node propertyNode, T def);
80
85
90
95
96 /*
97 * Vector changing of particles:
98 */
103
104 /*
105 * Properties of targeting particles:
106 */
111
112 /*
113 * Behavior over time of the particles:
114 */
118
124
125 /*
126 * Graphical representation of the particles
127 */
133 /*
134 * Death effect of the particles
135 */
136 std::string mDeathEffect;
138
140 std::list<ParticleEmitter> mParticleChildEmitters;
141};
An animation consists of several frames, each with their own delay and offset.
Definition animation.h:47
Defines a class for loading and storing images.
Definition image.h:45
A tile map.
Definition map.h:147
Every Particle can have one or more particle emitters that create new particles when they are updated...
std::string mDeathEffect
Particle * mParticleTarget
ParticleEmitterProp< float > mParticlePosZ
void setTarget(Particle *target)
Sets the target of the particles that are created.
ParticleEmitterProp< int > mOutput
Number of particles spawned per update.
ParticleEmitterProp< float > mParticleAngleHorizontal
initial vector of particles:
ParticleEmitterProp< float > mParticleDieDistance
ParticleEmitterProp< int > mParticleFadeIn
std::list< ParticleEmitter > mParticleChildEmitters
List of emitters the spawned particles are equipped with.
ResourceRef< Image > mParticleImage
Particle image, if used.
ParticleEmitterProp< int > mParticleRandomness
ParticleEmitterProp< float > mParticlePower
Initial velocity of particles.
ParticleEmitterProp< int > mParticleLifetime
std::list< Particle * > createParticles(int tick)
Spawns new particles.
ParticleEmitterProp< float > mParticleAngleVertical
ParticleEmitterProp< float > mParticleAcceleration
ParticleEmitterProp< float > mParticleGravity
ParticleEmitter & operator=(const ParticleEmitter &o)
Assignment operator that calls the copy constructor.
ParticleEmitterProp< int > mParticleFadeOut
ParticleEmitterProp< float > mParticleAlpha
Opacity of the graphical representation of the particles.
Animation mParticleAnimation
Filename of particle animation file.
ParticleEmitterProp< T > readParticleEmitterProp(XML::Node propertyNode, T def)
ParticleEmitterProp< float > mParticlePosX
initial position of particles:
ParticleEmitterProp< float > mParticleBounce
Animation mParticleRotation
Filename of particle rotation file.
Map * mMap
Map the particles are spawned on.
void adjustSize(int w, int h)
Changes the size of the emitter so that the effect fills a rectangle of this size.
ParticleEmitterProp< float > mParticleMomentum
ParticleEmitterProp< float > mParticlePosY
ParticleEmitterProp< int > mOutputPause
Pause in frames between two spawns.
A particle spawned by a ParticleEmitter.
Definition particle.h:42
Automatically counting Resource reference.
Definition resource.h:74