SuperTuxKart
font_settings.hpp
1 //
2 // SuperTuxKart - a fun racing game with go-kart
3 // Copyright (C) 2016 SuperTuxKart-Team
4 //
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 3
8 // of the License, or (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 
19 #ifndef HEADER_FONT_SETTINGS_HPP
20 #define HEADER_FONT_SETTINGS_HPP
21 
22 #include "utils/leak_check.hpp"
23 
24 #include <irrlicht.h>
25 
26 using namespace irr;
27 
33 {
34 private:
37 
42 
43  /* True if the border to draw should be thin */
44  bool m_thin_border;
45 
47  float m_scale;
48 
50  bool m_shadow;
51 
53  video::SColor m_shadow_color;
54 
56  video::SColor m_border_color;
57 
58 public:
59  LEAK_CHECK()
60  // ------------------------------------------------------------------------
63  FontSettings(bool black_border = false, bool colored_border = false,
64  bool thin_border = false, float scale = 1.0f,
65  bool shadow = false,
66  const video::SColor& shadow_color = video::SColor(0, 0, 0, 0),
67  const video::SColor& border_color = video::SColor(0, 0, 0, 0))
68  {
69  m_black_border = black_border;
70  m_colored_border = colored_border;
71  m_thin_border = thin_border;
72  m_scale = scale;
73  m_shadow = shadow;
74  m_shadow_color = shadow_color;
75  m_border_color = border_color;
76  }
77  // ------------------------------------------------------------------------
80  void setScale(float scale) { m_scale = scale; }
81  // ------------------------------------------------------------------------
83  float getScale() const { return m_scale; }
84  // ------------------------------------------------------------------------
87  void setShadowColor(const video::SColor &col) { m_shadow_color = col; }
88  // ------------------------------------------------------------------------
90  const video::SColor& getShadowColor() const { return m_shadow_color; }
91  // ------------------------------------------------------------------------
93  bool useShadow() const { return m_shadow; }
94  // ------------------------------------------------------------------------
97  void setShadow(bool shadow) { m_shadow = shadow; }
98  // ------------------------------------------------------------------------
101  void setBlackBorder(bool border) { m_black_border = border; }
102  // ------------------------------------------------------------------------
105  void setColoredBorder(bool border ) { m_colored_border = border; }
106  // ------------------------------------------------------------------------
108  void setThinBorder(bool thin) { m_thin_border = thin; }
109  // ------------------------------------------------------------------------
112  void setBorderColor(const video::SColor &col) { m_border_color = col; }
113  // ------------------------------------------------------------------------
115  const video::SColor& getBorderColor() const { return m_border_color; }
116  // ------------------------------------------------------------------------
118  bool useBlackBorder() const { return m_black_border; }
119  // ------------------------------------------------------------------------
121  bool useColoredBorder() const { return m_colored_border; }
122  // ------------------------------------------------------------------------
124  bool useThinBorder() const { return m_thin_border; }
125 
126 }; // FontSettings
127 
128 #endif
129 /* EOF */
void setScale(float scale)
Set the scaling.
Definition: font_settings.hpp:80
bool useThinBorder() const
Return if the border should be thin or not.
Definition: font_settings.hpp:124
void setShadowColor(const video::SColor &col)
Set the color of shadow.
Definition: font_settings.hpp:87
const video::SColor & getBorderColor() const
Return the color of the border.
Definition: font_settings.hpp:115
void setThinBorder(bool thin)
Set whether the text outline should be thin or not.
Definition: font_settings.hpp:108
video::SColor m_shadow_color
Save the color of shadow when rendering.
Definition: font_settings.hpp:53
void setBlackBorder(bool border)
Set whether black border is enabled.
Definition: font_settings.hpp:101
Definition: three_d_animation.hpp:32
bool useBlackBorder() const
Return if black border is enabled.
Definition: font_settings.hpp:118
void setShadow(bool shadow)
Set whether shadow is enabled.
Definition: font_settings.hpp:97
This class stores settings when rendering fonts, used when instantiating irr::gui::ScalableFont.
Definition: font_settings.hpp:32
bool m_shadow
True if shadow will be drawn when rendering.
Definition: font_settings.hpp:50
const video::SColor & getShadowColor() const
Return the color of shadow.
Definition: font_settings.hpp:90
void setBorderColor(const video::SColor &col)
Set the color of border (used when a non-black border is requested).
Definition: font_settings.hpp:112
video::SColor m_border_color
Used when m_colored_border is true.
Definition: font_settings.hpp:56
bool m_colored_border
True if a custom colored border will be drawn when rendering.
Definition: font_settings.hpp:41
float getScale() const
Return the scaling.
Definition: font_settings.hpp:83
bool useColoredBorder() const
Return if black border is enabled.
Definition: font_settings.hpp:121
bool m_black_border
True if black border will be drawn when rendering.
Definition: font_settings.hpp:36
void setColoredBorder(bool border)
Set whether a custom colored border is enabled.
Definition: font_settings.hpp:105
float m_scale
Scaling when rendering.
Definition: font_settings.hpp:47
bool useShadow() const
Return if shadow is enabled.
Definition: font_settings.hpp:93