38 lines
816 B
C++
38 lines
816 B
C++
#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);
|
|
glfwSwapInterval(1);
|
|
}
|
|
|
|
bool WindowGLFW::shouldClose() {
|
|
return glfwWindowShouldClose(w);
|
|
}
|
|
|
|
void WindowGLFW::doFrame() {
|
|
glfwPollEvents();
|
|
glfwSwapBuffers(w);
|
|
}
|
|
|
|
WindowGLFW::~WindowGLFW() {
|
|
glfwTerminate();
|
|
}
|
|
}
|