Something went wrong. Try again.
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253//// Created by kam on 9/19/26.//
#include "Window.h"#include <GLFW/glfw3.h>#include <stdexcept>
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};}