ManaPlus
Public Member Functions | Private Attributes
FlashText Class Reference

#include <text.h>

Inheritance diagram for FlashText:
Text

Public Member Functions

 FlashText (const std::string &text, const int x, const int y, const Graphics::Alignment alignment, const Color *const color, Font *const font)
 
void flash (const int time)
 
void draw (Graphics *const graphics, const int xOff, const int yOff)
 
- Public Member Functions inherited from Text
 Text (const std::string &text, const int x, const int y, const Graphics::Alignment alignment, const Color *const color, const Speech isSpeech, Font *const font)
 
virtual ~Text ()
 
void setColor (const Color *const color)
 
int getWidth () const
 
int getHeight () const
 
void adviseXY (const int x, const int y, const Move move)
 
int getX () const
 
int getY () const
 

Private Attributes

int mTime
 

Additional Inherited Members

- Static Protected Attributes inherited from Text
static ImageRect mBubble
 

Detailed Description

Definition at line 107 of file text.h.

Constructor & Destructor Documentation

◆ FlashText()

FlashText::FlashText ( const std::string &  text,
const int  x,
const int  y,
const Graphics::Alignment  alignment,
const Color *const  color,
Font *const  font 
)

Definition at line 188 of file text.cpp.

192  :
193  Text(text, x, y, alignment, color, Speech_false, font),
194  mTime(0)
195 {
196 }
int mTime
Definition: text.h:131
Text(const std::string &text, const int x, const int y, const Graphics::Alignment alignment, const Color *const color, const Speech isSpeech, Font *const font)
Definition: text.cpp:46
const bool Speech_false
Definition: speech.h:30

Member Function Documentation

◆ draw()

void FlashText::draw ( Graphics *const  graphics,
const int  xOff,
const int  yOff 
)
virtual

Draws the text.

Reimplemented from Text.

Definition at line 198 of file text.cpp.

199 {
200  BLOCK_START("FlashText::draw")
201  if (mTime != 0)
202  {
203  if ((--mTime & 4) == 0)
204  {
205  BLOCK_END("FlashText::draw")
206  return;
207  }
208  }
209  Text::draw(graphics, xOff, yOff);
211 }
void draw(Graphics *const graphics, const int xOff, const int yOff)
Definition: text.cpp:198
Definition: text.h:40
if(!vert) return
#define BLOCK_END(name)
Definition: perfomance.h:80
#define BLOCK_START(name)
Definition: perfomance.h:79

References BLOCK_END, BLOCK_START, Text::draw(), and mTime.

◆ flash()

void FlashText::flash ( const int  time)
inline

Flash the text for so many refreshes.

Definition at line 120 of file text.h.

121  { mTime = time; }

References mTime.

Field Documentation

◆ mTime

int FlashText::mTime
private

Time left for flashing

Definition at line 131 of file text.h.

Referenced by draw(), and flash().


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