summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorDanny Holman <dholman@gymli.org>2024-08-25 00:18:42 -0500
committerDanny Holman <dholman@gymli.org>2024-08-25 00:18:42 -0500
commit6b13ea53aeedb646b082a13bf16f67f8556087ae (patch)
tree7cf38f381a7af9daa9ad511c8f9abe58b41b119a /core
parenta002576056e26673f0141e46786f44f0b9c90b70 (diff)
core: refactor entire project root
Reorganize the project root such that each subsystem is placed into its own subdirectory. This allows the build system to select which subsystems to enable for a particular build. Signed-off-by: Danny Holman <dholman@gymli.org>
Diffstat (limited to 'core')
-rw-r--r--core/logging.c40
-rw-r--r--core/make.config6
2 files changed, 46 insertions, 0 deletions
diff --git a/core/logging.c b/core/logging.c
new file mode 100644
index 0000000..e755710
--- /dev/null
+++ b/core/logging.c
@@ -0,0 +1,40 @@
+#include <rune_logging.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdarg.h>
+
+#define LSTR_FATAL "[FATAL]"
+#define LSTR_ERROR "[ERROR]"
+#define LSTR_WARN "[WARNING]"
+#define LSTR_INFO "[INFO]"
+#define LSTR_DEBUG "[DEBUG]"
+
+void log_output(int level, const char *fmt, ...) {
+ char out[8192];
+ memset(out, 0, sizeof(out));
+
+ va_list arg_ptr;
+ va_start(arg_ptr, fmt);
+ vsnprintf(out, 8192, fmt, arg_ptr);
+ va_end(arg_ptr);
+
+ char *lvl_str;
+ switch (level) {
+ case LOG_FATAL:
+ lvl_str = LSTR_FATAL;
+ break;
+ case LOG_ERROR:
+ lvl_str = LSTR_ERROR;
+ break;
+ case LOG_WARN:
+ lvl_str = LSTR_WARN;
+ break;
+ case LOG_INFO:
+ lvl_str = LSTR_INFO;
+ break;
+ case LOG_DEBUG:
+ lvl_str = LSTR_DEBUG;
+ break;
+ }
+ printf("%s %s\n", lvl_str, out);
+}
diff --git a/core/make.config b/core/make.config
new file mode 100644
index 0000000..94dce85
--- /dev/null
+++ b/core/make.config
@@ -0,0 +1,6 @@
+CORE_LDFLAGS=
+CORE_LIBS=-lglfw
+
+CORE_OBJS=$(COREDIR)/graphics.o \
+ $(COREDIR)/init.o \
+ $(COREDIR)/logging.o \