// // Created by kam on 9/19/26. // #include "Window.h" #include #include using namespace Snail; /* Window::Window(s32 width, s32 height, const char* title) : width(width), height(height), handle{glfwCreateWindow(width, height, title, nullptr, nullptr)} { if (handle == nullptr) { throw std::runtime_error("Failed to create GLFW window"); } } */ Window::Window(s32 width, s32 height, GLFWwindow* handle) : width(width), height(height), handle(handle) { } bool Window::loop() const { if (glfwWindowShouldClose(handle)) return false; frame(); return true; } void Window::frame() const { glfwSwapBuffers(handle); glfwPollEvents(); glClearColor(0.f, 0.f, 0.f, 1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); } void Window::close() { glfwSetWindowShouldClose(handle, true); } Window make_window(s32 width, s32 height, GLFWwindow *handle) { return Window{width, height, handle}; }