TGUI  0.9-dev
tgui::BackendRenderTargetSFML Class Reference

Render target that uses SFML to draw the gui. More...

#include </home/texus/Documents/TGUI-0.9/include/TGUI/Backend/Renderer/SFML-Graphics/BackendRenderTargetSFML.hpp>

Inheritance diagram for tgui::BackendRenderTargetSFML:
tgui::BackendRenderTarget

Public Member Functions

 BackendRenderTargetSFML (sf::RenderTarget &target)
 Constructs the render target. More...
 
sf::RenderTarget * getTarget () const
 Returns the SFML render target on which the gui is being drawn. More...
 
void setClearColor (const Color &color) override
 Select the color that will be used by clearScreen. More...
 
void clearScreen () override
 Clears the screen, called at the beginning of each frame when gui.mainLoop() is called.
 
void setView (FloatRect view, FloatRect viewport) override
 Informs the render target about which part of the window is used for rendering. More...
 
void drawGui (const std::shared_ptr< RootContainer > &root) override
 Draws the gui and all of its widgets. More...
 
void addClippingLayer (const RenderStates &states, FloatRect rect) override
 Adds another clipping region. More...
 
void removeClippingLayer () override
 Removes the last added clipping region. More...
 
void drawSprite (const RenderStates &states, const Sprite &sprite) override
 Draws a texture. More...
 
void drawVertexArray (const RenderStates &states, const Vertex *vertices, std::size_t vertexCount, const 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. More...
 
virtual void setView (FloatRect view, FloatRect viewport)
 Informs the render target about which part of the window is used for rendering. More...
 
virtual void setView (FloatRect view, FloatRect viewport, Vector2f targetSize)
 Informs the render target about which part of the window is used for rendering. More...
 
- Public Member Functions inherited from tgui::BackendRenderTarget
virtual ~BackendRenderTarget ()=default
 Virtual destructor.
 
virtual void drawWidget (const RenderStates &states, const std::shared_ptr< Widget > &widget)
 Draws a widget, if the widget is visible. More...
 
virtual void drawBorders (const RenderStates &states, const Borders &borders, Vector2f size, Color color)
 Draws borders inside a provided rectangle. More...
 
virtual void drawFilledRect (const RenderStates &states, Vector2f size, Color color)
 Draws a colored rectangle. More...
 
virtual void drawText (const RenderStates &states, const Text &text)
 Draws some text. More...
 
virtual void drawTriangles (const RenderStates &states, const Vertex *vertices, std::size_t vertexCount, const int *indices=nullptr, std::size_t indexCount=0)
 Draws one or more triangles (using the color that is specified in the vertices) More...
 
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) More...
 
virtual void drawCircle (const RenderStates &states, float size, const Color &backgroundColor, float borderThickness=0, const Color &borderColor={})
 Draws a circle. More...
 
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. More...
 

Protected Member Functions

void updateClipping (FloatRect clipRect, FloatRect clipViewport) override
 Called from addClippingLayer and removeClippingLayer to apply the clipping. More...
 

Detailed Description

Render target that uses SFML to draw the gui.

Constructor & Destructor Documentation

◆ BackendRenderTargetSFML()

tgui::BackendRenderTargetSFML::BackendRenderTargetSFML ( sf::RenderTarget &  target)

Constructs the render target.

Parameters
targetThe SFML render target (typically sf::RenderWindow) on which the gui should be drawn

Member Function Documentation

◆ addClippingLayer()

void tgui::BackendRenderTargetSFML::addClippingLayer ( const RenderStates states,
FloatRect  rect 
)
overridevirtual

Adds another clipping region.

Parameters
statesRender states to use for drawing
rectThe clipping region

If multiple clipping regions were added then contents is only shown in the intersection of all regions.

Warning
Every call to addClippingLayer must have a matching call to removeClippingLayer.

Reimplemented from tgui::BackendRenderTarget.

◆ drawGui()

void tgui::BackendRenderTargetSFML::drawGui ( const std::shared_ptr< RootContainer > &  root)
overridevirtual

Draws the gui and all of its widgets.

Parameters
rootRoot container that holds all widgets in the gui

Implements tgui::BackendRenderTarget.

◆ drawSprite()

void tgui::BackendRenderTargetSFML::drawSprite ( const RenderStates states,
const Sprite sprite 
)
overridevirtual

Draws a texture.

Parameters
statesRender states to use for drawing
spriteImage to draw

Reimplemented from tgui::BackendRenderTarget.

◆ drawVertexArray()

void tgui::BackendRenderTargetSFML::drawVertexArray ( const RenderStates states,
const Vertex vertices,
std::size_t  vertexCount,
const int *  indices,
std::size_t  indexCount,
const std::shared_ptr< BackendTexture > &  texture 
)
overridevirtual

Draws a vertex array. This is called by the other draw functions when they are not overriden.

Parameters
statesRender states to use for drawing
verticesPointer to first element in array of vertices
vertexCountAmount of elements in the vertex array
indicesPointer to first element in array of indices
indexCountAmount of elements in the indices array
textureTexture to use, or nullptr when drawing colored triangles

Reimplemented from tgui::BackendRenderTarget.

◆ getTarget()

sf::RenderTarget * tgui::BackendRenderTargetSFML::getTarget ( ) const

Returns the SFML render target on which the gui is being drawn.

Returns
The SFML render target that is used by the gui

◆ removeClippingLayer()

void tgui::BackendRenderTargetSFML::removeClippingLayer ( )
overridevirtual

Removes the last added clipping region.

Warning
The addClippingLayer function must have been called before calling this function.

Reimplemented from tgui::BackendRenderTarget.

◆ setClearColor()

void tgui::BackendRenderTargetSFML::setClearColor ( const Color color)
overridevirtual

Select the color that will be used by clearScreen.

Parameters
colorBackground color of the window

Reimplemented from tgui::BackendRenderTarget.

◆ setView() [1/3]

virtual void tgui::BackendRenderTarget::setView ( FloatRect  view,
FloatRect  viewport 
)
virtual

Informs the render target about which part of the window is used for rendering.

Parameters
viewDefines which part of the gui is being shown
viewportDefines which part of the window is being rendered to

Reimplemented from tgui::BackendRenderTarget.

◆ setView() [2/3]

void tgui::BackendRenderTargetSFML::setView ( FloatRect  view,
FloatRect  viewport 
)
overridevirtual

Informs the render target about which part of the window is used for rendering.

Parameters
viewDefines which part of the gui is being shown
viewportDefines which part of the window is being rendered to

Reimplemented from tgui::BackendRenderTarget.

◆ setView() [3/3]

virtual void tgui::BackendRenderTarget::setView ( FloatRect  view,
FloatRect  viewport,
Vector2f  targetSize 
)
virtual

Informs the render target about which part of the window is used for rendering.

Parameters
viewDefines which part of the gui is being shown
viewportDefines which part of the window is being rendered to
targetSizeSize of the window

Reimplemented from tgui::BackendRenderTarget.

◆ updateClipping()

void tgui::BackendRenderTargetSFML::updateClipping ( FloatRect  clipRect,
FloatRect  clipViewport 
)
overrideprotectedvirtual

Called from addClippingLayer and removeClippingLayer to apply the clipping.

Parameters
clipRectView rectangle to apply
clipViewportViewport to apply

Both rectangles may be empty when nothing that will be drawn is going to be visible.

Reimplemented from tgui::BackendRenderTarget.


The documentation for this class was generated from the following file: