work on utils

This commit is contained in:
2025-03-21 13:38:31 -05:00
parent 719af8e85a
commit 7900def444
11 changed files with 113 additions and 76 deletions

View File

@@ -0,0 +1,37 @@
#include "Archimedes.h"
#include "WindowGLFW.h"
namespace Archimedes {
WindowGLFW::WindowGLFW() {
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 WindowGLFW::shouldClose() {
return glfwWindowShouldClose(w);
}
void WindowGLFW::doFrame() {
glClear(GL_COLOR_BUFFER_BIT);
glfwSwapBuffers(w);
glfwPollEvents();
}
WindowGLFW::~WindowGLFW() {
glfwTerminate();
}
}