summaryrefslogtreecommitdiff
path: root/src/engine.c
diff options
context:
space:
mode:
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);
}
}