From 4be8d68a57a4a551379b886633fd52a50fbe6d70 Mon Sep 17 00:00:00 2001 From: firewire Date: Sat, 11 Apr 2026 18:08:31 -0400 Subject: [PATCH] Basic glfw window --- examples/basicGLFWWindow/main.cpp | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/examples/basicGLFWWindow/main.cpp b/examples/basicGLFWWindow/main.cpp index b0c263b..7f54828 100644 --- a/examples/basicGLFWWindow/main.cpp +++ b/examples/basicGLFWWindow/main.cpp @@ -1,10 +1,35 @@ +#include +#include +#include "GLFW/glfw3.h" #include "shared/logger.h" int main() { OatmealUtils::initLogging(); OatmealUtils::createLogger("window", nullptr); - OatmealUtils::get("window")->info("Test"); + OatmealUtils::get("window")->info("Initializing GLFW"); + glfwInit(); + + OatmealUtils::get("window")->info("Setting window hints"); + glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API); + glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE); + + OatmealUtils::get("window")->info("Create window"); + GLFWwindow *window = glfwCreateWindow(800, 600, "Oatmeal - Basic GLFW window", nullptr, nullptr); + if (window == nullptr) { + const char *desc; + uint32_t code = glfwGetError(&desc); + OatmealUtils::get("window")->critical("Failed to create window: ({}) {}", code, desc); + exit(EXIT_FAILURE); + } + + while (!glfwWindowShouldClose(window)) { + glfwPollEvents(); + } + + OatmealUtils::get("window")->info("Cleaning up"); + glfwDestroyWindow(window); + glfwTerminate(); return 0; }