summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorDanny Holman <dholman@gymli.org>2024-09-17 02:20:35 -0500
committerDanny Holman <dholman@gymli.org>2024-09-17 02:20:35 -0500
commit70c912b7d545515823d0b06953a8afe0253ab09c (patch)
tree1a7338116ff057c67795e6da93190d4c9bee9e62 /core
parent4c4314bb0e183d71c7e9f6c71ddccf55a1eed5a5 (diff)
core: add several new files
Add several new files to the core subsystem. These files will be the basic building blocks upon which the rest of the engine will sit atop of. These files will be present in all builds, including headless and platform builds. Signed-off-by: Danny Holman <dholman@gymli.org>
Diffstat (limited to 'core')
-rw-r--r--core/callbacks.c6
-rw-r--r--core/init.c23
-rw-r--r--core/logging.c2
3 files changed, 30 insertions, 1 deletions
diff --git a/core/callbacks.c b/core/callbacks.c
new file mode 100644
index 0000000..8cda252
--- /dev/null
+++ b/core/callbacks.c
@@ -0,0 +1,6 @@
+#include <rune/core/callbacks.h>
+#include <stdio.h>
+
+void error_callback(int error, const char *desc) {
+ fprintf(stderr, "Error %d: %s\n", error, desc);
+}
diff --git a/core/init.c b/core/init.c
new file mode 100644
index 0000000..e56a1ec
--- /dev/null
+++ b/core/init.c
@@ -0,0 +1,23 @@
+#include <rune/core/init.h>
+#include <rune/core/alloc.h>
+#include <rune/core/logging.h>
+#include <rune/ui/window.h>
+#include <rune/ui/renderer.h>
+#include <rune/ui/input.h>
+
+static struct rune_window *window;
+static struct rune_renderer *renderer;
+
+struct rune_window* rune_init(uint32_t width, uint32_t height, const char *title) {
+ log_output(LOG_INFO, "Started Rune Engine version %s", VERSION);
+ window = rune_create_window(width, height, title);
+ rune_input_init(window);
+ renderer = rune_create_renderer(window, RUNE_RENDERER_VULKAN);
+}
+
+void rune_exit(void) {
+ log_output(LOG_INFO, "Engine shutdown requested");
+ rune_destroy_renderer(renderer);
+ rune_destroy_window(window);
+ rune_free_all();
+}
diff --git a/core/logging.c b/core/logging.c
index 7f127f3..98ee55b 100644
--- a/core/logging.c
+++ b/core/logging.c
@@ -1,4 +1,4 @@
-#include <rune/logging.h>
+#include <rune/core/logging.h>
#include <stdio.h>
#include <string.h>
#include <stdarg.h>