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  * Copyright (C) 2019-2021 Andrei Karas
7  *
8  * This file is part of The ManaPlus Client.
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program. If not, see <http://www.gnu.org/licenses/>.
22  */
23 
24 #ifndef PARTICLE_PARTICLEENGINE_H
25 #define PARTICLE_PARTICLEENGINE_H
26 
28 
29 #include <list>
30 #include <string>
31 
32 #include "localconsts.h"
33 
34 class Color;
35 class Font;
36 class Map;
37 class Particle;
38 class ParticleEmitter;
39 
40 typedef std::list<Particle *> Particles;
41 typedef Particles::iterator ParticleIterator;
42 typedef Particles::const_iterator ParticleConstIterator;
43 typedef std::list<ParticleEmitter *> Emitters;
44 typedef Emitters::iterator EmitterIterator;
45 typedef Emitters::const_iterator EmitterConstIterator;
46 
48 {
49  public:
50  static const float PARTICLE_SKY; // Maximum Z position of particles
51  static ParticlePhysicsT fastPhysics; // Mode of squareroot calculation
52  static int particleCount; // Current number of particles
53  static int maxCount; // Maximum number of particles
54  static int emitterSkip; // Duration of pause between two
55  // emitter updates in ticks
56  static bool enabled; // true when non-crucial particle effects
57  // are disabled
58 
60 
62 
63 
67 
71  void clear() restrict2;
72 
77  static void setupEngine();
78 
83  bool update() restrict2;
84 
90 
95  Particle *addEffect(const std::string &restrict particleEffectFile,
96  const int pixelX,
97  const int pixelY,
98  const int rotation) restrict2;
99 
103  Particle *addTextSplashEffect(const std::string &restrict text,
104  const int x,
105  const int y,
106  const Color *restrict const color,
107  Font *restrict const font,
108  const bool outline)
109  restrict2 A_NONNULL(5, 6);
110 
114  Particle *addTextRiseFadeOutEffect(const std::string &restrict text,
115  const int x,
116  const int y,
117  const Color *restrict const color,
118  Font *restrict const font,
119  const bool outline)
120  restrict2 A_NONNULL(5, 6);
121 
122  void setMap(Map *const map)
123  { mMap = map; }
124 
125  private:
126  // List of particles controlled by this particle
130 };
131 
133 
134 #endif // PARTICLE_PARTICLEENGINE_H
Definition: color.h:76
Definition: font.h:90
Definition: map.h:75
void setMap(Map *const map)
static int particleCount
static const float PARTICLE_SKY
Particle * createChild()
static int maxCount
Particle * addEffect(const std::string &particleEffectFile, const int pixelX, const int pixelY, const int rotation)
Particle * addTextRiseFadeOutEffect(const std::string &text, const int x, const int y, const Color *const color, Font *const font, const bool outline)
static ParticlePhysicsT fastPhysics
Particles mChildMoveParticles
static bool enabled
Particle * addTextSplashEffect(const std::string &text, const int x, const int y, const Color *const color, Font *const font, const bool outline)
static int emitterSkip
static void setupEngine()
Particles mChildParticles
#define restrict
Definition: localconsts.h:165
#define restrict2
Definition: localconsts.h:166
#define A_NONNULL(...)
Definition: localconsts.h:168
#define final
Definition: localconsts.h:46
#define A_DELETE_COPY(func)
Definition: localconsts.h:53
Particles::iterator ParticleIterator
Particles::const_iterator ParticleConstIterator
std::list< ParticleEmitter * > Emitters
ParticleEngine * particleEngine
Emitters::iterator EmitterIterator
Emitters::const_iterator EmitterConstIterator
std::list< Particle * > Particles
ParticlePhysics ::T ParticlePhysicsT