SDL School

API reference / Windows and drawing

SDL_RenderRect

Function, SDL3

Draws the outline of a rectangle, one pixel wide.

Declaration

#include <SDL3/SDL.h>

bool SDL_RenderRect(SDL_Renderer *renderer, const SDL_FRect *rect);

Parameters

rendererThe renderer.
rectThe rectangle. NULL means the full window.

Return value

True on success. On failure it returns false.

Example

Use the mouse
SDL_RenderRect(renderer, &cursor);

See this code run in Use the mouse. Download the full program (.zip)

In SDL2

Use SDL_RenderDrawRectF for an SDL_FRect.

See also