summaryrefslogtreecommitdiff
path: root/src/engine.c
diff options
context:
space:
mode:
authorOxore <oxore@protonmail.com>2018-07-11 07:04:47 +0300
committerOxore <oxore@protonmail.com>2018-07-11 07:04:47 +0300
commit2b265ea0eb5825eccd3b9b072b5014bacf0d16d7 (patch)
tree2a53ce81ad53d6a6fcb9481bd17b535220db0080 /src/engine.c
parent11cd6a8ac4d077b4d082021e1dcc6c6e48bd89d8 (diff)
Migrate displayable text to utf32
Diffstat (limited to 'src/engine.c')
-rw-r--r--src/engine.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/engine.c b/src/engine.c
index 59de551..a087fd2 100644
--- a/src/engine.c
+++ b/src/engine.c
@@ -4,7 +4,6 @@
#include <SFML/System/Clock.h>
#include <SFML/Window/Keyboard.h>
#include <SFML/Graphics/RenderWindow.h>
-#include <SFML/Graphics/Text.h>
#include "common.h"
#include "idlist.h"
@@ -75,8 +74,11 @@ static void render_score_value(void *obj)
struct text *text = obj;
if (!strcmp(text->type, "score.value")) {
if (!text->text)
- text->text = malloc(sizeof(char) * BUFSIZ);
- sprintf(text->text, "%d", game.scoreCurrent);
+ text->text = calloc(BUFSIZ, sizeof(char));
+ char *a = calloc(BUFSIZ, sizeof(char));
+ sprintf(a, "%d", game.scoreCurrent);
+ utf8to32_strcpy(text->text, a);
+ free(a);
}
}
@@ -85,8 +87,11 @@ static void render_level_value(void *obj)
struct text *text = obj;
if (!strcmp(text->type, "level.value")) {
if (!text->text)
- text->text = malloc(sizeof(char) * BUFSIZ);
- sprintf(text->text, "%d", game.level);
+ text->text = calloc(BUFSIZ, sizeof(char));
+ char *a = calloc(BUFSIZ, sizeof(char));
+ sprintf(a, "%d", game.level);
+ utf8to32_strcpy(text->text, a);
+ free(a);
}
}