diff options
author | Christian Cunningham <cc@localhost> | 2021-12-24 15:21:54 -0800 |
---|---|---|
committer | Christian Cunningham <cc@localhost> | 2021-12-24 15:21:54 -0800 |
commit | 3a366988a0077474075d8f33ad76514d2fa0c5d6 (patch) | |
tree | 7aa293e59bee8308825e029069d395c628d230cd /src/graphics/drawer.c | |
parent | d44bf5acb015edaeacc022f423bae4743b868f53 (diff) |
Standardized Formatting
Diffstat (limited to 'src/graphics/drawer.c')
-rw-r--r-- | src/graphics/drawer.c | 37 |
1 files changed, 23 insertions, 14 deletions
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; +} |