From 2682bc5d1d864341aaeb42a449db73c3ecd16d70 Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Wed, 30 Dec 2020 19:07:31 +0000 Subject: Initial import --- game/src/aux.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 game/src/aux.c (limited to 'game/src/aux.c') diff --git a/game/src/aux.c b/game/src/aux.c new file mode 100644 index 0000000..15fc2a4 --- /dev/null +++ b/game/src/aux.c @@ -0,0 +1,27 @@ +#include + +#include "ubox.h" + +#include "aux.h" + +/** + * Put a zero terminated string on the screen using tiles. + * + * The font starts on the tileset on tile 128 and the fist char in our has + * ASCII value 31, so it is adjusted so we can use ASCII *uppercase* directly + * in our C code. + */ +void put_text(uint8_t x, uint8_t y, const uint8_t *text) +{ + while (*text) + ubox_put_tile(x++, y, *text++ + 128 - 31); +} + +/** + * Wait for `frames` frames. + */ +void wait_for(uint8_t frames) +{ + while (frames--) + ubox_wait(); +} -- cgit v1.2.3