TGUI  0.10-dev
tgui::BackendRenderTarget Class Referenceabstract

Base class for render targets. More...

#include <TGUI/Backend/Renderer/BackendRenderTarget.hpp>

Inheritance diagram for tgui::BackendRenderTarget:
tgui::BackendRenderTargetGLES2 tgui::BackendRenderTargetOpenGL3 tgui::BackendRenderTargetSDL tgui::BackendRenderTargetSFML

Public Member Functions

virtual ~BackendRenderTarget ()=default
 Virtual destructor.
 
virtual void setClearColor (const tgui::Color &color)=0
 Select the color that will be used by clearScreen. More...
 
virtual void clearScreen ()=0
 Clears the screen, called at the beginning of each frame when gui.mainLoop() is called.
 
virtual void setView (FloatRect view, FloatRect viewport, Vector2f targetSize)
 Informs the render target about which part of the window is used for rendering. More...
 
virtual void drawGui (const std::shared_ptr< RootContainer > &root)=0
 Draws the gui and all of its widgets. More...
 
virtual void drawWidget (const RenderStates &states, const std::shared_ptr< Widget > &widget)
 Draws a widget, if the widget is visible. More...
 
virtual void addClippingLayer (const RenderStates &states, FloatRect rect)
 Adds another clipping region. More...
 
virtual void removeClippingLayer ()
 Removes the last added clipping region. 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 drawSprite (const RenderStates &states, const Sprite &sprite)
 Draws a texture. More...
 
virtual void drawText (const RenderStates &states, const Text &text)
 Draws some text. 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...
 
virtual 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)=0
 Draws a vertex array. This is called by the other draw functions when they are not overriden. More...
 

Protected Member Functions

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

Detailed Description

Base class for render targets.

Member Function Documentation

◆ addClippingLayer()

virtual void tgui::BackendRenderTarget::addClippingLayer ( const RenderStates states,
FloatRect  rect 
)
virtual

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.

◆ drawBorders()

virtual void tgui::BackendRenderTarget::drawBorders ( const RenderStates states,
const Borders borders,
Vector2f  size,
Color  color 
)
virtual

Draws borders inside a provided rectangle.

Parameters
statesRender states to use for drawing
bordersThe size of the borders on each side
sizeThe size of the rectangle in which borders will be drawn
colorColor of the borders

◆ drawCircle()

virtual void tgui::BackendRenderTarget::drawCircle ( const RenderStates states,
float  size,
const Color backgroundColor,
float  borderThickness = 0,
const Color borderColor = {} 
)
virtual

Draws a circle.

Parameters
statesRender states to use for drawing
sizeDiameter of the circle
backgroundColorColor to fill the circle with
borderThicknessThickness of the border to draw around the circle (outside given size if thickness is positive)
borderColorColor of the border, if borderThickness differs from 0

◆ drawFilledRect()

virtual void tgui::BackendRenderTarget::drawFilledRect ( const RenderStates states,
Vector2f  size,
Color  color 
)
virtual

Draws a colored rectangle.

Parameters
statesRender states to use for drawing
sizeSize of the rectangle
colorColor of the rectangle

◆ drawGui()

virtual void tgui::BackendRenderTarget::drawGui ( const std::shared_ptr< RootContainer > &  root)
pure virtual

Draws the gui and all of its widgets.

Parameters
rootRoot container that holds all widgets in the gui

Implemented in tgui::BackendRenderTargetGLES2, tgui::BackendRenderTargetOpenGL3, tgui::BackendRenderTargetSDL, and tgui::BackendRenderTargetSFML.

◆ drawRoundedRectangle()

virtual void tgui::BackendRenderTarget::drawRoundedRectangle ( const RenderStates states,
const Vector2f size,
const Color backgroundColor,
float  radius,
const Borders borders = {0},
const Color borderColor = Color::Black 
)
virtual

Draws a rounded rectangle.

Parameters
statesRender states to use for drawing
sizeSize of the rectangle (includes borders)
backgroundColorFill color of the rectangle
radiusRadius of the rounded corners
bordersOptional borders on the sides of the rectangle (must be the same on all sides)
borderColorColor of the borders

◆ drawSprite()

virtual void tgui::BackendRenderTarget::drawSprite ( const RenderStates states,
const Sprite sprite 
)
virtual

Draws a texture.

Parameters
statesRender states to use for drawing
spriteImage to draw

Reimplemented in tgui::BackendRenderTargetSFML.

◆ drawText()

virtual void tgui::BackendRenderTarget::drawText ( const RenderStates states,
const Text text 
)
virtual

Draws some text.

Parameters
statesRender states to use for drawing
textText to draw

◆ drawTriangles()

void tgui::BackendRenderTarget::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)

Parameters
statesRender states to use for drawing
verticesArray of vertices
indicesOptional array of indices

This function is provided for convenience and just calls the other drawTriangles function.

◆ drawVertexArray()

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

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

Implemented in tgui::BackendRenderTargetGLES2, tgui::BackendRenderTargetOpenGL3, tgui::BackendRenderTargetSDL, and tgui::BackendRenderTargetSFML.

◆ drawWidget()

virtual void tgui::BackendRenderTarget::drawWidget ( const RenderStates states,
const std::shared_ptr< Widget > &  widget 
)
virtual

Draws a widget, if the widget is visible.

Parameters
statesRender states to use for drawing
widgetThe widget to draw

◆ removeClippingLayer()

virtual void tgui::BackendRenderTarget::removeClippingLayer ( )
virtual

Removes the last added clipping region.

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

◆ setClearColor()

virtual void tgui::BackendRenderTarget::setClearColor ( const tgui::Color color)
pure virtual

Select the color that will be used by clearScreen.

Parameters
colorBackground color of the window

Implemented in tgui::BackendRenderTargetGLES2, tgui::BackendRenderTargetOpenGL3, tgui::BackendRenderTargetSDL, and tgui::BackendRenderTargetSFML.

◆ setView()

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 in tgui::BackendRenderTargetGLES2, tgui::BackendRenderTargetOpenGL3, and tgui::BackendRenderTargetSDL.

◆ updateClipping()

virtual void tgui::BackendRenderTarget::updateClipping ( FloatRect  clipRect,
FloatRect  clipViewport 
)
protectedpure virtual

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.

Implemented in tgui::BackendRenderTargetGLES2, tgui::BackendRenderTargetOpenGL3, tgui::BackendRenderTargetSDL, and tgui::BackendRenderTargetSFML.


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