summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authoromniscient <17525998+omnisci3nce@users.noreply.github.com>2024-07-26 13:40:31 +1000
committeromniscient <17525998+omnisci3nce@users.noreply.github.com>2024-07-26 13:40:31 +1000
commite0a047ac1e2cf18c3b0f23f31f869eeda767503e (patch)
treea14e3eccec6e845778798fe24acc4c85f8e4da4b /src/core
parentb28de1c7c87683b0645368f5393734f1db4ffd74 (diff)
try getting glfw passthrough and egui to work
Diffstat (limited to 'src/core')
-rw-r--r--src/core/core.c9
-rw-r--r--src/core/core.h9
2 files changed, 14 insertions, 4 deletions
diff --git a/src/core/core.c b/src/core/core.c
index 38777ba..d508de8 100644
--- a/src/core/core.c
+++ b/src/core/core.c
@@ -20,7 +20,7 @@ Core g_core; /** @brief global `Core` that other files can use */
/** @brief Gets the global `Core` singleton */
inline Core* GetCore() { return &g_core; }
-void Core_Bringup() {
+void Core_Bringup(struct GLFWwindow* optional_window) {
INFO("Initiate Core bringup");
memset(&g_core, 0, sizeof(Core));
@@ -31,10 +31,15 @@ void Core_Bringup() {
g_core.renderer = malloc(Renderer_GetMemReqs());
// initialise all subsystems
- if (!Renderer_Init(conf, g_core.renderer, &g_core.window)) {
+ // renderer config, renderer ptr, ptr to store a window, and optional preexisting glfw window
+ if (!Renderer_Init(conf, g_core.renderer, &g_core.window, optional_window)) {
// FATAL("Failed to start renderer");
ERROR_EXIT("Failed to start renderer\n");
}
+ if (optional_window != NULL) {
+ g_core.window = optional_window;
+ }
+
if (!Input_Init(&g_core.input, g_core.window)) {
// the input system needs the glfw window which is created by the renderer
// hence the order here is important
diff --git a/src/core/core.h b/src/core/core.h
index ac07c50..17561f3 100644
--- a/src/core/core.h
+++ b/src/core/core.h
@@ -26,11 +26,16 @@ struct Renderer;
Core* get_global_core();
-/** @brief Throws error if the core cannot be instantiated */
-void Core_Bringup();
+/**
+ @brief Throws error if the core cannot be instantiated
+ @param [in] optional_window - Leave NULL if you want Celeritas to instantiate its own window with GLFW, if you
+ want to provide the glfw window then pass it in here.
+*/
+void Core_Bringup(GLFWwindow* optional_window);
void Core_Shutdown();
bool ShouldExit();
+GLFWwindow* Core_GetGlfwWindowPtr(Core* core);
struct Renderer* Core_GetRenderer(Core* core);
void Frame_Begin();