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.c37
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;
+}