5

我试图在 SDL 2.0 中绘制一个矩形轮廓以用作选择框。有谁知道如何在 SDL 2.0 中制作一个?

4

1 回答 1

8

您正在寻找SDL_RenderDrawRect

int SDL_RenderDrawRect(SDL_Renderer*   renderer,
                   const SDL_Rect* rect);

典型用法是:

SDL_Rect rectToDraw = {100,100,100,100} // Just some random rect

//Set Color of Rect with SDL_SetRenderDrawColor if needed

SDL_RenderDrawRect(renderer, &rectToDraw);

要绘制一个填充的矩形,它将使用SDL_RenderFillRect

于 2013-11-19T17:42:34.387 回答