From 6de3d16fd3e7d98c98cdf73c6a3317e1a6b10184 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Sat, 26 May 2018 23:15:02 +0200 Subject: Add KeyWatcher to handle pausing via space --- src/glfw/window.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/glfw/window.h') 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 #include +#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 void init(F f); @@ -39,8 +43,8 @@ template 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(); -- cgit v1.2.3