ttfGetTextSubStringForPoint function
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.
\param text the TTF_Text to query. \param x the x coordinate relative to the left side of the text, may be outside the bounds of the text area. \param y the y coordinate relative to the top side of the text, may be outside the bounds of the text area. \param substring a pointer filled in with the closest substring of text to the given point. \returns true on success or false on failure; call SDL_GetError() for more information.
\threadsafety This function should be called on the thread that created the text.
\since This function is available since SDL_ttf 3.0.0.
extern SDL_DECLSPEC bool SDLCALL TTF_GetTextSubStringForPoint(TTF_Text *text, int x, int y, TTF_SubString *substring)
Implementation
bool ttfGetTextSubStringForPoint(
Pointer<TtfText> text, int x, int y, Pointer<TtfSubString> substring) {
final ttfGetTextSubStringForPointLookupFunction = libSdl3Ttf.lookupFunction<
Uint8 Function(Pointer<TtfText> text, Int32 x, Int32 y,
Pointer<TtfSubString> substring),
int Function(Pointer<TtfText> text, int x, int y,
Pointer<TtfSubString> substring)>('TTF_GetTextSubStringForPoint');
return ttfGetTextSubStringForPointLookupFunction(text, x, y, substring) == 1;
}