ttfDrawSurfaceText function

bool ttfDrawSurfaceText(
  1. Pointer<TtfText> text,
  2. int x,
  3. int y,
  4. Pointer<SdlSurface> surface,
)

Draw text to an SDL surface.

text must have been created using a TTF_TextEngine from TTF_CreateSurfaceTextEngine().

\param text the text to draw. \param x the x coordinate in pixels, positive from the left edge towards the right. \param y the y coordinate in pixels, positive from the top edge towards the bottom. \param surface the surface to draw on. \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.

\sa TTF_CreateSurfaceTextEngine \sa TTF_CreateText

extern SDL_DECLSPEC bool SDLCALL TTF_DrawSurfaceText(TTF_Text *text, int x, int y, SDL_Surface *surface)

Implementation

bool ttfDrawSurfaceText(
    Pointer<TtfText> text, int x, int y, Pointer<SdlSurface> surface) {
  final ttfDrawSurfaceTextLookupFunction = libSdl3Ttf.lookupFunction<
      Uint8 Function(
          Pointer<TtfText> text, Int32 x, Int32 y, Pointer<SdlSurface> surface),
      int Function(Pointer<TtfText> text, int x, int y,
          Pointer<SdlSurface> surface)>('TTF_DrawSurfaceText');
  return ttfDrawSurfaceTextLookupFunction(text, x, y, surface) == 1;
}