]> git.lizzy.rs Git - dungeon_game.git/blob - plugins/score/score.c
Modularize rendering
[dungeon_game.git] / plugins / score / score.c
1 #include <stdio.h>
2 #include "../game/game.h"
3
4 static int score = 0;
5
6 void add_score(int s)
7 {
8         score += s;
9 }
10
11 int get_score()
12 {
13         return score;
14 }
15
16 static void render_score(struct winsize ws)
17 {
18         (void) ws;
19
20         printf("\e[32m\e[3mScore:\e[23m %d", score);
21 }
22
23 __attribute__ ((constructor)) static void init()
24 {
25         register_render_component(&render_score);
26 }