diff options
author | P. J. McDermott <pj@pehjota.net> | 2021-08-04 21:19:31 (EDT) |
---|---|---|
committer | P. J. McDermott <pj@pehjota.net> | 2021-08-04 21:19:31 (EDT) |
commit | 600aad24960d47077fc6351103bea75bc1b41e82 (patch) | |
tree | dd69143fe6dbeddfd8831fa5916135bdd14ab126 /src/tk | |
parent | 22bb32eecf58a5317f6bad2958923fa1172f61e0 (diff) | |
download | mazefight-600aad24960d47077fc6351103bea75bc1b41e82.zip mazefight-600aad24960d47077fc6351103bea75bc1b41e82.tar.gz mazefight-600aad24960d47077fc6351103bea75bc1b41e82.tar.bz2 |
tk: Render box background
Diffstat (limited to 'src/tk')
-rw-r--r-- | src/tk/box.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/tk/box.c b/src/tk/box.c index ca60ab2..ced5b3c 100644 --- a/src/tk/box.c +++ b/src/tk/box.c @@ -82,6 +82,22 @@ static int _mftk_box_render(struct mftk_widget *w, SDL_Renderer *renderer, int x, int y) { struct mftk_box *b = (struct mftk_box *) w; + SDL_Rect rect; + + rect.x = b->child_x - b->padding; + rect.y = b->child_y - b->padding; + rect.w = w->w; + rect.h = w->h; + if (SDL_SetRenderDrawColor(renderer, + b->bg_color->r, b->bg_color->g, + b->bg_color->b, b->bg_color->a) < 0 || + SDL_RenderFillRect(renderer, &rect) < 0) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "Couldn't render widget: %s", + SDL_GetError()); + return -1; + } + if (mftk_widget_render(b->child, renderer, x + b->child_x, y + b->child_y) < 0) { |