sdlRenderLine function render

bool sdlRenderLine(
  1. Pointer<SdlRenderer> renderer,
  2. double x1,
  3. double y1,
  4. double x2,
  5. double y2,
)

Draw a line on the current rendering target at subpixel precision.

\param renderer the renderer which should draw a line. \param x1 the x coordinate of the start point. \param y1 the y coordinate of the start point. \param x2 the x coordinate of the end point. \param y2 the y coordinate of the end point. \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.2.0.

\sa SDL_RenderLines

extern SDL_DECLSPEC bool SDLCALL SDL_RenderLine(SDL_Renderer *renderer, float x1, float y1, float x2, float y2)

Implementation

bool sdlRenderLine(
  Pointer<SdlRenderer> renderer,
  double x1,
  double y1,
  double x2,
  double y2,
) {
  final sdlRenderLineLookupFunction = _libSdl
      .lookupFunction<
        Uint8 Function(
          Pointer<SdlRenderer> renderer,
          Float x1,
          Float y1,
          Float x2,
          Float y2,
        ),
        int Function(
          Pointer<SdlRenderer> renderer,
          double x1,
          double y1,
          double x2,
          double y2,
        )
      >('SDL_RenderLine');
  return sdlRenderLineLookupFunction(renderer, x1, y1, x2, y2) == 1;
}