sdlSetRenderDrawColor function

bool sdlSetRenderDrawColor(
  1. Pointer<SdlRenderer> renderer,
  2. int r,
  3. int g,
  4. int b,
  5. int a,
)

Set the color used for drawing operations.

Set the color for drawing or filling rectangles, lines, and points, and for SDL_RenderClear().

\param renderer the rendering context. \param r the red value used to draw on the rendering target. \param g the green value used to draw on the rendering target. \param b the blue value used to draw on the rendering target. \param a the alpha value used to draw on the rendering target; usually SDL_ALPHA_OPAQUE (255). Use SDL_SetRenderDrawBlendMode to specify how the alpha channel is used. \returns true on success or false on failure; call SDL_GetError() for more information.

\threadsafety This function should only be called on the main thread.

\since This function is available since SDL 3.1.3.

\sa SDL_GetRenderDrawColor \sa SDL_SetRenderDrawColorFloat

extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderDrawColor(SDL_Renderer *renderer, Uint8 r, Uint8 g, Uint8 b, Uint8 a)

Implementation

bool sdlSetRenderDrawColor(
    Pointer<SdlRenderer> renderer, int r, int g, int b, int a) {
  final sdlSetRenderDrawColorLookupFunction = libSdl3.lookupFunction<
      Uint8 Function(
          Pointer<SdlRenderer> renderer, Uint8 r, Uint8 g, Uint8 b, Uint8 a),
      int Function(Pointer<SdlRenderer> renderer, int r, int g, int b,
          int a)>('SDL_SetRenderDrawColor');
  return sdlSetRenderDrawColorLookupFunction(renderer, r, g, b, a) == 1;
}