ttfSetTextColorFloat function

bool ttfSetTextColorFloat(
  1. Pointer<TtfText> text,
  2. double r,
  3. double g,
  4. double b,
  5. double a,
)

Set the color of a text object.

The default text color is white (1.0f, 1.0f, 1.0f, 1.0f).

\param text the TTF_Text to modify. \param r the red color value, normally in the range of 0-1. \param g the green color value, normally in the range of 0-1. \param b the blue color value, normally in the range of 0-1. \param a the alpha value in the range of 0-1. \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_GetTextColorFloat \sa TTF_SetTextColor

extern SDL_DECLSPEC bool SDLCALL TTF_SetTextColorFloat(TTF_Text *text, float r, float g, float b, float a)

Implementation

bool ttfSetTextColorFloat(
    Pointer<TtfText> text, double r, double g, double b, double a) {
  final ttfSetTextColorFloatLookupFunction = libSdl3Ttf.lookupFunction<
      Uint8 Function(Pointer<TtfText> text, Float r, Float g, Float b, Float a),
      int Function(Pointer<TtfText> text, double r, double g, double b,
          double a)>('TTF_SetTextColorFloat');
  return ttfSetTextColorFloatLookupFunction(text, r, g, b, a) == 1;
}