TGUI
1.6.1
|
Base class for render targets. More...
#include <TGUI/Backend/Renderer/BackendRenderTarget.hpp>
Public Member Functions | |
BackendRenderTarget (const BackendRenderTarget &)=delete | |
BackendRenderTarget (BackendRenderTarget &&)=delete | |
BackendRenderTarget & | operator= (const BackendRenderTarget &)=delete |
BackendRenderTarget & | operator= (BackendRenderTarget &&)=delete |
BackendRenderTarget ()=default | |
Default constructor. | |
virtual | ~BackendRenderTarget ()=default |
Virtual destructor. | |
virtual void | setClearColor (const Color &color)=0 |
Select the color that will be used by clearScreen. | |
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. | |
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) |
Draws a texture. | |
virtual void | drawText (const RenderStates &states, const Text &text) |
Draws some text. | |
virtual void | drawTextOutline (const RenderStates &states, const Text &text) |
Draws only the outline of some text. | |
virtual void | drawTextWithoutOutline (const RenderStates &states, const Text &text) |
Draws some text, but without rendering its outline. | |
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. | |
virtual 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)=0 |
Draws a vertex array. This is called by the other draw functions when they are not overriden. | |
Vector2f | getPixelsPerPoint () const |
Returns the current mapping between the screen pixels and the points in the current view. | |
Protected Member Functions | |
virtual void | updateClipping (FloatRect clipRect, FloatRect clipViewport)=0 |
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 |
Vector2f | m_pixelsPerPoint = {1, 1} |
Base class for render targets.
|
virtual |
Adds another clipping region.
states | Render states to use for drawing |
rect | The clipping region |
If multiple clipping regions were added then contents is only shown in the intersection of all regions.
|
pure virtual |
Clears the screen, called at the beginning of each frame when gui.mainLoop() is called.
Implemented in tgui::BackendRenderTargetGLES2, tgui::BackendRenderTargetOpenGL3, tgui::BackendRenderTargetRaylib, tgui::BackendRenderTargetSDL, and tgui::BackendRenderTargetSFML.
|
virtual |
Draws borders inside a provided rectangle.
states | Render states to use for drawing |
borders | The size of the borders on each side |
size | The size of the rectangle in which borders will be drawn |
color | Color of the borders |
|
virtual |
Draws a circle.
|
virtual |
Draws a colored rectangle.
states | Render states to use for drawing |
size | Size of the rectangle |
color | Color of the rectangle |
|
pure virtual |
Draws the gui and all of its widgets.
root | Root container that holds all widgets in the gui |
Implemented in tgui::BackendRenderTargetGLES2, tgui::BackendRenderTargetOpenGL3, tgui::BackendRenderTargetRaylib, tgui::BackendRenderTargetSDL, and tgui::BackendRenderTargetSFML.
|
virtual |
Draws a rounded rectangle.
states | Render states to use for drawing |
size | Size of the rectangle (includes borders) |
backgroundColor | Fill color of the rectangle |
radius | Radius of the rounded corners |
borders | Optional borders on the sides of the rectangle (must be the same on all sides) |
borderColor | Color of the borders |
|
virtual |
Draws a texture.
states | Render states to use for drawing |
sprite | Image to draw |
Reimplemented in tgui::BackendRenderTargetSFML.
|
virtual |
Draws some text.
states | Render states to use for drawing |
text | Text to draw |
This function does the same as calling both drawTextOutline and drawTextWithoutOutline.
|
virtual |
Draws only the outline of some text.
states | Render states to use for drawing |
text | Text to draw |
This function should always be called prior to drawTextWithoutOutline. It exists to allow rendering the outline of multiple texts before rendering all these texts, which is done by calling drawTextOutline for each text before calling drawTextWithoutOutline on all the same text objects.
|
virtual |
Draws some text, but without rendering its outline.
states | Render states to use for drawing |
text | Text to draw |
This function should always be called after drawTextOutline. It exists to allow rendering the outline of multiple texts before rendering all these texts, which is done by calling drawTextOutline for each text before calling drawTextWithoutOutline on all the same text objects.
|
virtual |
Draws a single triangles (using the color that is specified in the vertices)
states | Render states to use for drawing |
point1 | First point of the triangle |
point2 | Second point of the triangle |
point3 | Third point of the triangle |
To draw multiple triangles at once, optionally with a texture, use the drawVertexArray function.
|
pure virtual |
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 |
Implemented in tgui::BackendRenderTargetGLES2, tgui::BackendRenderTargetOpenGL3, tgui::BackendRenderTargetRaylib, tgui::BackendRenderTargetSDL, and tgui::BackendRenderTargetSFML.
|
virtual |
Draws a widget, if the widget is visible.
states | Render states to use for drawing |
widget | The widget to draw |
|
nodiscard |
Returns the current mapping between the screen pixels and the points in the current view.
Example when rounding rendering to the nearest pixel:
|
virtual |
Removes the last added clipping region.
|
pure virtual |
Select the color that will be used by clearScreen.
color | Background color of the window |
Implemented in tgui::BackendRenderTargetGLES2, tgui::BackendRenderTargetOpenGL3, tgui::BackendRenderTargetRaylib, tgui::BackendRenderTargetSDL, and tgui::BackendRenderTargetSFML.
|
virtual |
Informs the render target about which part of the window is used for rendering.
view | Defines which part of the gui is being shown |
viewport | Defines which part of the window is being rendered to |
targetSize | Size of the window |
Reimplemented in tgui::BackendRenderTargetGLES2, tgui::BackendRenderTargetOpenGL3, tgui::BackendRenderTargetRaylib, and tgui::BackendRenderTargetSDL.
|
protectedpure virtual |
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.
Implemented in tgui::BackendRenderTargetGLES2, tgui::BackendRenderTargetOpenGL3, tgui::BackendRenderTargetRaylib, tgui::BackendRenderTargetSDL, and tgui::BackendRenderTargetSFML.