sdlxRenderRect function render

bool sdlxRenderRect(
  1. Pointer<SdlRenderer> renderer,
  2. SdlxFRect? rect
)

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

\param renderer the renderer which should draw a rectangle. \param rect a pointer to the destination rectangle, or NULL to outline the entire rendering target. \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_RenderRects

extern SDL_DECLSPEC bool SDLCALL SDL_RenderRect(SDL_Renderer *renderer, const SDL_FRect *rect)

Implementation

bool sdlxRenderRect(Pointer<SdlRenderer> renderer, SdlxFRect? rect) {
  Pointer<SdlFRect> rectPointer = nullptr;
  if (rect != null) {
    rectPointer = rect.calloc();
  }
  final result = sdlRenderRect(renderer, rectPointer);
  if (rectPointer != nullptr) {
    rectPointer.callocFree();
  }
  return result;
}