diff options
author | Omniscient <omniscient.oce@gmail.com> | 2024-07-11 21:43:06 +1000 |
---|---|---|
committer | Omniscient <omniscient.oce@gmail.com> | 2024-07-11 21:43:06 +1000 |
commit | fedba7ff68924ff50022405fc9103a5acf7013fe (patch) | |
tree | cd4e8ebd21736d460ac0434ce08cc2012bf613e0 /src/core | |
parent | 9f23f65ec631bcd08f200b3ef517da8acf8d6b17 (diff) |
wip
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/core.c | 36 | ||||
-rw-r--r-- | src/core/core.h | 20 |
2 files changed, 18 insertions, 38 deletions
diff --git a/src/core/core.c b/src/core/core.c index 1d8fe91..a022366 100644 --- a/src/core/core.c +++ b/src/core/core.c @@ -10,48 +10,42 @@ #include "render.h" #include "render_types.h" #include "scene.h" -// #include "threadpool.h" #define SCR_WIDTH 1000 #define SCR_HEIGHT 1000 -core g_core; /** @brief global `core` that other files can use */ +Core g_core; /** @brief global `Core` that other files can use */ -inline core* get_global_core() { return &g_core; } + +struct Core { + const char* app_name; + Renderer renderer; + input_state input; + model_pool models; +}; + +/** @brief Gets the global `Core` singleton */ +inline Core* GetCore() { return &g_core; } void core_bringup() { INFO("Initiate Core bringup"); - renderer_config conf = { .window_name = { "Celeritas Engine Core" }, + RendererConfig conf = { .window_name = { "Celeritas Engine Core" }, .scr_width = SCR_WIDTH, .scr_height = SCR_HEIGHT, .clear_colour = (vec3){ .08, .08, .1 } }; - g_core.renderer.config = conf; - g_core.renderer.backend_context = NULL; - // threadpool_create(&c->threadpool, 6, 256); - // threadpool_set_ctx(&c->threadpool, c); // Gives the threadpool access to the core + g_core.renderer.backend_context = NULL; // initialise all subsystems - if (!renderer_init(&g_core.renderer)) { + if (!Renderer_Init(conf, &g_core.renderer)) { // FATAL("Failed to start renderer"); ERROR_EXIT("Failed to start renderer\n"); } - if (!input_system_init(&g_core.input, g_core.renderer.window)) { + if (!Input_Init(&g_core.input, g_core.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"); - } - */ size_t model_data_max = 1024 * 1024 * 1024; arena model_arena = arena_create(malloc(model_data_max), model_data_max); diff --git a/src/core/core.h b/src/core/core.h index 89702fd..469f8d1 100644 --- a/src/core/core.h +++ b/src/core/core.h @@ -6,23 +6,9 @@ #include "screenspace.h" #include "terrain.h" #include "text.h" -// #include "threadpool.h" - -typedef struct core { - const char* app_name; - // foundations - renderer renderer; - // threadpool threadpool; - // systems - input_state input; - text_system_state text; - terrain_state terrain; - screenspace_state screenspace; - // data storage - scene default_scene; - model_pool models; - // model_darray* models; -} core; + +typedef struct Core Core; + core* get_global_core(); |