From 600aad24960d47077fc6351103bea75bc1b41e82 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Wed, 04 Aug 2021 21:19:31 -0400 Subject: tk: Render box background --- (limited to 'src') 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) { -- cgit v0.9.1