39 lines
851 B
C++
39 lines
851 B
C++
#include "pch.hpp"
|
|
|
|
#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();
|
|
}
|
|
std::cout << "Window Created!\n";
|
|
glfwMakeContextCurrent(w);
|
|
glfwSwapInterval(1);
|
|
}
|
|
|
|
bool WindowGLFW::shouldClose() {
|
|
return glfwWindowShouldClose(w);
|
|
}
|
|
|
|
void WindowGLFW::getSize(int& w, int& h) {
|
|
glfwGetFramebufferSize(this->w, &w, &h);
|
|
}
|
|
|
|
WindowGLFW::~WindowGLFW() {
|
|
glfwTerminate();
|
|
}
|
|
}
|