Mana
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
TextParticle Class Reference

#include <textparticle.h>

Inheritance diagram for TextParticle:
Particle Actor

Public Member Functions

 TextParticle (Map *map, const std::string &text, const gcn::Color *color, gcn::Font *font, bool outline=false)
 
bool draw (Graphics *graphics, int offsetX, int offsetY) const override
 Draws the particle image.
 
int getDrawOrder () const override
 Returns the pixel Y coordinate that the actor should be drawn at.
 
bool drawnWhenBehind () const override
 In contrary to other particles, text particles should not be obscured by objects, because their information is too important.
 
- Public Member Functions inherited from Particle
 Particle (Map *map)
 Constructor.
 
 ~Particle () override
 
void clear ()
 Deletes all child particles and emitters.
 
virtual bool update ()
 Updates particle position, returns false when the particle should be deleted.
 
ParticlecreateChild ()
 Creates a blank particle as a child of the current particle Useful for creating target particles.
 
ParticleaddEffect (const std::string &particleEffectFile, int pixelX, int pixelY, int rotation=0)
 Creates a child particle that hosts some emitters described in the particleEffectFile.
 
ParticleaddTextSplashEffect (const std::string &text, int x, int y, const gcn::Color *color, gcn::Font *font, bool outline=false)
 Creates a standalone text particle.
 
ParticleaddTextRiseFadeOutEffect (const std::string &text, int x, int y, const gcn::Color *color, gcn::Font *font, bool outline=false)
 Creates a standalone text particle.
 
void addEmitter (ParticleEmitter *emitter)
 Adds an emitter to the particle.
 
void moveTo (const Vector &pos)
 Sets the position in 3 dimensional space in pixels relative to map.
 
void moveTo (float x, float y)
 Sets the position in 2 dimensional space in pixels relative to map.
 
void moveBy (const Vector &change)
 Changes the particle position relative.
 
void setLifetime (int lifetime)
 Sets the time in game ticks until the particle is destroyed.
 
void setFadeOut (int fadeOut)
 Sets the age of the pixel in game ticks where the particle has faded in completely.
 
void setFadeIn (int fadeIn)
 Sets the remaining particle lifetime where the particle starts to fade out.
 
void setVelocity (float x, float y, float z)
 Sets the current velocity in 3 dimensional space.
 
void setGravity (float gravity)
 Sets the downward acceleration.
 
void setRandomness (int r)
 Sets the ammount of random vector changes.
 
void setBounce (float bouncieness)
 Sets the ammount of velocity particles retain after hitting the ground.
 
void setFollow (bool follow)
 Sets the flag if the particle is supposed to be moved by its parent.
 
bool doesFollow () const
 Gets the flag if the particle is supposed to be moved by its parent.
 
void setDestination (Particle *target, float accel, float moment)
 Makes the particle move toward another particle with a given acceleration and momentum.
 
void setDieDistance (float dist)
 Sets the distance in pixel the particle can come near the target particle before it is destroyed.
 
void adjustEmitterSize (int w, int h)
 Changes the size of the emitters so that the effect fills a rectangle of this size.
 
void setAllowSizeAdjust (bool adjust)
 
bool isAlive () const
 
bool isExtinct () const
 Determines whether the particle and its children are all dead.
 
void kill ()
 Manually marks the particle for deletion.
 
void disableAutoDelete ()
 After calling this function the particle will only request deletion when kill() is called.
 
float getAlpha () const override
 Returns the current alpha value used to draw the actor.
 
void setAlpha (float alpha) override
 Sets the alpha value used to draw the actor.
 
virtual void setDeathEffect (const std::string &effectFile, char conditions)
 
- Public Member Functions inherited from Actor
 Actor ()
 
virtual ~Actor ()
 
const VectorgetPosition () const
 Returns the pixel position of this actor.
 
virtual void setPosition (const Vector &pos)
 Sets the pixel position of this actor.
 
int getPixelX () const
 Returns the pixels X coordinate of the actor.
 
