Drawing shapesSDL 3.2

SDL_RenderRect

Draws only the outline of a rectangle, one pixel thick.

Signature

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

How it works

Handy for debugging: draw every collision box as an outline on top of the sprites to see what the physics sees.

Parameters

rendererSDL_Renderer *

The renderer.

rectconst SDL_FRect *

The rectangle, or NULL for the whole target's border.

Return value

true on success, false on failure.

Example

example.cpp
1SDL_SetRenderDrawColor(renderer, 255, 0, 255, 255);
2for (const Body& b : bodies) SDL_RenderRect(renderer, &b.box);
Official SDL wiki