ManaPlus
particleengine.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_PARTICLEENGINE_H
24 #define PARTICLE_PARTICLEENGINE_H
25 
27 
28 #include <list>
29 #include <string>
30 
31 #include "localconsts.h"
32 
33 class Color;
34 class Font;
35 class Map;
36 class Particle;
38 
39 typedef std::list<Particle *> Particles;
40 typedef Particles::iterator ParticleIterator;
41 typedef Particles::const_iterator ParticleConstIterator;
42 typedef std::list<ParticleEmitter *> Emitters;
43 typedef Emitters::iterator EmitterIterator;
44 typedef Emitters::const_iterator EmitterConstIterator;
45 
47 {
48  public:
49  static const float PARTICLE_SKY; // Maximum Z position of particles
50  static ParticlePhysicsT fastPhysics; // Mode of squareroot calculation
51  static int particleCount; // Current number of particles
52  static int maxCount; // Maximum number of particles
53  static int emitterSkip; // Duration of pause between two
54  // emitter updates in ticks
55  static bool enabled; // true when non-crucial particle effects
56  // are disabled
57 
59 
61 
62 
66 
70  void clear() restrict2;
71 
76  static void setupEngine();
77 
82  bool update() restrict2;
83 
89 
94  Particle *addEffect(const std::string &restrict particleEffectFile,
95  const int pixelX,
96  const int pixelY,
97  const int rotation) restrict2;
98 
102  Particle *addTextSplashEffect(const std::string &restrict text,
103  const int x,
104  const int y,
105  const Color *restrict const color,
106  Font *restrict const font,
107  const bool outline)
108  restrict2 A_NONNULL(5, 6);
109 
113  Particle *addTextRiseFadeOutEffect(const std::string &restrict text,
114  const int x,
115  const int y,
116  const Color *restrict const color,
117  Font *restrict const font,
118  const bool outline)
119  restrict2 A_NONNULL(5, 6);
120 
121  void setMap(Map *const map)
122  { mMap = map; }
123 
124  private:
125  // List of particles controlled by this particle
129 };
130 
132 
133 #endif // PARTICLE_PARTICLEENGINE_H
ParticleEngine::mMap
Map * mMap
Definition: particleengine.h:128
ParticleEngine::setMap
void setMap(Map *const map)
Definition: particleengine.h:121
ParticleEngine::addTextRiseFadeOutEffect
Particle * addTextRiseFadeOutEffect(const std::string &text, const int x, const int y, const Color *const color, Font *const font, const bool outline)
Definition: particleengine.cpp:309
ParticleEngine::maxCount
static int maxCount
Definition: particleengine.h:52
EmitterConstIterator
Emitters::const_iterator EmitterConstIterator
Definition: particleengine.h:44
restrict2
#define restrict2
Definition: localconsts.h:165
Particle
Definition: particle.h:44
ParticleEngine::addEffect
Particle * addEffect(const std::string &particleEffectFile, const int pixelX, const int pixelY, const int rotation)
Definition: particleengine.cpp:129
A_DELETE_COPY
#define A_DELETE_COPY(func)
Definition: localconsts.h:52
EmitterIterator
Emitters::iterator EmitterIterator
Definition: particleengine.h:43
ParticleEngine::addTextSplashEffect
Particle * addTextSplashEffect(const std::string &text, const int x, const int y, const Color *const color, Font *const font, const bool outline)
Definition: particleengine.cpp:278
ParticleEngine::fastPhysics
static ParticlePhysicsT fastPhysics
Definition: particleengine.h:50
ParticleEngine::particleCount
static int particleCount
Definition: particleengine.h:51
localconsts.h
ParticleConstIterator
Particles::const_iterator ParticleConstIterator
Definition: particleengine.h:41
ParticleIterator
Particles::iterator ParticleIterator
Definition: particleengine.h:40
ParticleEngine
Definition: particleengine.h:46
final
#define final
Definition: localconsts.h:45
ParticleEngine::ParticleEngine
ParticleEngine()
Definition: particleengine.cpp:52
Particles
std::list< Particle * > Particles
Definition: particleengine.h:37
ParticleEngine::setupEngine
static void setupEngine()
Definition: particleengine.cpp:67
particlephysics.h
ParticleEmitter
Definition: particleemitter.h:43
ParticleEngine::emitterSkip
static int emitterSkip
Definition: particleengine.h:53
ParticleEngine::createChild
Particle * createChild()
Definition: particleengine.cpp:121
ParticleEngine::enabled
static bool enabled
Definition: particleengine.h:55
ParticleEngine::mChildMoveParticles
Particles mChildMoveParticles
Definition: particleengine.h:127
x
x
Definition: graphics_calcImageRect.hpp:72
Font
Definition: font.h:88
ParticleEngine::mChildParticles
Particles mChildParticles
Definition: particleengine.h:126
ParticleEngine::clear
void clear()
Definition: particleengine.cpp:338
Emitters
std::list< ParticleEmitter * > Emitters
Definition: particleengine.h:42
ParticleEngine::update
bool update()
Definition: particleengine.cpp:81
std
Definition: mseprimitives.h:398
ParticleEngine::PARTICLE_SKY
static const float PARTICLE_SKY
Definition: particleengine.h:49
Map
Definition: map.h:71
restrict
#define restrict
Definition: localconsts.h:164
ParticlePhysicsT
ParticlePhysics ::T ParticlePhysicsT
Definition: particlephysics.h:32
Color
Definition: color.h:74
y
y
Definition: graphics_calcImageRect.hpp:72
A_NONNULL
#define A_NONNULL(...)
Definition: localconsts.h:167
ParticleEngine::~ParticleEngine
~ParticleEngine()
Definition: particleengine.cpp:60
particleEngine
ParticleEngine * particleEngine
Definition: particleengine.cpp:41