int getPixelY () const
 Returns the pixel Y coordinate of the actor.
 
virtual int getTileX () const
 Returns the x coordinate in tiles of the actor.
 
virtual int getTileY () const
 Returns the y coordinate in tiles of the actor.
 
virtual void setMap (Map *map)
 
MapgetMap () const
 

Private Attributes

std::string mText
 Text of the particle.
 
gcn::Font * mTextFont
 Font used for drawing the text.
 
const gcn::Color * mColor
 Color used for drawing the text.
 
bool mOutline
 Make the text better readable.
 

Additional Inherited Members

- Public Types inherited from Particle
enum  AliveStatus {
  ALIVE = 0 , DEAD_TIMEOUT = 1 , DEAD_FLOOR = 2 , DEAD_SKY = 4 ,
  DEAD_IMPACT = 8 , DEAD_OTHER = 16 , DEAD_LONG_AGO = 128
}
 
- Static Public Member Functions inherited from Particle
static void setupEngine ()
 Gives a particle the properties of an engine root particle and loads the particle-related config settings.
 
- Static Public Attributes inherited from Particle
static const float PARTICLE_SKY = 800.0f
 Maximum Z position of particles.
 
static int fastPhysics = 0
 Mode of squareroot calculation.
 
static int particleCount = 0
 Current number of particles.
 
static int maxCount = 0
 Maximum number of particles.
 
static int emitterSkip = 1
 Duration of pause between two emitter updates in ticks.
 
static bool enabled = true
 true when non-crucial particle effects are disabled
 
- Protected Member Functions inherited from Particle
float getCurrentAlpha () const
 Calculates the current alpha transparency taking current fade status into account.
 
- Protected Attributes inherited from Particle
float mAlpha = 1.0f
 Opacity of the graphical representation of the particle.
 
int mLifetimeLeft = -1
 Lifetime left in game ticks.
 
int mLifetimePast = 0
 Age of the particle in game ticks.
 
int mFadeOut = 0
 Lifetime in game ticks left where fading out begins.
 
int mFadeIn = 0
 Age in game ticks where fading in is finished.
 
Vector mVelocity
 Speed in pixels per game-tick.
 
- Protected Attributes inherited from Actor
MapmMap = nullptr
 
Vector mPos
 Position in pixels relative to map.
 

Detailed Description

Definition at line 26 of file textparticle.h.

Constructor & Destructor Documentation

◆ TextParticle()

TextParticle::TextParticle ( Map map,
const std::string &  text,
const gcn::Color *  color,
gcn::Font *  font,
bool  outline = false 
)

Definition at line 28 of file textparticle.cpp.

Member Function Documentation

◆ draw()

bool TextParticle::draw ( Graphics graphics,
int  offsetX,
int  offsetY 
) const
overridevirtual

Draws the particle image.

Reimplemented from Particle.

Definition at line 39 of file textparticle.cpp.

◆ drawnWhenBehind()

bool TextParticle::drawnWhenBehind ( ) const
inlineoverridevirtual

In contrary to other particles, text particles should not be obscured by objects, because their information is too important.

Reimplemented from Particle.

Definition at line 46 of file textparticle.h.

◆ getDrawOrder()

int TextParticle::getDrawOrder ( ) const
inlineoverridevirtual

Returns the pixel Y coordinate that the actor should be drawn at.

Reimplemented from Actor.

Definition at line 39 of file textparticle.h.

Member Data Documentation

◆ mColor

const gcn::Color* TextParticle::mColor
private

Color used for drawing the text.

Definition at line 52 of file textparticle.h.

◆ mOutline

bool TextParticle::mOutline
private

Make the text better readable.

Definition at line 53 of file textparticle.h.

◆ mText

std::string TextParticle::mText
private

Text of the particle.

Definition at line 50 of file textparticle.h.

◆ mTextFont

gcn::Font* TextParticle::mTextFont
private

Font used for drawing the text.

Definition at line 51 of file textparticle.h.


The documentation for this class was generated from the following files: