TGUI  0.9.5
Loading...
Searching...
No Matches

Backend that uses SFML. More...

#include <TGUI/Backends/SFML/BackendSFML.hpp>

Inheritance diagram for tgui::BackendSFML:
tgui::BackendBase

Classes

struct  GuiResources
 

Public Member Functions

void attachGui (GuiBase *gui) override
 Informs the backend that a new gui object has been created.
 
void detatchGui (GuiBase *gui) override
 Informs the backend that a gui object is being destroyed.
 
Font createDefaultFont () override
 Creates and returns the default font for all widgets.
 
std::shared_ptr< BackendFontBasecreateFont () override
 Creates a new font object.
 
std::shared_ptr< BackendTextBasecreateText () override
 Creates a new text object.
 
std::shared_ptr< BackendTextureBasecreateTexture () override
 Creates a new texture object.
 
void setMouseCursorStyle (Cursor::Type type, const std::uint8_t *pixels, Vector2u size, Vector2u hotspot) override
 Changes the look of a certain mouse cursor by using a bitmap.
 
void resetMouseCursorStyle (Cursor::Type type) override
 Changes the look of a certain mouse cursor back to the system theme.
 
void setMouseCursor (GuiBase *gui, Cursor::Type type) override
 Changes the mouse cursor when the mouse is on top of the window to which the gui is attached.
 
void openVirtualKeyboard (const FloatRect &inputRect) override
 Opens the virtual keyboard on Android and iOS.
 
void closeVirtualKeyboard () override
 Closes the virtual keyboard on Android and iOS.
 
bool isKeyboardModifierPressed (Event::KeyModifier modifierKey) override
 Checks the state for one of the modifier keys.
 
void setClipboard (const String &contents) override
 Changes the contents of the clipboard.
 
String getClipboard () const override
 Returns the contents of the clipboard.
 
std::shared_ptr< BackendRenderTargetSFML > createGuiRenderTarget (GuiSFML *gui, sf::RenderTarget &target)
 Sets the SFML target to which the gui will render and returns a new render target object to interact with.
 
- Public Member Functions inherited from tgui::BackendBase
 BackendBase ()=default
 Default constructor.
 
 BackendBase (const BackendBase &)=delete
 
BackendBaseoperator= (const BackendBase &)=delete
 
virtual ~BackendBase ()=default
 Virtual destructor.
 
void setDestroyOnLastGuiDetatch (bool destroyOnDetatch)
 Informs the backend whether it should destroy itself when the last Gui is detached from it.
 
virtual std::unique_ptr< std::uint8_t[]> readFileFromAndroidAssets (const String &filename, std::size_t &fileSize) const
 Uses the AssetManager on Android to read a file and return its contents.
 

Static Public Member Functions

static bool convertEvent (const sf::Event &eventSFML, Event &eventTGUI)
 Helper function that converts an SFML event to a TGUI event.
 

Protected Member Functions

std::unique_ptr< sf::Cursor > createSystemCursor (Cursor::Type type)
 
void updateMouseCursor (Cursor::Type type, std::unique_ptr< sf::Cursor > cursor)
 
void updateMouseCursor (sf::Window *window, Cursor::Type type)
 

Protected Attributes

std::map< GuiBase *, GuiResources > m_guis
 
std::map< Cursor::Type, std::unique_ptr< sf::Cursor > > m_mouseCursors
 
- Protected Attributes inherited from tgui::BackendBase
bool m_destroyOnLastGuiDetatch = false
 
String m_clipboardContents
 

Detailed Description

Backend that uses SFML.

Member Function Documentation

◆ attachGui()

void tgui::BackendSFML::attachGui ( GuiBase gui)
overridevirtual

Informs the backend that a new gui object has been created.

Parameters
guiNewly created gui

Implements tgui::BackendBase.

◆ closeVirtualKeyboard()

void tgui::BackendSFML::closeVirtualKeyboard ( )
overridevirtual

Closes the virtual keyboard on Android and iOS.

Implements tgui::BackendBase.

◆ convertEvent()

static bool tgui::BackendSFML::convertEvent ( const sf::Event &  eventSFML,
Event eventTGUI 
)
static

