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

Backend that uses SDL. More...

#include <TGUI/Backends/SDL/BackendSDL.hpp>

Inheritance diagram for tgui::BackendSDL:
tgui::BackendBase

Public Member Functions

 BackendSDL ()
 Default constructor.
 
 ~BackendSDL ()
 Destructor.
 
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< BackendRenderTargetSDL > createGuiRenderTarget (GuiSDL *gui, SDL_Window *window)
 Sets the SDL window to which the gui will render and returns a new render target object to interact with.
 
void changeTexture (GLuint textureId, bool force)
 Changes the bound texture if another texture was currently set.
 
- 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 SDL_Event &eventSDL, Event &eventTGUI)
 Helper function that converts an SDL event to a TGUI event.
 

Additional Inherited Members

- Protected Attributes inherited from tgui::BackendBase
bool m_destroyOnLastGuiDetatch = false
 
String m_clipboardContents
 

Detailed Description

Backend that uses SDL.

Member Function Documentation

◆ attachGui()

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

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

Parameters
guiNewly created gui

Implements tgui::BackendBase.

◆ changeTexture()

void tgui::BackendSDL::changeTexture ( GLuint  textureId,
bool  force 
)

Changes the bound texture if another texture was currently set.

Parameters
textureIdTexture to pass to glBindTexture
forceCall glBindTexture even if the id was still the same. This is required when calling this function after creating a new texture, as it could be reusing the id that was previously cached.

This function has to be used instead of glBindTexture so that the backend knows the last used texture

◆ closeVirtualKeyboard()

void tgui::BackendSDL::closeVirtualKeyboard ( )
overridevirtual

Closes the virtual keyboard on Android and iOS.

Implements tgui::BackendBase.

◆ convertEvent()

static bool tgui::BackendSDL::convertEvent ( const SDL_Event &  eventSDL,
Event eventTGUI 
)
static

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

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

◆ createDefaultFont()

Font tgui::BackendSDL::createDefaultFont ( )
overridevirtual

Creates and returns the default font for all widgets.

Returns
Default font

Implements tgui::BackendBase.

◆ createFont()

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

Creates a new font object.

Returns
Font that is specific to the backend

Implements tgui::BackendBase.

◆ createGuiRenderTarget()

std::shared_ptr< BackendRenderTargetSDL > tgui::BackendSDL::createGuiRenderTarget ( GuiSDL gui,
SDL_Window *  window 
)

Sets the SDL window 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
windowSDL window to draw on
Returns
Render target that abstracts the SDL drawing code

◆ createText()

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

Creates a new text object.

Returns
Text that is specific to the backend

Implements tgui::BackendBase.

◆ createTexture()

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

Creates a new texture object.

Returns
Texture that is specific to the backend

Implements tgui::BackendBase.

◆ detatchGui()

void tgui::BackendSDL::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::BackendSDL::getClipboard ( ) const
overridevirtual

Returns the contents of the clipboard.

Returns
Clipboard contents

Reimplemented from tgui::BackendBase.

◆ isKeyboardModifierPressed()

bool tgui::BackendSDL::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::BackendSDL::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::BackendSDL::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::BackendSDL::setClipboard ( const String contents)
overridevirtual

Changes the contents of the clipboard.

Parameters
contentsNew contents of the clipboard

Reimplemented from tgui::BackendBase.

◆ setMouseCursor()

void tgui::BackendSDL::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::BackendSDL::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: