diff options
author | P. J. McDermott <pj@pehjota.net> | 2022-01-27 18:24:50 (EST) |
---|---|---|
committer | P. J. McDermott <pj@pehjota.net> | 2022-01-27 18:33:05 (EST) |
commit | 8ba3e62614e61e47ca7f8d79cd8c93d547206f74 (patch) | |
tree | 044e1c2a2e509b1268c2028028a31b43a856227d /src/tk/text.c | |
parent | 9d331d766c9093c4c003d6b3629a9f1c69b08174 (diff) | |
download | mazefight-8ba3e62614e61e47ca7f8d79cd8c93d547206f74.zip mazefight-8ba3e62614e61e47ca7f8d79cd8c93d547206f74.tar.gz mazefight-8ba3e62614e61e47ca7f8d79cd8c93d547206f74.tar.bz2 |
tk: Fill text background (if editable)
And use the same macros for all background fill colors.
Diffstat (limited to 'src/tk/text.c')
-rw-r--r-- | src/tk/text.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/tk/text.c b/src/tk/text.c index 76bb27a..7401777 100644 --- a/src/tk/text.c +++ b/src/tk/text.c @@ -266,6 +266,22 @@ _mftk_text_render(struct mftk_widget *w, SDL_Renderer *renderer, int x, int y) return -1; } + if (t->editable == SDL_TRUE) { + rect.x = x; + rect.y = y; + rect.w = w->w; + rect.h = w->h; + if (SDL_SetRenderDrawColor(renderer, + MFTK_COLOR_BACK_R, MFTK_COLOR_BACK_G, + MFTK_COLOR_BACK_B, MFTK_COLOR_BACK_A) < + 0 || SDL_RenderFillRect(renderer, &rect) < 0) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "Couldn't render widget: %s", + SDL_GetError()); + return -1; + } + } + rect.x = x; rect.y = t->y + y; rect.w = t->w; |