TGUI
1.1
|
Render target that uses SFML to draw the gui. More...
#include <TGUI/Backend/Renderer/SFML-Graphics/BackendRenderTargetSFML.hpp>
Public Member Functions | |
BackendRenderTargetSFML (sf::RenderTarget &target) | |
Constructs the render target. | |
TGUI_NODISCARD sf::RenderTarget * | getTarget () const |
Returns the SFML render target on which the gui is being drawn. | |
void | setClearColor (const Color &color) override |
Select the color that will be used by clearScreen. | |
void | clearScreen () override |
Clears the screen, called at the beginning of each frame when gui.mainLoop() is called. | |
void | drawGui (const std::shared_ptr< RootContainer > &root) override |
Draws the gui and all of its widgets. | |
void | drawSprite (const RenderStates &states, const Sprite &sprite) override |
Draws a texture. | |
void | drawVertexArray (const RenderStates &states, const Vertex *vertices, std::size_t vertexCount, const unsigned int *indices, std::size_t indexCount, const std::shared_ptr< BackendTexture > &texture) override |
Draws a vertex array. This is called by the other draw functions when they are not overriden. | |
![]() | |
virtual | ~BackendRenderTarget ()=default |
Virtual destructor. | |
virtual void | setView (FloatRect view, FloatRect viewport, Vector2f targetSize) |
Informs the render target about which part of the window is used for rendering. | |
virtual void | drawWidget (const RenderStates &states, const std::shared_ptr< Widget > &widget) |
Draws a widget, if the widget is visible. | |
virtual void | addClippingLayer (const RenderStates &states, FloatRect rect) |
Adds another clipping region. | |
virtual void | removeClippingLayer () |
Removes the last added clipping region. | |
virtual void | drawBorders (const RenderStates &states, const Borders &borders, Vector2f size, Color color) |
Draws borders inside a provided rectangle. | |
virtual void | drawFilledRect (const RenderStates &states, Vector2f size, Color color) |
Draws a colored rectangle. | |
virtual void | drawText (const RenderStates &states, const Text &text) |
Draws some text. | |
virtual void | drawTriangle (const RenderStates &states, const Vertex &point1, const Vertex &point2, const Vertex &point3) |
Draws a single triangles (using the color that is specified in the vertices) | |
virtual void | drawCircle (const RenderStates &states, float size, const Color &backgroundColor, float borderThickness=0, const Color &borderColor={}) |
Draws a circle. | |
virtual void | drawRoundedRectangle (const RenderStates &states, const Vector2f &size, const Color &backgroundColor, float radius, const Borders &borders={0}, const Color &borderColor=Color::Black) |
Draws a rounded rectangle. | |
Protected Member Functions | |
void | updateClipping (FloatRect clipRect, FloatRect clipViewport) override |
Called from addClippingLayer and removeClippingLayer to apply the clipping. | |
TGUI_NODISCARD sf::RenderStates | convertRenderStates (const RenderStates &states, const std::shared_ptr< BackendTexture > &texture) |
Protected Attributes | |
sf::RenderTarget * | m_target = nullptr |
Color | m_clearColor |
![]() | |
FloatRect | m_viewRect |
FloatRect | m_viewport |
Vector2f | m_targetSize |
std::vector< std::pair< FloatRect, FloatRect > > | m_clipLayers |
Vector2f | m_pixelsPerPoint = {1, 1} |
Render target that uses SFML to draw the gui.
tgui::BackendRenderTargetSFML::BackendRenderTargetSFML | ( | sf::RenderTarget & | target | ) |
Constructs the render target.
target | The SFML render target (typically sf::RenderWindow) on which the gui should be drawn |
|
overridevirtual |
Clears the screen, called at the beginning of each frame when gui.mainLoop() is called.
Implements tgui::BackendRenderTarget.
|
overridevirtual |
Draws the gui and all of its widgets.
root | Root container that holds all widgets in the gui |
Implements tgui::BackendRenderTarget.
|
overridevirtual |
Draws a texture.
states | Render states to use for drawing |
sprite | Image to draw |
Reimplemented from tgui::BackendRenderTarget.
|
overridevirtual |
Draws a vertex array. This is called by the other draw functions when they are not overriden.
states | Render states to use for drawing |
vertices | Pointer to first element in array of vertices |
vertexCount | Amount of elements in the vertex array |
indices | Pointer to first element in array of indices |
indexCount | Amount of elements in the indices array |
texture | Texture to use, or nullptr when drawing colored triangles |
Implements tgui::BackendRenderTarget.
TGUI_NODISCARD sf::RenderTarget * tgui::BackendRenderTargetSFML::getTarget | ( | ) | const |
Returns the SFML render target on which the gui is being drawn.
|
overridevirtual |
Select the color that will be used by clearScreen.
color | Background color of the window |
Implements tgui::BackendRenderTarget.
|
overrideprotectedvirtual |
Called from addClippingLayer and removeClippingLayer to apply the clipping.
clipRect | View rectangle to apply |
clipViewport | Viewport to apply |
Both rectangles may be empty when nothing that will be drawn is going to be visible.
Implements tgui::BackendRenderTarget.