Smolgui
Immediate gui library based on SFML
Loading...
Searching...
No Matches
sgui::GuiRender Class Reference

Handle rendering for the gui. More...

#include <GuiRender.h>

Inheritance diagram for sgui::GuiRender:
[legend]

Public Member Functions

void setResources (sf::Texture &sprite)
 Set resources used in render. It should be called before any draw call.
void updateView (const sf::View &newView)
 Update view on which the gui is drawn.
uint32_t setCurrentClippingLayer (const sf::FloatRect &mask)
 Set current clipping layer used to render UI. Every call will create a new layer with its own independent meshes and return its id.
void setTextureAtlas (const TextureAtlas &atlas)
 Set texture atlas used in render. It should be called before any draw call.
void clear ()
 Clear all widgets and text.
void draw (const sf::FloatRect &box, const WidgetDrawOptions &options={})
 interface to draw Gui standard element
void draw (const std::string &text, const sf::Font &font, const TextDrawOptions &options={})
 interface to draw Gui text using utf8
sf::Vector2f textSize (const std::string &text, const sf::Font &font, const uint32_t fontSize) const
 Get text size as if it was drawn on screen.
void setTooltipMode ()
 set specific render for tooltip
void unsetTooltipMode ()
 unset specific render for tooltip
sf::Vector2f textureSize (const std::string &texture) const
 allow access to a texture size, as stored in the atlas

Public Attributes

ClippingLayers clipping
 to handle clipping layers

Detailed Description

Handle rendering for the gui.

Member Function Documentation

◆ clear()

void sgui::GuiRender::clear ( )

Clear all widgets and text.

◆ draw() [1/2]

void sgui::GuiRender::draw ( const sf::FloatRect & box,
const WidgetDrawOptions & options = {} )

interface to draw Gui standard element

Parameters
boxRect of the widget to draw
optionsContains information about Widget type, orientation and state

◆ draw() [2/2]

void sgui::GuiRender::draw ( const std::string & text,
const sf::Font & font,
const TextDrawOptions & options = {} )

interface to draw Gui text using utf8

Parameters
textText to display
fontFont used to display text
optionsContains font size, color and positions of text

◆ setCurrentClippingLayer()

uint32_t sgui::GuiRender::setCurrentClippingLayer ( const sf::FloatRect & mask)

Set current clipping layer used to render UI. Every call will create a new layer with its own independent meshes and return its id.

Returns
Index of the current clipping layer

◆ setResources()

void sgui::GuiRender::setResources ( sf::Texture & sprite)

Set resources used in render. It should be called before any draw call.

Parameters
spriteTexture used

◆ setTextureAtlas()

void sgui::GuiRender::setTextureAtlas ( const TextureAtlas & atlas)

Set texture atlas used in render. It should be called before any draw call.

Parameters
atlasTexture atlas used

◆ setTooltipMode()

void sgui::GuiRender::setTooltipMode ( )

set specific render for tooltip

◆ textSize()

sf::Vector2f sgui::GuiRender::textSize ( const std::string & text,
const sf::Font & font,
const uint32_t fontSize ) const

Get text size as if it was drawn on screen.

Parameters
textText from which we want the size
fontFont of the text
fontSizeSize of the text font
Returns
Size of the text as it would be displayed

◆ textureSize()

sf::Vector2f sgui::GuiRender::textureSize ( const std::string & texture) const

allow access to a texture size, as stored in the atlas

Parameters
textureKey to access texture
Returns
Texture size in the sprite sheet

◆ unsetTooltipMode()

void sgui::GuiRender::unsetTooltipMode ( )

unset specific render for tooltip

◆ updateView()

void sgui::GuiRender::updateView ( const sf::View & newView)

Update view on which the gui is drawn.

Member Data Documentation

◆ clipping

ClippingLayers sgui::GuiRender::clipping

to handle clipping layers


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