|
SDL3pp
A slim C++ wrapper for SDL3
|
Text created with TextEngine.CreateText(). More...
Public Member Functions | |
| constexpr | Text (TextRaw resource) noexcept |
| Constructs from raw Text. | |
| constexpr | Text (const Text &other)=delete |
| Copy constructor. | |
| constexpr | Text (Text &&other) noexcept |
| Move constructor. | |
| constexpr | Text (const TextRef &other)=delete |
| constexpr | Text (TextRef &&other)=delete |
| Text (TextEngineRef engine, FontRef font, std::string_view text) | |
| Create a text object from UTF-8 text and a text engine. | |
| constexpr | operator TextConstRef () const noexcept |
| Converts to TextConstRef. | |
| ~Text () | |
| Destructor. | |
| constexpr Text & | operator= (Text &&other) noexcept |
| Assignment operator. | |
| Text & | operator= (const Text &other)=delete |
| Assignment operator. | |
| void | Destroy () |
| Destroy a text object created by a text engine. | |
| void | DrawSurface (Point p, SurfaceRef surface) const |
| Draw text to an SDL surface. | |
| void | DrawRenderer (FPoint p) const |
| Draw text to an SDL renderer. | |
| GPUAtlasDrawSequence * | GetGPUDrawData () const |
| Get the geometry data needed for drawing the text. | |
| PropertiesRef | GetProperties () const |
| Get the properties associated with a text object. | |
| void | SetEngine (TextEngineRef engine) |
| Set the text engine used by a text object. | |
| TextEngineRef | GetEngine () const |
| Get the text engine used by a text object. | |
| bool | SetFont (FontRef 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 | SetColorFloat (FColor c) |
| Set the color of a text object. | |
| void | GetColor (Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a) const |
| Get the color of a text object. | |
| Color | GetColor () const |
| Get the color of a text object. | |
| void | GetColorFloat (float *r, float *g, float *b, float *a) const |
| Get the color of a text object. | |
| FColor | GetColorFloat () const |
| Get the color of a text object. | |
| void | SetPosition (const PointRaw &p) |
| Set the position of a text object. | |
| void | GetPosition (int *x, int *y) const |
| Get the position of a text object. | |
| Point | GetPosition () 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) |
| Delete UTF-8 text from a text object. | |
| void | GetSize (int *w, int *h) const |
| Get the size of a text object. | |
| Point | GetSize () 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 | ResourceBase (RawPointer resource) |
| Constructs from resource pointer. | |
| constexpr | ResourceBase (std::nullptr_t=nullptr) |
| Constructs null/invalid. | |
| Public Member Functions inherited from SDL::ResourceBase< TextRaw, TextRawConst > | |
| constexpr | ResourceBase (RawPointer resource) |
| Constructs from resource pointer. | |
| constexpr | operator bool () const |
| Converts to bool. | |
| constexpr auto | operator<=> (const ResourceBase &other) const=default |
| Comparison. | |
| constexpr RawConstPointer | operator-> () const noexcept |
| member access to underlying resource pointer. | |
| constexpr RawPointer | get () const noexcept |
| Retrieves underlying resource pointer. | |
| constexpr RawPointer | release () noexcept |
| Retrieves underlying resource pointer and clear this. | |
Additional Inherited Members | |
| Public Types inherited from SDL::ResourceBase< TextRaw, TextRawConst > | |
| using | RawPointer |
| The underlying raw pointer type. | |
| using | RawConstPointer |
| The underlying const raw pointer type. | |
Text created with TextEngine.CreateText().
|
inlineexplicitconstexprnoexcept |
| SubStringIterator SDL::Text::GetSubStringForLine | ( | int | line | ) | const |
Get iterator to substring of a text object that contains the given line.
If line is greater than or equal to text->num_lines this will return an iterator equal to end().
| line | a zero-based line index, in the range [0 .. text->num_lines-1]. |
| SubStringIterator SDL::Text::GetSubStringForPoint | ( | Point | p | ) | const |
Get the portion of a text string that is closest to a point.
This will return the closest substring of text to the given point.
| p | the coordinates relative to the top-left side of the text, may be outside the bounds of the text area. |
Get all substrings of a text object.