How to draw a rectangle outline in SDL 2.0

别来无恙 提交于 2019-12-07 10:58:39

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!