Mana
Loading...
Searching...
No Matches
textparticle.h
Go to the documentation of this file.
1/*
2 * The Mana Client
3 * Copyright (C) 2006-2009 The Mana World Development Team
4 * Copyright (C) 2009-2012 The Mana Developers
5 *
6 * This file is part of The Mana Client.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22#pragma once
23
24#include "particle.h"
25
26class TextParticle : public Particle
27{
28 public:
29 TextParticle(Map *map, const std::string &text,
30 const gcn::Color* color,
31 gcn::Font *font, bool outline = false);
32
36 bool draw(Graphics *graphics, int offsetX, int offsetY) const override;
37
38 // hack to improve text visibility
39 int getDrawOrder() const override
40 { return (int) (mPos.y) + 32; }
41
46 bool drawnWhenBehind() const override
47 { return true; }
48
49 private:
50 std::string mText;
51 gcn::Font *mTextFont;
52 const gcn::Color *mColor;
53 bool mOutline;
54};
Vector mPos
Position in pixels relative to map.
Definition actor.h:114
A central point of control for graphics.
Definition graphics.h:78
A tile map.
Definition map.h:147
A particle spawned by a ParticleEmitter.
Definition particle.h:42
bool mOutline
Make the text better readable.
std::string mText
Text of the particle.
gcn::Font * mTextFont
Font used for drawing the text.
int getDrawOrder() const override
Returns the pixel Y coordinate that the actor should be drawn at.
const gcn::Color * mColor
Color used for drawing the text.
bool drawnWhenBehind() const override
In contrary to other particles, text particles should not be obscured by objects, because their infor...
bool draw(Graphics *graphics, int offsetX, int offsetY) const override
Draws the particle image.
float y
Definition vector.h:172
Graphics * graphics
Definition client.cpp:104