From 3a366988a0077474075d8f33ad76514d2fa0c5d6 Mon Sep 17 00:00:00 2001 From: Christian Cunningham Date: Fri, 24 Dec 2021 15:21:54 -0800 Subject: Standardized Formatting --- src/graphics/drawer.c | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) (limited to 'src/graphics/drawer.c') diff --git a/src/graphics/drawer.c b/src/graphics/drawer.c index be7b0ac..35a16a6 100644 --- a/src/graphics/drawer.c +++ b/src/graphics/drawer.c @@ -1,10 +1,11 @@ -#include "../graphics/lfb.h" #include "../graphics/drawer.h" +#include "../graphics/lfb.h" #define GRAPHICS_DRAWER_C struct Drawer g_Drawer = {.x = 0, .y = 0}; -void write_cchar(struct Drawer* d, char s, unsigned int c) { +void write_cchar(struct Drawer* d, char s, unsigned int c) +{ d->x %= GG_MAX_X; d->y %= GG_MAX_Y; if (s == 0x0A) { @@ -20,11 +21,13 @@ void write_cchar(struct Drawer* d, char s, unsigned int c) { // CHECK Y EVENTUALLY } -void write_char(struct Drawer* d, char s) { +void write_char(struct Drawer* d, char s) +{ write_cchar(d, s, 0xFFFFFF); } -void write_cstring(struct Drawer* d, char* s, unsigned int c) { +void write_cstring(struct Drawer* d, char* s, unsigned int c) +{ d->x %= GG_MAX_X; d->y %= GG_MAX_Y; unsigned int idx = 0; @@ -44,16 +47,13 @@ void write_cstring(struct Drawer* d, char* s, unsigned int c) { } } -void write_string(struct Drawer* d, char* s) { +void write_string(struct Drawer* d, char* s) +{ write_cstring(d, s, 0xFFFFFF); } -void set_drawer(struct Drawer* d, unsigned int x, unsigned int y) { - d->x = x % GG_MAX_X; - d->y = y % GG_MAX_Y; -} - -void write_chex32(struct Drawer* d, unsigned long val, unsigned int c) { +void write_chex32(struct Drawer* d, unsigned long val, unsigned int c) +{ draw_chex32(d->x, d->y, val, c); d->x += 8; if (d->x >= GG_MAX_X) { @@ -62,11 +62,13 @@ void write_chex32(struct Drawer* d, unsigned long val, unsigned int c) { } } -void write_hex32(struct Drawer* d, unsigned long val) { +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) { +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; @@ -81,6 +83,13 @@ void write_c10(struct Drawer* d, unsigned long val, unsigned int c) { write_cstring(d, s, c); } -void write_10(struct Drawer* d, unsigned long val) { +void write_10(struct Drawer* d, unsigned long val) +{ write_c10(d, val, 0xFFFFFF); } + +void set_drawer(struct Drawer* d, unsigned int x, unsigned int y) +{ + d->x = x % GG_MAX_X; + d->y = y % GG_MAX_Y; +} -- cgit v1.2.1