summaryrefslogtreecommitdiff
path: root/src/core.c
diff options
context:
space:
mode:
authorOmniscient <17525998+omnisci3nce@users.noreply.github.com>2024-02-24 22:47:46 +1100
committerOmniscient <17525998+omnisci3nce@users.noreply.github.com>2024-02-24 22:47:46 +1100
commit7b3afcaf77f96e7d62f6cd1623ead7f17512d79f (patch)
treeb5f82c64e9c06a84e4d095ab4ac48712e860b673 /src/core.c
parentb047be5252aeb981faea077409c1768fda0301d9 (diff)
repo init. partial port of existing code
Diffstat (limited to 'src/core.c')
-rw-r--r--src/core.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/core.c b/src/core.c
new file mode 100644
index 0000000..affd8c8
--- /dev/null
+++ b/src/core.c
@@ -0,0 +1,52 @@
+#include "core.h"
+
+#include <stdlib.h>
+
+#include "log.h"
+#include "render.h"
+#include "render_types.h"
+#include "threadpool.h"
+
+#define SCR_WIDTH 1080
+#define SCR_HEIGHT 800
+
+core* core_bringup() {
+ INFO("Initiate Core bringup");
+ core* c = malloc(sizeof(core));
+ renderer_config conf = { .window_name = { "Celeritas Engine Core" },
+ .scr_width = SCR_WIDTH,
+ .scr_height = SCR_HEIGHT,
+ .clear_colour = (vec3){ .08, .08, .1 } };
+ c->renderer.config = conf;
+ c->renderer.backend_state = NULL;
+
+ threadpool_create(&c->threadpool, 6, 256);
+ threadpool_set_ctx(&c->threadpool, c); // Gives the threadpool access to the core
+
+ // initialise all subsystems
+ if (!renderer_init(&c->renderer)) {
+ // FATAL("Failed to start renderer");
+ ERROR_EXIT("Failed to start renderer\n");
+ }
+ if (!input_system_init(&c->input, c->renderer.window)) {
+ // the input system needs the glfw window which is created by the renderer
+ // hence the order here is important
+ FATAL("Failed to start input system");
+ ERROR_EXIT("Failed to start input system\n");
+ }
+ /*
+ if (!text_system_init(&c->text)) {
+ // FATAL("Failed to start text system");
+ ERROR_EXIT("Failed to start text system\n");
+ }
+ if (!screenspace_2d_init(&c->screenspace)) {
+ // FATAL("Failed to start screenspace 2d plugin");
+ ERROR_EXIT("Failed to start screenspace 2d plugin\n");
+ }
+ */
+
+ // c->underworld.models = model_darray_new(10);
+ // c->underworld.renderables = render_entity_darray_new(10);
+
+ return c;
+} \ No newline at end of file