summaryrefslogtreecommitdiff
path: root/src/core.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core.c')
-rw-r--r--src/core.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/core.c b/src/core.c
index 0cbaa09..e1ffeab 100644
--- a/src/core.c
+++ b/src/core.c
@@ -27,16 +27,21 @@ void core_bringup(const char* window_name, struct GLFWwindow* optional_window) {
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
char* full_window_name = malloc(sizeof(char) * 100);
- int _offset = sprintf(full_window_name, "%s (%s)", window_name, gapi);
+ sprintf(full_window_name, "%s (%s)", window_name, gapi);
+
+ if (optional_window) {
+ g_core.window = optional_window;
+ } else {
+ GLFWwindow* glfw_window = glfwCreateWindow(800, 600, full_window_name, NULL, NULL);
+ g_core.window = glfw_window;
+ }
- GLFWwindow* glfw_window = glfwCreateWindow(800, 600, full_window_name, NULL, NULL);
- g_core.window = glfw_window;
// This may move into a renderer struct
- ral_backend_init(window_name, glfw_window);
+ ral_backend_init(window_name, g_core.window);
- glfwSetKeyCallback(glfw_window, key_callback);
- glfwSetFramebufferSizeCallback(glfw_window, resize_callback);
+ glfwSetKeyCallback(g_core.window, key_callback);
+ glfwSetFramebufferSizeCallback(g_core.window, resize_callback);
}
void core_shutdown() {
ral_backend_shutdown();