aboutsummaryrefslogtreecommitdiff
path: root/src/window.h
diff options
context:
space:
mode:
authorAdrian Kummerlaender2018-05-25 23:47:27 +0200
committerAdrian Kummerlaender2018-05-25 23:48:59 +0200
commitf728e4c8d202de241673a13ce61570b6acb4bba7 (patch)
treea7e29c4319f0e6d667b98f359ddf089c0565c15a /src/window.h
parent5157658ec0cc07d2c56c978ca010cbb78236439f (diff)
downloadcomputicle-f728e4c8d202de241673a13ce61570b6acb4bba7.tar
computicle-f728e4c8d202de241673a13ce61570b6acb4bba7.tar.gz
computicle-f728e4c8d202de241673a13ce61570b6acb4bba7.tar.bz2
computicle-f728e4c8d202de241673a13ce61570b6acb4bba7.tar.lz
computicle-f728e4c8d202de241673a13ce61570b6acb4bba7.tar.xz
computicle-f728e4c8d202de241673a13ce61570b6acb4bba7.tar.zst
computicle-f728e4c8d202de241673a13ce61570b6acb4bba7.zip
Restructure source directory
Diffstat (limited to 'src/window.h')
-rw-r--r--src/window.h62
1 files changed, 0 insertions, 62 deletions
diff --git a/src/window.h b/src/window.h
deleted file mode 100644
index 794dd5f..0000000
--- a/src/window.h
+++ /dev/null
@@ -1,62 +0,0 @@
-#pragma once
-
-#include <GL/glew.h>
-#include <GLFW/glfw3.h>
-
-class Window {
-private:
- bool _good = false;
- int _width = 800;
- int _height = 600;
-
- GLFWwindow* const _handle;
-
-public:
- Window(const std::string& title):
- _handle(glfwCreateWindow(_width, _height, title.c_str(), NULL, NULL)) {
- if ( _handle != nullptr ) {
- glfwMakeContextCurrent(_handle);
- if ( glewInit() == GLEW_OK ) {
- _good = true;
- }
- glfwMakeContextCurrent(nullptr);
- }
- }
-
- bool isGood() const {
- return _good;
- }
-
- int getWidth() const {
- return _width;
- }
-
- int getHeight() const {
- return _height;
- }
-
- template <class F>
- void init(F f) {
- glfwMakeContextCurrent(_handle);
- f();
- glfwMakeContextCurrent(nullptr);
- }
-
- template <class F>
- void render(F loop) {
- glfwMakeContextCurrent(_handle);
-
- while ( glfwGetKey(_handle, GLFW_KEY_ESCAPE ) != GLFW_PRESS &&
- glfwWindowShouldClose(_handle) == 0 ) {
- glfwGetWindowSize(_handle, &_width, &_height);
-
- loop();
-
- glfwSwapBuffers(_handle);
- glfwPollEvents();
- }
-
- glfwMakeContextCurrent(nullptr);
- }
-
-};