12345678910111213141516171819202122232425262728293031 |
- #include <iostream>
- #include <GL/glew.h>
- #include <GLFW/glfw3.h>
- #include "rendering/wrapper/GLFWWrapper.h"
- struct GLFWInit final {
- bool error;
- GLFWInit() : error(glfwInit() == GLFW_FALSE) {
- if(error) {
- std::cout << "could not initialize GLFW\n";
- }
- }
- ~GLFWInit() {
- if(!error) {
- glfwTerminate();
- }
- }
- };
- static GLFWInit init;
- bool GLFWWrapper::hasError() {
- return init.error;
- }
- u64 GLFWWrapper::getTimeNanos() {
- return glfwGetTimerValue() * (1000000000 / glfwGetTimerFrequency());
- }
|