I'm trying to draw a rectangle outline in SDL 2.0 in order to use as a selection box. Does anyone know how to make one in SDL 2.0?
You are looking for the SDL_RenderDrawRect:
int SDL_RenderDrawRect(SDL_Renderer* renderer,
const SDL_Rect* rect);
Typical usage would be:
SDL_Rect rectToDraw = {100,100,100,100} // Just some random rect
//Set Color of Rect with SDL_SetRenderDrawColor if needed
SDL_RenderDrawRect(renderer, &rectToDraw);
To draw a filled rect it would then be with SDL_RenderFillRect
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With