From 194112490cf58dc5fe9c0ca0488d4964faa9f2a3 Mon Sep 17 00:00:00 2001 From: Oxore Date: Sat, 2 Dec 2017 11:25:50 +0300 Subject: Make all text resources load from yaml file --- src/functions.c | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) (limited to 'src/functions.c') diff --git a/src/functions.c b/src/functions.c index cf01bfb..482a459 100644 --- a/src/functions.c +++ b/src/functions.c @@ -71,22 +71,28 @@ void initFld() } -void scoreDisplay(int s, Text *textScore) +void valueAfterTextDisplay(int value, List *texts, char *type) { - char a[64]; - sprintf(a, "Score: %d", s); - sfText_setString(textScore->sfText, (char *)&a); -} - - -void levelDisplay(int s, Text *textLevel) -{ - char a[64]; - sprintf(a, "Level: %d", s); - sfText_setString(textLevel->sfText, (char *)&a); + List *l = texts; + while (l) { + Text *text = (Text *)l->obj; + if (text->type) + if (!strcmp(text->type, type)) { + char a[64]; + if (text->text) { + if (strlen(text->text) > 52) { + memset(text->text+52, '\0', 1); + strcpy(a, text->text); + } + sprintf(a, "%s%d", text->text, value); + sfText_setString(text->sfText, (char *)&a); + break; + } + } + l = l->next; + } } - /* * Removes line when cells all are in row in it * -- cgit v1.2.3