FIFE  be64c707dea6b3250bd4355bf5c825d25920087d
floatingtextrenderer.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005-2019 by the FIFE team *
3  * http://www.fifengine.net *
4  * This file is part of FIFE. *
5  * *
6  * FIFE is free software; you can redistribute it and/or *
7  * modify it under the terms of the GNU Lesser General Public *
8  * License as published by the Free Software Foundation; either *
9  * version 2.1 of the License, or (at your option) any later version. *
10  * *
11  * This library is distributed in the hope that it will be useful, *
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
14  * Lesser General Public License for more details. *
15  * *
16  * You should have received a copy of the GNU Lesser General Public *
17  * License along with this library; if not, write to the *
18  * Free Software Foundation, Inc., *
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
20  ***************************************************************************/
21 
22 #ifndef FIFE_FLOATINGTEXTRENDERER_H
23 #define FIFE_FLOATINGTEXTRENDERER_H
24 
25 // Standard C++ library includes
26 
27 // 3rd party library includes
28 
29 // FIFE includes
30 // These includes are split up in two parts, separated by one empty line
31 // First block: files included from the FIFE root src directory
32 // Second block: files included from the same folder
33 #include "view/rendererbase.h"
34 
35 namespace FIFE {
36  class RenderBackend;
37  class IFont;
38 
40  public:
47  FloatingTextRenderer(RenderBackend* renderbackend, int32_t position);
48 
52 
56 
59  virtual ~FloatingTextRenderer();
60 
68  void render(Camera* cam, Layer* layer, RenderList& instances);
69 
74  std::string getName() { return "FloatingTextRenderer"; }
75 
79  void setFont(IFont* font) { m_font = font; }
80 
84  void setColor(uint8_t r, uint8_t g, uint8_t b, uint8_t a = 255);
85 
89  void setBackground(uint8_t br, uint8_t bg, uint8_t bb, uint8_t ba = 255);
90 
94  void setBorder(uint8_t bbr, uint8_t bbg, uint8_t bbb, uint8_t bba = 255);
95 
98  void resetBackground();
99 
102  void resetBorder();
103 
107 
111 
112  private:
116  SDL_Color m_color;
119  SDL_Color m_backcolor;
120  SDL_Color m_backbordercolor;
121  };
122 
123 }
124 
125 #endif
void render(Camera *cam, Layer *layer, RenderList &instances)
This method is called by the view to ask renderer to draw its rendering aspect based on given paramet...
std::string getName()
Returns the renderer name.
Abstract interface for all the renderbackends.
std::vector< RenderItem * > RenderList
Definition: renderitem.h:130
RendererBase * clone()
Makes copy of this renderer.
void resetBackground()
Disable the default background.
Interface to class owning the renderers Used to get correct subclass of renderer in scripting side (v...
Definition: rendererbase.h:66
static FloatingTextRenderer * getInstance(IRendererContainer *cnt)
Gets instance for interface access.
void setBorder(uint8_t bbr, uint8_t bbg, uint8_t bbb, uint8_t bba=255)
Set default border r,g,b,a values for border.
Camera describes properties of a view port shown in the main screen Main screen can have multiple cam...
Definition: camera.h:59
void resetBorder()
Disable the default border.
unsigned char uint8_t
Definition: core.h:38
Base class for all view renderers View renderer renders one aspect of the view shown on screen...
Definition: rendererbase.h:78
void setBackground(uint8_t br, uint8_t bg, uint8_t bb, uint8_t ba=255)
Set default background quad r,g,b,a values for background.
A basic layer on a map.
Definition: layer.h:99
RenderBackend * getRenderBackend() const
Provides access point to the RenderBackend.
void setColor(uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)
Changes default font color Only useful for .ttf fonts.
Pure abstract Font interface.
Definition: ifont.h:43
FloatingTextRenderer(RenderBackend *renderbackend, int32_t position)
Constructor.
void setFont(IFont *font)
Changes default font in the renderer Note that this does not change the font ownership.
virtual ~FloatingTextRenderer()
Destructor.