aboutsummaryrefslogtreecommitdiff
path: root/src/graphics/drawer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/graphics/drawer.c')
-rw-r--r--src/graphics/drawer.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/graphics/drawer.c b/src/graphics/drawer.c
index a2c5d8e..742712a 100644
--- a/src/graphics/drawer.c
+++ b/src/graphics/drawer.c
@@ -3,6 +3,26 @@
static struct Drawer g_Drawer = {x: 0, y: 0};
+void write_cchar(struct Drawer* d, char s, unsigned int c) {
+ d->x %= GG_MAX_X;
+ d->y %= GG_MAX_Y;
+ if (s == 0x0A) {
+ d->y += 1;
+ d->x = 0;
+ } else {
+ draw_cletter(d->x++, d->y, s, c);
+ if (d->x > GG_MAX_X) {
+ d->y += 1;
+ d->x = 0;
+ }
+ }
+ // CHECK Y EVENTUALLY
+}
+
+void write_char(struct Drawer* d, char s) {
+ write_cchar(d, s, 0xFFFFFF);
+}
+
void write_cstring(struct Drawer* d, char* s, unsigned int c) {
d->x %= GG_MAX_X;
d->y %= GG_MAX_Y;
@@ -44,3 +64,22 @@ void write_chex32(struct Drawer* d, unsigned long val, unsigned int c) {
void write_hex32(struct Drawer* d, unsigned long val) {
write_chex32(d, val, 0xFFFFFF);
}
+
+void write_c10(struct Drawer* d, unsigned long val, unsigned int c) {
+ static char out[] = "0000000000";
+ char* s = (char*)out+10;
+ unsigned long tmp = val;
+ if(tmp == 0)
+ s--;
+ while (tmp != 0) {
+ s--;
+ unsigned char rem = tmp%10;
+ tmp /= 10;
+ *s = rem + 0x30;
+ }
+ write_cstring(d, s, c);
+}
+
+void write_10(struct Drawer* d, unsigned long val) {
+ write_c10(d, val, 0xFFFFFF);
+}