问题
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?
回答1:
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
来源:https://stackoverflow.com/questions/20072639/how-to-draw-a-rectangle-outline-in-sdl-2-0