Files
Archimedes/modules/Window/src/WindowImpl/GLFW/windowGLFW.cpp
2025-03-17 10:28:58 -05:00

37 lines
661 B
C++

#include "Archimedes.h"
#include "windowGLFW.h"
Window::Window() {
glfwSetErrorCallback([](int e, const char* m){
std::cout << "GLFW Error: " << m << std::endl;
});
if(!glfwInit()) {
std::cout << "glfwInit failed!\n";
std::abort();
}
w = glfwCreateWindow(640, 480, "Archimedes", NULL, NULL);
if(!w) {
glfwTerminate();
std::abort();
}
glfwMakeContextCurrent(w);
}
bool Window::shouldClose() {
return glfwWindowShouldClose(w);
}
void Window::doFrame() {
glClear(GL_COLOR_BUFFER_BIT);
glfwSwapBuffers(w);
glfwPollEvents();
}
Window::~Window() {
glfwTerminate();
}