SDL3pp
A slim C++ wrapper for SDL3
Loading...
Searching...
No Matches
Public Member Functions | List of all members
SDL::Text Struct Reference

Handle to an owned text. More...

Inheritance diagram for SDL::Text:
Inheritance graph
[legend]

Public Member Functions

constexpr Text (TTF_Text *resource={})
 Constructs from the underlying resource.
 
constexpr Text (const Text &other)=delete
 
constexpr Text (Text &&other)=default
 Move constructor.
 
 ~Text ()
 Frees up resource when object goes out of scope.
 
Textoperator= (Text other)
 Assignment operator.
 
constexpr TextRef (const TextRef &other)
 Copy constructor.
 
constexpr TextRef (TextRef &&other)
 Move constructor.
 
- Public Member Functions inherited from SDL::TextRef
constexpr TextRef (const TextRef &other)
 Copy constructor.
 
constexpr TextRef (TextRef &&other)
 Move constructor.
 
constexpr ~TextRef ()=default
 Default constructor.
 
TextRefoperator= (TextRef other)
 Assignment operator.
 
void reset (TTF_Text *newResource={})
 Destroy a text object created by a text engine.
 
 TextBase (TextEngineBase &engine, FontRef font, std::string_view text)
 Create a text object from UTF-8 text and a text engine.
 
- Public Member Functions inherited from SDL::TextBase
void DrawSurface (Point p, SurfaceRef surface) const
 Draw text to an SDL surface.
 
void DrawRenderer (FPoint p) const
 Draw text to an SDL renderer.
 
GPUAtlasDrawSequenceGetGPUDrawData () const
 Get the geometry data needed for drawing the text.
 
 TextBase (TextEngineBase &engine, FontRef font, std::string_view text)
 Create a text object from UTF-8 text and a text engine.
 
PropertiesRef GetProperties () const
 Get the properties associated with a text object.
 
void SetEngine (TextEngineBase &engine)
 Set the text engine used by a text object.
 
TextEngineRef GetEngine () const
 Get the text engine used by a text object.
 
bool SetFont (FontBase &font)
 Set the font used by a text object.
 
FontRef GetFont () const
 Get the font used by a text object.
 
void SetDirection (Direction direction)
 Set the direction to be used for text shaping a text object.
 
Direction GetDirection () const
 Get the direction to be used for text shaping a text object.
 
void SetScript (Uint32 script)
 Set the script to be used for text shaping a text object.
 
Uint32 GetScript () const
 Get the script used for text shaping a text object.
 
void SetColor (Color c)
 Set the color of a text object.
 
void SetColor (FColor c)
 Set the color of a text object.
 
FColor GetColor () const
 Get the color of a text object.
 
void GetColor (Color *c) const
 Get the color of a text object.
 
void GetColor (FColor *c) const
 Get the color of a text object.
 
void GetColor (Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a) const
 Get the color of a text object.
 
void GetColor (float *r, float *g, float *b, float *a) const
 Get the color of a text object.
 
bool SetPosition (Point p)
 Set the position of a text object.
 
Point GetPosition () const
 Get the position of a text object.
 
bool GetPosition (int *x, int *y) const
 Get the position of a text object.
 
void SetWrapWidth (int wrap_width)
 Set whether wrapping is enabled on a text object.
 
int GetWrapWidth () const
 Get whether wrapping is enabled on a text object.
 
void SetWrapWhitespaceVisible (bool visible)
 Set whether whitespace should be visible when wrapping a text object.
 
bool IsWrapWhitespaceVisible () const
 Return whether whitespace is shown when wrapping a text object.
 
void SetString (std::string_view string)
 Set the UTF-8 text used by a text object.
 
void InsertString (int offset, std::string_view string)
 Insert UTF-8 text into a text object.
 
void AppendString (std::string_view string)
 Append UTF-8 text to a text object.
 
void DeleteString (int offset, int length=-1)
 Delete UTF-8 text from a text object.
 
Point GetSize () const
 Get the size of a text object.
 
void GetSize (int *w, int *h) const
 Get the size of a text object.
 
void GetSubString (int offset, SubString *substring) const
 Get the substring of a text object that surrounds a text offset.
 
SubStringIterator begin () const
 Get iterator to first substring.
 
SubStringIterator end () const
 Get iterator to one past last substring.
 
SubStringIterator GetSubStringForLine (int line) const
 Get iterator to substring of a text object that contains the given line.
 
void GetSubStringForLine (int line, SubString *substring) const
 Get the substring of a text object that contains the given line.
 
OwnArray< SubString * > GetSubStrings () const
 Get all substrings of a text object.
 
OwnArray< SubString * > GetSubStringsForRange (int offset, int length=-1) const
 Get the substrings of a text object that contain a range of text.
 
SubStringIterator GetSubStringForPoint (Point p) const
 Get the portion of a text string that is closest to a point.
 
void GetSubStringForPoint (Point p, SubString *substring) const
 Get the portion of a text string that is closest to a point.
 
void GetPreviousSubString (const SubString &substring, SubString *previous) const
 Get the previous substring in a text object.
 
void GetNextSubString (const SubString &substring, SubString *next) const
 Get the next substring in a text object.
 
void Update ()
 Update the layout of a text object.
 
const char * GetText () const
 A copy of the UTF-8 string that this text object represents, useful for layout, debugging and retrieving substring text.
 
int GetNumLines () const
 The number of lines in the text, 0 if it's empty.
 
constexpr Resource (T resource={})
 Constructs the underlying resource.
 
constexpr Resource (std::nullptr_t)
 Equivalent to default ctor.
 
constexpr Resource (std::nullopt_t)
 Equivalent to default ctor.
 
 Resource (const Resource &other)=delete
 
 Resource (Resource &&other)=delete
 
- Public Member Functions inherited from SDL::Resource< TTF_Text * >
constexpr Resource (TTF_Text * resource={})
 Constructs the underlying resource.
 
constexpr Resource (std::nullptr_t)
 Equivalent to default ctor.
 
constexpr Resource (std::nullopt_t)
 Equivalent to default ctor.
 
 Resource (const Resource &other)=delete
 
 Resource (Resource &&other)=delete
 
Resourceoperator= (const Resource &other)=delete
 
Resourceoperator= (Resource &&other)=delete
 
constexpr operator bool () const
 True if contains a valid resource.
 
constexpr bool operator== (const Resource &other) const=default
 Comparison.
 
constexpr bool operator== (std::nullopt_t) const
 Comparison.
 
constexpr bool operator== (std::nullptr_t) const
 Comparison.
 
constexpr TTF_Text * get () const
 Return contained resource;.
 
constexpr TTF_Text * release (TTF_Text * newResource={})
 Return contained resource and empties or replace value.
 
constexpr const TTF_Text * operator-> () const
 Access to fields.
 
constexpr TTF_Text * operator-> ()
 Access to fields.
 

Detailed Description

Category:
Resource
See also
TextBase
TextRef

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