aboutsummaryrefslogtreecommitdiff
path: root/src/glfw/window.h
diff options
context:
space:
mode:
authorAdrian Kummerlaender2018-05-26 23:15:02 +0200
committerAdrian Kummerlaender2018-05-26 23:15:02 +0200
commit6de3d16fd3e7d98c98cdf73c6a3317e1a6b10184 (patch)
tree5292545e66c32735f2d157ac4406d211094c12e0 /src/glfw/window.h
parent6ce077f58779376481ab498ca4e1df60c1e2eee3 (diff)
downloadcomputicle-6de3d16fd3e7d98c98cdf73c6a3317e1a6b10184.tar
computicle-6de3d16fd3e7d98c98cdf73c6a3317e1a6b10184.tar.gz
computicle-6de3d16fd3e7d98c98cdf73c6a3317e1a6b10184.tar.bz2
computicle-6de3d16fd3e7d98c98cdf73c6a3317e1a6b10184.tar.lz
computicle-6de3d16fd3e7d98c98cdf73c6a3317e1a6b10184.tar.xz
computicle-6de3d16fd3e7d98c98cdf73c6a3317e1a6b10184.tar.zst
computicle-6de3d16fd3e7d98c98cdf73c6a3317e1a6b10184.zip
Add KeyWatcher to handle pausing via space
Diffstat (limited to 'src/glfw/window.h')
-rw-r--r--src/glfw/window.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/glfw/window.h b/src/glfw/window.h
index b858e9a..520b5e8 100644
--- a/src/glfw/window.h
+++ b/src/glfw/window.h
@@ -5,6 +5,8 @@
#include <GL/glew.h>
#include <GLFW/glfw3.h>
+#include "key_watcher.h"
+
class Window {
private:
bool _good = false;
@@ -21,6 +23,8 @@ public:
int getWidth() const;
int getHeight() const;
+ KeyWatcher getKeyWatcher(int key);
+
template <class F>
void init(F f);
@@ -39,8 +43,8 @@ template <class F>
void Window::render(F loop) {
glfwMakeContextCurrent(_handle);
- while ( glfwGetKey(_handle, GLFW_KEY_ESCAPE ) != GLFW_PRESS &&
- glfwWindowShouldClose(_handle) == 0 ) {
+ while ( glfwGetKey(_handle, GLFW_KEY_ESCAPE) != GLFW_PRESS &&
+ glfwWindowShouldClose(_handle) == 0 ) {
glfwGetWindowSize(_handle, &_width, &_height);
loop();