Helper function that converts an SFML event to a TGUI event.

Parameters
eventSFMLThe input SFML event
eventTGUIThe output TGUI event
Returns
Did the SFML event match on a TGUI event and has the output event been written to?

◆ createDefaultFont()

Font tgui::BackendSFML::createDefaultFont ( )
overridevirtual

Creates and returns the default font for all widgets.

Returns
Default font

Implements tgui::BackendBase.

◆ createFont()

std::shared_ptr< BackendFontBase > tgui::BackendSFML::createFont ( )
overridevirtual

Creates a new font object.

Returns
Font that is specific to the backend

Implements tgui::BackendBase.

◆ createGuiRenderTarget()

std::shared_ptr< BackendRenderTargetSFML > tgui::BackendSFML::createGuiRenderTarget ( GuiSFML gui,
sf::RenderTarget &  target 
)

Sets the SFML target to which the gui will render and returns a new render target object to interact with.

Parameters
guiThe gui for which the render target should be created
targetSFML render target to draw on
Returns
Render target that abstracts the SFML drawing code

◆ createText()

std::shared_ptr< BackendTextBase > tgui::BackendSFML::createText ( )
overridevirtual

Creates a new text object.

Returns
Text that is specific to the backend

Implements tgui::BackendBase.

◆ createTexture()

std::shared_ptr< BackendTextureBase > tgui::BackendSFML::createTexture ( )
overridevirtual

Creates a new texture object.

Returns
Texture that is specific to the backend

Implements tgui::BackendBase.

◆ detatchGui()

void tgui::BackendSFML::detatchGui ( GuiBase gui)
overridevirtual

Informs the backend that a gui object is being destroyed.

Parameters
guiGui object that is about to be deconstructed

Implements tgui::BackendBase.

◆ getClipboard()

String tgui::BackendSFML::getClipboard ( ) const
overridevirtual

Returns the contents of the clipboard.

Returns
Clipboard contents

Reimplemented from tgui::BackendBase.

◆ isKeyboardModifierPressed()

bool tgui::BackendSFML::isKeyboardModifierPressed ( Event::KeyModifier  modifierKey)
overridevirtual

Checks the state for one of the modifier keys.

Parameters
modifierKeyThe modifier key of which the state is being queried
Returns
Whether queries modifier key is being pressed

Implements tgui::BackendBase.

◆ openVirtualKeyboard()

void tgui::BackendSFML::openVirtualKeyboard ( const FloatRect inputRect)
overridevirtual

Opens the virtual keyboard on Android and iOS.

Parameters
inputRectPart of the screen where the text input is located

Implements tgui::BackendBase.

◆ resetMouseCursorStyle()

void tgui::BackendSFML::resetMouseCursorStyle ( Cursor::Type  type)
overridevirtual

Changes the look of a certain mouse cursor back to the system theme.

Parameters
typeCursor that should no longer use a custom bitmap

Implements tgui::BackendBase.

◆ setClipboard()

void tgui::BackendSFML::setClipboard ( const String contents)
overridevirtual

Changes the contents of the clipboard.

Parameters
contentsNew contents of the clipboard

Reimplemented from tgui::BackendBase.

◆ setMouseCursor()

void tgui::BackendSFML::setMouseCursor ( GuiBase gui,
Cursor::Type  type 
)
overridevirtual

Changes the mouse cursor when the mouse is on top of the window to which the gui is attached.

Parameters
guiThe gui that represents the window for which the mouse cursor should be changed
typeWhich cursor to use

Implements tgui::BackendBase.

◆ setMouseCursorStyle()

void tgui::BackendSFML::setMouseCursorStyle ( Cursor::Type  type,
const std::uint8_t *  pixels,
Vector2u  size,
Vector2u  hotspot 
)
overridevirtual

Changes the look of a certain mouse cursor by using a bitmap.

Parameters
typeCursor that should make use of the bitmap
pixelsPointer to an array with 4*size.x*size.y elements, representing the pixels in 32-bit RGBA format
sizeSize of the cursor
hotspotPixel coordinate within the cursor image which will be located exactly at the mouse pointer position

Implements tgui::BackendBase.


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