ManaPlus
textparticle.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_TEXTPARTICLE_H
24 #define PARTICLE_TEXTPARTICLE_H
25 
26 #include "particle/particle.h"
27 
28 class TextParticle final : public Particle
29 {
30  public:
34  TextParticle(const std::string &text,
35  const Color *restrict const color,
36  Font *restrict const font,
37  const bool outline) A_NONNULL(3, 4);
38 
40 
41 
44  void draw(Graphics *restrict const graphics,
45  const int offsetX,
46  const int offsetY) const
47  restrict2 override final A_NONNULL(2);
48 
49  // hack to improve text visibility
51  { return CAST_S32(mPos.y + mPos.z); }
52 
53  // hack to improve text visibility (for sorting only)
55  { return CAST_S32(mPos.y + mPos.z); }
56 
57  private:
59  std::string mText;
66  bool mOutline;
67 };
68 
69 #endif // PARTICLE_TEXTPARTICLE_H
TextParticle::mTextFont
Font * mTextFont
Definition: textparticle.h:61
TextParticle::TextParticle
TextParticle(const std::string &text, const Color *const color, Font *const font, const bool outline)
Definition: textparticle.cpp:33
restrict2
#define restrict2
Definition: localconsts.h:165
TextParticle::mTextWidth
int mTextWidth
Definition: textparticle.h:64
Particle
Definition: particle.h:44
TextParticle::getPixelY
int getPixelY() const
Definition: textparticle.h:50
Actor::mPos
Vector mPos
Definition: actor.h:139
TextParticle::getSortPixelY
int getSortPixelY() const
Definition: textparticle.h:54
A_DELETE_COPY
#define A_DELETE_COPY(func)
Definition: localconsts.h:52
Graphics
Definition: graphics.h:107
A_NONNULLPOINTER
#define A_NONNULLPOINTER
Definition: localconsts.h:265
Vector::z
float z
Definition: vector.h:208
TextParticle::draw
void draw(Graphics *const graphics, const int offsetX, const int offsetY) const
Definition: textparticle.cpp:47
final
#define final
Definition: localconsts.h:45
Font
Definition: font.h:88
particle.h
override
#define override
Definition: localconsts.h:46
restrict
#define restrict
Definition: localconsts.h:164
Vector::y
float y
Definition: vector.h:208
CAST_S32
#define CAST_S32
Definition: cast.h:29
A_WARN_UNUSED
#define A_WARN_UNUSED
Definition: localconsts.h:160
TextParticle::mColor
const Color * mColor
Definition: textparticle.h:63
TextParticle::mText
std::string mText
Definition: textparticle.h:59
TextParticle::mOutline
bool mOutline
Definition: textparticle.h:66
TextParticle
Definition: textparticle.h:28
Color
Definition: color.h:74
A_NONNULL
#define A_NONNULL(...)
Definition: localconsts.h:167