aboutsummaryrefslogtreecommitdiff
path: root/plugins/score/score.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/score/score.c')
-rw-r--r--plugins/score/score.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/plugins/score/score.c b/plugins/score/score.c
new file mode 100644
index 0000000..7ad8b66
--- /dev/null
+++ b/plugins/score/score.c
@@ -0,0 +1,26 @@
+#include <stdio.h>
+#include "../game/game.h"
+
+static int score = 0;
+
+void add_score(int s)
+{
+ score += s;
+}
+
+int get_score()
+{
+ return score;
+}
+
+static void render_score(struct winsize ws)
+{
+ (void) ws;
+
+ printf("\e[32m\e[3mScore:\e[23m %d", score);
+}
+
+__attribute__ ((constructor)) static void init()
+{
+ register_render_component(&render_score);
+}