TGUI  0.9-beta
BackendRenderTarget.hpp
1 //
3 // TGUI - Texus' Graphical User Interface
4 // Copyright (C) 2012-2020 Bruno Van de Velde (vdv_b@tgui.eu)
5 //
6 // This software is provided 'as-is', without any express or implied warranty.
7 // In no event will the authors be held liable for any damages arising from the use of this software.
8 //
9 // Permission is granted to anyone to use this software for any purpose,
10 // including commercial applications, and to alter it and redistribute it freely,
11 // subject to the following restrictions:
12 //
13 // 1. The origin of this software must not be misrepresented;
14 // you must not claim that you wrote the original software.
15 // If you use this software in a product, an acknowledgment
16 // in the product documentation would be appreciated but is not required.
17 //
18 // 2. Altered source versions must be plainly marked as such,
19 // and must not be misrepresented as being the original software.
20 //
21 // 3. This notice may not be removed or altered from any source distribution.
22 //
24 
25 
26 #ifndef TGUI_BACKEND_RENDER_TARGET_HPP
27 #define TGUI_BACKEND_RENDER_TARGET_HPP
28 
29 #include <TGUI/Rect.hpp>
30 #include <TGUI/Color.hpp>
31 #include <TGUI/Sprite.hpp>
32 #include <TGUI/Text.hpp>
33 #include <TGUI/Outline.hpp>
34 #include <TGUI/RenderStates.hpp>
35 
37 
38 namespace tgui
39 {
40  class Widget;
41  class RootContainer;
42 
43 
47  class TGUI_API BackendRenderTargetBase
48  {
49  public:
50 
54  virtual ~BackendRenderTargetBase() = default;
55 
56 
63  virtual void setView(FloatRect view, FloatRect viewport) = 0;
64 
65 
71  virtual void drawGui(const std::shared_ptr<RootContainer>& root) = 0;
72 
73 
80  virtual void drawWidget(const RenderStates& states, const std::shared_ptr<Widget>& widget) = 0;
81 
82 
93  virtual void addClippingLayer(const RenderStates& states, FloatRect rect) = 0;
94 
95 
101  virtual void removeClippingLayer() = 0;
102 
103 
112  virtual void drawBorders(const RenderStates& states, const Borders& borders, Vector2f size, Color color);
113 
114 
122  virtual void drawFilledRect(const RenderStates& states, Vector2f size, Color color);
123 
124 
131  virtual void drawSprite(const RenderStates& states, const Sprite& sprite) = 0;
132 
133 
140  virtual void drawText(const RenderStates& states, const Text& text) = 0;
141 
142 
154  virtual void drawTriangles(const RenderStates& states, const Vertex* vertices, std::size_t vertexCount, const int* indices = nullptr, std::size_t indexCount = 0) = 0;
155 
156 
166  void drawTriangles(const RenderStates& states, std::initializer_list<Vertex> vertices, std::initializer_list<int> indices = {});
167 
168 
178  virtual void drawCircle(const RenderStates& states, float size, const Color& backgroundColor, float borderThickness = 0, const Color& borderColor = {}) = 0;
179  };
180 
182 }
183 
185 
186 #endif // TGUI_BACKEND_RENDER_TARGET_HPP
virtual void drawCircle(const RenderStates &states, float size, const Color &backgroundColor, float borderThickness=0, const Color &borderColor={})=0
Draws a circle.
virtual ~BackendRenderTargetBase()=default
Virtual destructor.
virtual void drawSprite(const RenderStates &states, const Sprite &sprite)=0
Draws a texture.
virtual void removeClippingLayer()=0
Removes the last added clipping region.
virtual void drawTriangles(const RenderStates &states, const Vertex *vertices, std::size_t vertexCount, const int *indices=nullptr, std::size_t indexCount=0)=0
Draws one or more triangles (using the color that is specified in the vertices)
Namespace that contains all TGUI functions and classes.
Definition: AbsoluteOrRelativeValue.hpp:36
Definition: Text.hpp:44
virtual void setView(FloatRect view, FloatRect viewport)=0
Informs the render target about which part of the window is used for rendering.
Wrapper for colors.
Definition: Color.hpp:52
void drawTriangles(const RenderStates &states, std::initializer_list< Vertex > vertices, std::initializer_list< int > indices={})
Draws one or more triangles (using the color that is specified in the vertices)
Definition: Sprite.hpp:49
virtual void drawWidget(const RenderStates &states, const std::shared_ptr< Widget > &widget)=0
Draws a widget, if the widget is visible.
virtual void drawGui(const std::shared_ptr< RootContainer > &root)=0
Draws the gui and all of its widgets.
Base class for render targets.
Definition: BackendRenderTarget.hpp:48
virtual void drawText(const RenderStates &states, const Text &text)=0
Draws some text.
virtual void drawBorders(const RenderStates &states, const Borders &borders, Vector2f size, Color color)
Draws borders inside a provided rectangle.
Definition: Outline.hpp:39
virtual void drawFilledRect(const RenderStates &states, Vector2f size, Color color)
Draws a colored rectangle.
virtual void addClippingLayer(const RenderStates &states, FloatRect rect)=0
Adds another clipping region.
States used for drawing.
Definition: RenderStates.hpp:39
Definition: Vertex.hpp:37