summaryrefslogtreecommitdiffstats
path: root/src/tk/label.c
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2021-09-25 18:39:15 (EDT)
committer P. J. McDermott <pj@pehjota.net>2021-09-25 18:39:15 (EDT)
commit2ed3153670ffba9d43f6033ce89dc33c241de193 (patch)
treecd2191e381f72f2938650839962c16fcad6268e2 /src/tk/label.c
parent15f3d1c8385ac7cc2ed3c04bb1e1fb919ba169d1 (diff)
downloadmazefight-2ed3153670ffba9d43f6033ce89dc33c241de193.zip
mazefight-2ed3153670ffba9d43f6033ce89dc33c241de193.tar.gz
mazefight-2ed3153670ffba9d43f6033ce89dc33c241de193.tar.bz2
tk: Define colors within local header
Diffstat (limited to 'src/tk/label.c')
-rw-r--r--src/tk/label.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/tk/label.c b/src/tk/label.c
index dcd827e..bd4e5a4 100644
--- a/src/tk/label.c
+++ b/src/tk/label.c
@@ -20,6 +20,7 @@
#include <SDL.h>
#include <SDL_ttf.h>
#include "../tk.h"
+#include "style.h"
#include "widget.h"
struct mftk_label {
@@ -29,6 +30,11 @@ struct mftk_label {
int h;
};
+static SDL_Color _mftk_label_color = {
+ .r = MFTK_COLOR_FORE_R, .g = MFTK_COLOR_FORE_G,
+ .b = MFTK_COLOR_FORE_B, .a = MFTK_COLOR_FORE_A
+};
+
static void
_mftk_label_layout(struct mftk_widget *w __attribute__((__unused__)))
{
@@ -75,8 +81,7 @@ _mftk_label_destroy(struct mftk_widget *w)
}
struct mftk_widget *
-mftk_label_new(TTF_Font *font, const char *text, SDL_Color *color,
- SDL_Renderer *renderer)
+mftk_label_new(TTF_Font *font, const char *text, SDL_Renderer *renderer)
{
struct mftk_widget *w;
struct mftk_label *l;
@@ -89,7 +94,7 @@ mftk_label_new(TTF_Font *font, const char *text, SDL_Color *color,
mftk_widget_init(w, l, label);
- surface = TTF_RenderUTF8_Blended(font, text, *color);
+ surface = TTF_RenderUTF8_Blended(font, text, _mftk_label_color);
if (surface == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
"Couldn't create surface: %s",