TGUI  0.10-beta
tgui Namespace Reference

Namespace that contains all TGUI functions and classes. More...

Classes

class  AbsoluteOrRelativeValue
 Class to store the a value that is either a constant or a ratio. More...
 
class  Backend
 Base class for the backend. More...
 
class  BackendFont
 Base class for font implementations that depend on the backend. More...
 
class  BackendFontFactory
 Base class for the font factory that is responsible for creating a font object specific to the font backend. More...
 
class  BackendFontFactoryImpl
 Class that creates font objects of a given type. More...
 
class  BackendFontFreetype
 Font implementations that uses FreeType directly to load glyphs. More...
 
class  BackendFontSDLttf
 Font implementations that uses SDL_ttf to load glyphs. More...
 
class  BackendFontSFML
 Font implementation that makes use of SFML. More...
 
class  BackendGLFW
 
class  BackendGui
 Base class for the Gui. More...
 
class  BackendGuiGLFW
 
class  BackendGuiSDL
 
class  BackendGuiSFML
 
class  BackendRenderer
 Base class for the backend renderer, which is responsible for creating text and texture objects. More...
 
class  BackendRendererGLES2
 Backend renderer that uses OpenGL ES 2 or 3 (depending on the loaded OpenGL ES context that you have to provide) More...
 
class  BackendRendererOpenGL3
 Backend renderer that uses OpenGL 3 or 4 (depending on the loaded OpenGL context that you have to provide) More...
 
class  BackendRendererSDL
 Backend renderer that uses SDL_Renderer. More...
 
class  BackendRendererSFML
 Backend renderer that uses sfml-graphics. More...
 
class  BackendRenderTarget
 Base class for render targets. More...
 
class  BackendRenderTargetGLES2
 Render target implementation that makes use of OpenGL ES. More...
 
class  BackendRenderTargetOpenGL3
 Render target implementation that makes use of modern OpenGL. More...
 
class  BackendRenderTargetSDL
 Render target implementation that makes use of SDL_Renderer. More...
 
class  BackendRenderTargetSFML
 Render target that uses SFML to draw the gui. More...
 
class  BackendSDL
 
class  BackendSFML
 
class  BackendText
 Base class for text implementations that depend on the backend. More...
 
class  BackendTexture
 Base class for texture implementations that depend on the backend. More...
 
class  BackendTextureGLES2
 Texture implementation that makes use of modern OpenGL ES. More...
 
class  BackendTextureOpenGL3
 Texture implementation that makes use of modern OpenGL. More...
 
class  BackendTextureSDL
 Texture implementation that makes use of SDL_Texture. More...
 
class  BackendTextureSFML
 Texture implementation that makes use of SFML. More...
 
class  BaseThemeLoader
 Base class for theme loader implementations. More...
 
class  BitmapButton
 Button widget with an image displayed next to the text (or centered in the button without text) More...
 
class  BoxLayout
 Abstract class for box layout containers. More...
 
class  BoxLayoutRatios
 Abstract class for box layout containers. More...
 
class  BoxLayoutRenderer
 
class  Button
 Button widget. More...
 
class  ButtonBase
 Base class for button widgets. More...
 
class  ButtonRenderer
 
class  CanvasGLES2
 
class  CanvasOpenGL3
 
class  CanvasSDL
 
class  CanvasSFML
 
class  ChatBox
 
class  ChatBoxRenderer
 
class  CheckBox
 CheckBox widget. More...
 
class  CheckBoxRenderer
 
class  ChildWindow
 Child window widget. More...
 
class  ChildWindowRenderer
 
class  ClickableWidget
 Clickable widget. More...
 
class  Color
 Wrapper for colors. More...
 
class  ColorPicker
 Color picker widget. More...
 
class  ColorPickerRenderer
 
class  ComboBox
 Combo box widget. More...
 
class  ComboBoxRenderer
 
class  Container
 Container widget. More...
 
class  CopiedSharedPtr
 
class  Cursor
 Class that allows the cursor to be changed. More...
 
class  CustomWidgetForBindings
 Class used by bindings to implement custom widgets withing these bindings (e.g. a custom C# widget in TGUI.Net) More...
 
class  DataIO
 Parser and emitter for widget files.
 
class  DefaultBackendWindow
 This class abstracts the backend-specific window and gui creation code. More...
 
class  DefaultThemeLoader
 Default implementation for theme loading. More...
 
class  Deserializer
 Deserializes a settable property. More...
 
class  Duration
 Wrapper for durations. More...
 
class  EditBox
 Edit box widget. More...
 
class  EditBoxRenderer
 
struct  Event
 
class  Exception
 
class  FileDialog
 File dialog widget. More...
 
class  FileDialogIconLoader
 
class  FileDialogRenderer
 
class  Filesystem
 Helper functionality for filesystem access. More...
 
class  Font
 
struct  FontGlyph
 Information about a glyph in the font. More...
 
class  Grid
 
class  Group
 Group widget. More...
 
class  GroupRenderer
 
class  Gui
 Gui class for GLFW + GLES2 backend (using FreeType for fonts) More...
 
class  HorizontalLayout
 Container that automatically resizes children to fit the entire available space between children. More...
 
class  HorizontalWrap
 Container that automatically arranges children in lines, adding a new line when a horizontal line is full. More...
 
struct  ImageLoader
 Class that is internally used to load an image from a file or from memory. More...
 
class  Knob
 Knob widget. More...
 
class  KnobRenderer
 
class  Label
 Label widget. More...
 
class  LabelRenderer
 
class  Layout
 Class to store the left, top, width or height of a widget. More...
 
class  Layout2d
 Class to store the position or size of a widget. More...
 
class  ListBox
 List box widget. More...
 
class  ListBoxRenderer
 
class  ListView
 List view widget. More...
 
class  ListViewRenderer
 
class  MenuBar
 Menu bar widget. More...
 
class  MenuBarMenuPlaceholder
 Widget that is added to a container when the user clicks on the menu bar. This widget will be added in front of all other widgets to ensure that the menus from the menu bar are always drawn in front of other widgets. More...
 
class  MenuBarRenderer
 Renderer for the MenuBar widget. More...
 
class  MessageBox
 Message box widget. More...
 
class  MessageBoxRenderer
 
class  ObjectConverter
 Implicit converter for settable properties. More...
 
class  Outline
 
class  Panel
 Group of widgets that has a background color and optional borders. More...
 
class  PanelRenderer
 
class  Picture
 Picture widget. More...
 
class  PictureRenderer
 
class  ProgressBar
 Progress bar widget. More...
 
class  ProgressBarRenderer
 
class  RadioButton
 Radio button widget. More...
 
class  RadioButtonGroup
 Can be used as parent of radio buttons so that different groups of radio buttons can be isolated. More...
 
class  RadioButtonRenderer
 
class  RangeSlider
 RangeSlider widget. More...
 
class  RangeSliderRenderer
 
class  Rect
 
struct  RelativeValue
 Helper class to create an AbsoluteOrRelativeValue object containing a relative value without using a string. More...
 
struct  RelFloatRect
 FloatRect that can contain absolute values or values relative to the parent size. More...
 
struct  RendererData
 Shared data used in renderer classes. More...
 
struct  RenderStates
 States used for drawing. More...
 
class  RootContainer
 
class  ScrollablePanel
 Group of widgets that has a background color and optional borders. More...
 
class  ScrollablePanelRenderer
 
class  Scrollbar
 Scrollbar widget. More...
 
class  ScrollbarChildWidget
 Wrapper around scrollbar to be used inside widgets that need a scrollbar. More...
 
class  ScrollbarRenderer
 
class  SeparatorLine
 Widget that is drawn as a filled rectangle and can be used as a line to visually separate widgets from each other. More...
 
class  SeparatorLineRenderer
 
class  Serializer
 Serializes an settable property. More...
 
class  Signal
 Signal to which the user can subscribe to get callbacks from. More...
 
class  SignalAnimationType
 Signal to which the user can subscribe to get callbacks from. More...
 
class  SignalChildWindow
 Signal to which the user can subscribe to get callbacks from. More...
 
class  SignalItem
 Signal to which the user can subscribe to get callbacks from. More...
 
class  SignalItemHierarchy
 Signal to which the user can subscribe to get callbacks from. More...
 
class  SignalManager
 
class  SignalShowEffect
 Signal to which the user can subscribe to get callbacks from. More...
 
class  SignalTyped
 Signal to which the user can subscribe to get callbacks from. More...
 
class  SignalTyped2
 Signal to which the user can subscribe to get callbacks from. More...
 
class  Slider
 Slider widget. More...
 
class  SliderRenderer
 
class  SpinButton
 Spin button widget. More...
 
class  SpinButtonRenderer
 
class  SpinControl
 Spin control widget. More...
 
class  Sprite
 
class  String
 Wrapper class to store strings. More...
 
class  SubwidgetContainer
 Base class for widgets that consist of subwidgets that act together as if they are a single widget. More...
 
class  SvgImage
 
class  TabContainer
 TabContainer widget. More...
 
class  Tabs
 Tabs widget. More...
 
class  TabsRenderer
 
class  Text
 
class  TextArea
 Text area widget. More...
 
class  TextAreaRenderer
 
class  TextStyles
 Wrapper for text styles. More...
 
class  Texture
 
struct  TextureData
 
struct  TextureDataHolder
 
class  TextureManager
 
class  Theme
 This class can be used to manage the widget renderers. More...
 
class  Timer
 Executes callbacks after a certain amount of time. More...
 
class  ToggleButton
 ToggleButton widget. More...
 
class  ToolTip
 Interface to set the settings for the tool tips. More...
 
class  Transform
 Defines a transform matrix. More...
 
class  TreeView
 Tree view widget. More...
 
class  TreeViewRenderer
 
class  Variant
 
class  Vector2
 
struct  Vertex
 
class  VerticalLayout
 Container that automatically resizes children to fit the entire available space between children. More...
 
class  Widget
 The parent class for every widget. More...
 
class  WidgetFactory
 
class  WidgetRenderer
 Base class for all renderer classes. More...
 

Typedefs

using Any = std::any
 
template<typename T >
using Optional = std::optional< T >
 
using Borders = Outline
 
using Padding = Outline
 
using FloatRect = Rect< float >
 
using IntRect = Rect< int >
 
using UIntRect = Rect< unsigned int >
 
using SignalInt = SignalTyped< int >
 Signal with one "int" as optional unbound parameter.
 
using SignalUInt = SignalTyped< unsigned int >
 Signal with one "unsigned int" as optional unbound parameter.
 
using SignalBool = SignalTyped< bool >
 Signal with one "bool" as optional unbound parameter.
 
using SignalFloat = SignalTyped< float >
 Signal with one "float" as optional unbound parameter.
 
using SignalColor = SignalTyped< Color >
 Signal with one "Color" as optional unbound parameter.
 
using SignalString = SignalTyped< const String & >
 Signal with one "String" as optional unbound parameter.
 
using SignalPathList = SignalTyped< const std::vector< Filesystem::Path > & >
 Signal with a vector of Filesystem::Path as optional unbound parameter.
 
using SignalVector2f = SignalTyped< Vector2f >
 Signal with one "Vector2f" as optional unbound parameter.
 
using SignalFloatRect = SignalTyped< FloatRect >
 Signal with one "FloatRect" as optional unbound parameter.
 
using SignalRange = SignalTyped2< float, float >
 Signal with two floats as optional unbound parameters.
 
using StringView = std::u32string_view
 
using CharStringView = std::string_view
 
using Vector2f = Vector2< float >
 
using Vector2u = Vector2< unsigned int >
 
using Vector2i = Vector2< int >
 
using ToggleButtonRenderer = ButtonRenderer
 
using BitmapButtonRenderer = ButtonRenderer
 
using TextBoxRenderer = TextAreaRenderer
 

Enumerations

enum class  ShowEffectType {
  Fade , Scale , SlideToRight , SlideToLeft ,
  SlideToBottom , SlideToTop , SlideFromLeft = SlideToRight , SlideFromRight = SlideToLeft ,
  SlideFromTop = SlideToBottom , SlideFromBottom = SlideToTop
}
 Type of effect to show/hide widget. More...
 
enum class  AnimationType { Move , Resize , Opacity }
 Type of animation. More...
 
enum  TextStyle {
  Regular = 0 , Bold = 1 << 0 , Italic = 1 << 1 , Underlined = 1 << 2 ,
  StrikeThrough = 1 << 3
}
 Enumeration of the text drawing styles. More...
 

Functions

template<typename T >
AnyCast (const Any &obj)
 
TGUI_CONSTEXPR bool operator== (const Duration &lhs, const Duration &rhs)
 
TGUI_CONSTEXPR bool operator!= (const Duration &lhs, const Duration &rhs)
 
TGUI_CONSTEXPR bool operator> (const Duration &lhs, const Duration &rhs)
 
TGUI_CONSTEXPR bool operator>= (const Duration &lhs, const Duration &rhs)
 
TGUI_CONSTEXPR bool operator< (const Duration &lhs, const Duration &rhs)
 
TGUI_CONSTEXPR bool operator<= (const Duration &lhs, const Duration &rhs)
 
TGUI_CONSTEXPR Duration operator+ (const Duration &lhs, const Duration &rhs)
 
TGUI_CONSTEXPR Duration operator- (const Duration &lhs, const Duration &rhs)
 
template<typename T , typename = typename std::enable_if<std::is_arithmetic<T>::value, T>::type>
TGUI_CONSTEXPR Duration operator* (const Duration &lhs, T rhs)
 
template<typename T , typename = typename std::enable_if<std::is_arithmetic<T>::value, T>::type>
TGUI_CONSTEXPR Duration operator* (T lhs, const Duration &rhs)
 
template<typename T , typename = typename std::enable_if<std::is_arithmetic<T>::value, T>::type>
TGUI_CONSTEXPR Duration operator/ (const Duration &lhs, T rhs)
 
TGUI_CONSTEXPR float operator/ (const Duration &lhs, const Duration &rhs)
 
template<typename T , typename = typename std::enable_if<std::is_arithmetic<T>::value, T>::type>
TGUI_CONSTEXPR Duration operator% (const Duration &lhs, T rhs)
 
TGUI_CONSTEXPR Duration operator% (const Duration &lhs, const Duration &rhs)
 
TGUI_CONSTEXPR Durationoperator+= (Duration &lhs, const Duration &rhs)
 
TGUI_CONSTEXPR Durationoperator-= (Duration &lhs, const Duration &rhs)
 
template<typename T , typename = typename std::enable_if<std::is_arithmetic<T>::value, T>::type>
TGUI_CONSTEXPR Durationoperator*= (Duration &lhs, T rhs)
 
template<typename T , typename = typename std::enable_if<std::is_arithmetic<T>::value, T>::type>
TGUI_CONSTEXPR Durationoperator/= (Duration &lhs, T rhs)
 
template<typename T , typename = typename std::enable_if<std::is_arithmetic<T>::value, T>::type>
TGUI_CONSTEXPR Durationoperator%= (Duration &lhs, T rhs)
 
TGUI_CONSTEXPR Durationoperator%= (Duration &lhs, const Duration &rhs)
 
template<typename T >
std::unique_ptr< T > MakeUniqueForOverwrite (const std::size_t size)
 Create a unique_ptr containing an uninitialized array.
 
TGUI_API void setGlobalTextSize (unsigned int textSize)
 Sets the default text size for all widgets created after calling the function.
 
TGUI_API unsigned int getGlobalTextSize ()
 Retrieves the default text size used for all new widgets.
 
TGUI_API void setDoubleClickTime (Duration duration)
 Sets the double-click time for the mouse.
 
TGUI_API Duration getDoubleClickTime ()
 Retrieves the double-click time for the mouse.
 
TGUI_API void setResourcePath (const Filesystem::Path &path)
 Sets a new resource path. More...
 
TGUI_API void setResourcePath (const String &path)
 Sets a new resource path. More...
 
TGUI_API const Filesystem::PathgetResourcePath ()
 Returns the resource path. More...
 
TGUI_API void setEditCursorBlinkRate (Duration blinkRate)
 Changes the blink rate of the cursor in edit fields such as EditBox and TextArea.
 
TGUI_API Duration getEditCursorBlinkRate ()
 Returns the blink rate of the cursor in edit fields such as EditBox and TextArea.
 
TGUI_API std::unique_ptr< std::uint8_t[]> readFileToMemory (const String &filename, std::size_t &fileSize)
 Opens a file and reads its contents into memory. More...
 
TGUI_API bool writeFile (const String &filename, std::stringstream &textToWrite)
 Opens a file and writes the given contents to it. More...
 
TGUI_API bool writeFile (const String &filename, const CharStringView &textToWrite)
 Opens a file and writes the given contents to it. More...
 
TGUI_API Layout operator- (Layout right)
 Unary minus operator for the Layout class.
 
TGUI_API Layout operator+ (Layout left, Layout right)
 
  • operator for the Layout class

 
TGUI_API Layout operator- (Layout left, Layout right)
 
  • operator for the Layout class

 
TGUI_API Layout operator* (Layout left, Layout right)
 
  • operator for the Layout class

 
TGUI_API Layout operator/ (Layout left, Layout right)
 / operator for the Layout class
 
TGUI_API Layout2d operator- (Layout2d right)
 Unary minus operator for the Layout2d class.
 
TGUI_API Layout2d operator+ (Layout2d left, Layout2d right)
 
 
TGUI_API Layout2d operator- (Layout2d left, Layout2d right)
 
 
TGUI_API Layout2d operator* (Layout2d left, const Layout &right)
 
 
TGUI_API Layout2d operator* (const Layout &left, Layout2d right)
 
 
TGUI_API Layout2d operator/ (Layout2d left, const Layout &right)
 / operator for the Layout2d class
 
TGUI_API Layout bindPosX (std::shared_ptr< Widget > widget)
 Bind to the x position of the widget (same as bindLeft unless widget origin is changed)
 
TGUI_API Layout bindPosY (std::shared_ptr< Widget > widget)
 Bind to the y position of the widget (same as bindTop unless widget origin is changed)
 
TGUI_API Layout bindLeft (std::shared_ptr< Widget > widget)
 Bind to the left position of the widget.
 
TGUI_API Layout bindTop (std::shared_ptr< Widget > widget)
 Bind to the top position of the widget.
 
TGUI_API Layout bindWidth (std::shared_ptr< Widget > widget)
 Bind to the width of the widget.
 
TGUI_API Layout bindHeight (std::shared_ptr< Widget > widget)
 Bind to the height of the widget.
 
TGUI_API Layout bindInnerWidth (std::shared_ptr< Container > container)
 Bind to the inner width of the container widget.
 
TGUI_API Layout bindInnerHeight (std::shared_ptr< Container > container)
 Bind to the inner height of the container widget.
 
TGUI_API Layout bindRight (std::shared_ptr< Widget > widget)
 Bind to the right position of the widget.
 
TGUI_API Layout bindBottom (std::shared_ptr< Widget > widget)
 Bind to the bottom of the widget.
 
TGUI_API Layout2d bindPosition (std::shared_ptr< Widget > widget)
 Bind to the position of the widget.
 
TGUI_API Layout2d bindSize (std::shared_ptr< Widget > widget)
 Bind to the size of the widget.
 
TGUI_API Layout2d bindInnerSize (std::shared_ptr< Container > container)
 Bind to the inner size of the container widget.
 
TGUI_API Layout bindWidth (BackendGui &gui)
 Bind to the width of the gui view.
 
TGUI_API Layout bindHeight (BackendGui &gui)
 Bind to the height of the gui view.
 
TGUI_API Layout2d bindSize (BackendGui &gui)
 Bind to the size of the gui view.
 
TGUI_API Layout bindMin (const Layout &value1, const Layout &value2)
 Bind to the minimum value of two layouts.
 
TGUI_API Layout bindMax (const Layout &value1, const Layout &value2)
 Bind to the maximum value of two layouts.
 
template<typename T >
TGUI_CONSTEXPR bool operator== (const Rect< T > &left, const Rect< T > &right)
 Checks if two Rect objects are equal.
 
template<typename T >
TGUI_CONSTEXPR bool operator!= (const Rect< T > &left, const Rect< T > &right)
 Checks if two Rect objects are different.
 
TGUI_API bool isWhitespace (char character)
 Checks if a character is a whitespace character (space, tab, carriage return or line feed)
 
TGUI_API bool isWhitespace (char32_t character)
 Checks if a character is a whitespace character (space, tab, carriage return or line feed)
 
bool operator== (const String &left, const String &right)
 
bool operator!= (const String &left, const String &right)
 
bool operator< (const String &left, const String &right)
 
bool operator<= (const String &left, const String &right)
 
bool operator> (const String &left, const String &right)
 
bool operator>= (const String &left, const String &right)
 
String operator+ (const String &left, const String &right)
 
String operator+ (String &&left, String &&right)
 
String operator+ (String &&left, const String &right)
 
String operator+ (const String &left, String &&right)
 
TGUI_API std::basic_ostream< char > & operator<< (std::basic_ostream< char > &os, const String &str)
 
TGUI_API std::basic_ostream< wchar_t > & operator<< (std::basic_ostream< wchar_t > &os, const String &str)
 
template<typename T >
TGUI_CONSTEXPR Vector2< T > operator- (const Vector2< T > &right)
 Overload of unary operator -.
 
template<typename T >
TGUI_CONSTEXPR Vector2< T > & operator+= (Vector2< T > &left, const Vector2< T > &right)
 Overload of binary operator +=.
 
template<typename T >
TGUI_CONSTEXPR Vector2< T > & operator-= (Vector2< T > &left, const Vector2< T > &right)
 Overload of binary operator -=.
 
template<typename T >
TGUI_CONSTEXPR Vector2< T > operator+ (const Vector2< T > &left, const Vector2< T > &right)
 Overload of binary operator +.
 
template<typename T >
TGUI_CONSTEXPR Vector2< T > operator- (const Vector2< T > &left, const Vector2< T > &right)
 Overload of binary operator -.
 
template<typename T >
TGUI_CONSTEXPR Vector2< T > operator* (const Vector2< T > &left, float right)
 Overload of binary operator *.
 
template<typename T >
TGUI_CONSTEXPR Vector2< T > operator* (float left, const Vector2< T > &right)
 Overload of binary operator *.
 
template<typename T >
TGUI_CONSTEXPR Vector2< T > & operator*= (Vector2< T > &left, float right)
 Overload of binary operator *=.
 
template<typename T >
TGUI_CONSTEXPR Vector2< T > operator/ (const Vector2< T > &left, float right)
 Overload of binary operator /.
 
template<typename T >
TGUI_CONSTEXPR Vector2< T > & operator/= (Vector2< T > &left, float right)
 Overload of binary operator /=.
 
template<typename T >
TGUI_CONSTEXPR bool operator== (const Vector2< T > &left, const Vector2< T > &right)
 Overload of binary operator ==.
 
template<typename T >
TGUI_CONSTEXPR bool operator!= (const Vector2< T > &left, const Vector2< T > &right)
 Overload of binary operator !=.
 
TGUI_API bool isBackendSet ()
 Checks whether the backend differs from a nullptr. More...
 
TGUI_API void setBackend (std::shared_ptr< Backend > backend)
 Changes the global backend. More...
 
TGUI_API std::shared_ptr< BackendgetBackend ()
 Returns the global backend. More...
 

Variables

constexpr unsigned int AutoTextSize = 0xFFFFFFFF
 

Detailed Description

Namespace that contains all TGUI functions and classes.

Enumeration Type Documentation

◆ AnimationType

enum class tgui::AnimationType
strong

Type of animation.

Enumerator
Move 

Position is being changed.

Resize 

Size is being changed.

Opacity 

Opacity is being changed.

◆ ShowEffectType

enum class tgui::ShowEffectType
strong

Type of effect to show/hide widget.

Enumerator
Fade 

Fade widget in or out.

Scale 

Shrink to the center of the widget to hide or grow from its center to show.

SlideToRight 

Slide to the right to hide or from left to show.

SlideToLeft 

Slide to the left to hide or from right to show.

SlideToBottom 

Slide to the bottom to hide or from top to show.

SlideToTop 

Slide to the top to hide or from bottom to show.

SlideFromLeft 

Slide from left to show or to the right to hide.

SlideFromRight 

Slide from right to show or to the left to hide.

SlideFromTop 

Slide from top to show or to the bottom to hide.

SlideFromBottom 

Slide from bottom to show or to the top to hide.

◆ TextStyle

Enumeration of the text drawing styles.

Enumerator
Regular 

Regular characters, no style.

Bold 

Bold characters.

Italic 

Italic characters.

Underlined 

Underlined characters.

StrikeThrough 

Strike through characters.

Function Documentation

◆ getBackend()

TGUI_API std::shared_ptr< Backend > tgui::getBackend ( )

Returns the global backend.

Returns
Global backend
Warning
This function will assert if no backend has been created yet or after it has been destroyed.
See also
isBackendSet()

◆ getResourcePath()

TGUI_API const Filesystem::Path & tgui::getResourcePath ( )

Returns the resource path.

This pathname is placed in front of every filename that is used to load a resource.

Returns
The current resource path

◆ isBackendSet()

TGUI_API bool tgui::isBackendSet ( )

Checks whether the backend differs from a nullptr.

Returns
Has setBackend been called with a valid backend?

◆ readFileToMemory()

TGUI_API std::unique_ptr< std::uint8_t[]> tgui::readFileToMemory ( const String filename,
std::size_t &  fileSize 
)

Opens a file and reads its contents into memory.

Parameters
filenamePath to the file to read
fileSizeSize of the file, to be filled in by this function if loading succeeds (untouched on failure)
Returns
Bytes read from the file, or nullptr if loading failed (or file was empty)

On android, the file will be read using the asset manager if a relative filename is passed.

◆ setBackend()

TGUI_API void tgui::setBackend ( std::shared_ptr< Backend backend)

Changes the global backend.

This function is automatically called when the first Gui object is created. When all Gui objects have been destructed, this function will be called again with a nullptr as parameter to destroy all global resources.

If you want to use TGUI functionality before creating a Gui object then you should call this function directly.

Warning
When calling the function directly, it has to be the first call to TGUI and you must call setBackend(nullptr) before the end of the main() function.

◆ setResourcePath() [1/2]

TGUI_API void tgui::setResourcePath ( const Filesystem::Path path)

Sets a new resource path.

This pathname is placed in front of every filename that is used to load a resource.

Parameters
pathNew resource path

◆ setResourcePath() [2/2]

TGUI_API void tgui::setResourcePath ( const String path)

Sets a new resource path.

This pathname is placed in front of every filename that is used to load a resource.

Parameters
pathNew resource path

◆ writeFile() [1/2]

TGUI_API bool tgui::writeFile ( const String filename,
const CharStringView &  textToWrite 
)

Opens a file and writes the given contents to it.

Parameters
filenamePath to the file to write
textToWriteContents to be written to the file
Returns
True on success, false if opening or writing to the file failed

◆ writeFile() [2/2]

TGUI_API bool tgui::writeFile ( const String filename,
std::stringstream &  textToWrite 
)

Opens a file and writes the given contents to it.

Parameters
filenamePath to the file to write
textToWriteContents to be written to the file
Returns
True on success, false if opening or writing to the file failed