From 12829892b262a0c7fcccba9198e5b6b31b2a8015 Mon Sep 17 00:00:00 2001 From: Loic Guegan Date: Thu, 9 Jul 2020 13:02:31 +0200 Subject: Cleaning code --- src/rms.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/rms.cpp') diff --git a/src/rms.cpp b/src/rms.cpp index b7cf93b..a9bb166 100644 --- a/src/rms.cpp +++ b/src/rms.cpp @@ -8,6 +8,12 @@ void OnWindowResize(GLFWwindow* window, int width, int height){ AppContext->renderer.AjustViewport(width,height); } +void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) +{ + if (key == GLFW_KEY_R && action == GLFW_PRESS) + AppContext->renderer.RefreshShader(); +} + int main(int argc, char *argv[]) { GLFWwindow* window; @@ -29,7 +35,7 @@ int main(int argc, char *argv[]) // Init Renderer/OpenGL APP_CONTEXT InitContext={ - Renderer(WIDTH,HEIGHT,"main.glsl"), + Renderer(WIDTH,HEIGHT,"main.frag"), HUD(window) }; AppContext=&InitContext; @@ -37,6 +43,7 @@ int main(int argc, char *argv[]) glfwSetWindowSizeCallback(window, OnWindowResize); + glfwSetKeyCallback(window, key_callback); /* Loop until the user closes the window */ double InitTime = glfwGetTime(); -- cgit v1.2.3