TGUI  0.9.5
Loading...
Searching...
No Matches
tgui::BackendRenderTargetBase Class Referenceabstract

Base class for render targets. More...

#include <TGUI/BackendRenderTarget.hpp>

Public Member Functions

virtual ~BackendRenderTargetBase ()=default
 Virtual destructor.
 
virtual void setView (FloatRect view, FloatRect viewport)
 Informs the render target about which part of the window is used for rendering.
 
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 drawGui (const std::shared_ptr< RootContainer > &root)=0
 Draws the gui and all of its widgets.
 
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 drawSprite (const RenderStates &states, const Sprite &sprite)=0
 Draws a texture.
 
virtual void drawText (const RenderStates &states, const Text &text)=0
 Draws some text.
 
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)
 
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)
 
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

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

Protected Attributes

FloatRect m_viewRect
 
FloatRect m_viewport
 
Vector2f m_targetSize
 
std::vector< std::pair< FloatRect, FloatRect > > m_clipLayers
 

Detailed Description

Base class for render targets.

Member Function Documentation

◆ addClippingLayer()

virtual void tgui::BackendRenderTargetBase::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::BackendRenderTargetBase::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::BackendRenderTargetBase::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::BackendRenderTargetBase::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::BackendRenderTargetBase::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

◆ drawRoundedRectangle()

virtual void tgui::BackendRenderTargetBase::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::BackendRenderTargetBase::drawSprite ( const RenderStates states,
const Sprite sprite 
)
pure virtual

Draws a texture.

Parameters
statesRender states to use for drawing
spriteImage to draw

◆ drawText()

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

Draws some text.

Parameters
statesRender states to use for drawing
textText to draw

◆ drawTriangles() [1/2]

virtual void tgui::BackendRenderTargetBase::drawTriangles ( const RenderStates states,
const Vertex vertices,
std::size_t  vertexCount,
const int *  indices = nullptr,
std::size_t  indexCount = 0 
)
pure virtual

Draws one or more triangles (using the color that is specified in the vertices)

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

If indices is a nullptr then vertexCount must be a multiple of 3 and each set of 3 vertices will be seen as a triangle.

◆ drawTriangles() [2/2]

void tgui::BackendRenderTargetBase::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.

◆ drawWidget()

virtual void tgui::BackendRenderTargetBase::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::BackendRenderTargetBase::removeClippingLayer ( )
virtual

Removes the last added clipping region.

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

◆ setView() [1/2]

virtual void tgui::BackendRenderTargetBase::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

◆ setView() [2/2]

virtual void tgui::BackendRenderTargetBase::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

◆ updateClipping()

virtual void tgui::BackendRenderTargetBase::updateClipping ( FloatRect  clipRect,
FloatRect  clipViewport 
)
inlineprotectedvirtual

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.


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