use both keyCallback and GetKey


This Content is from Stack Overflow. Question asked by Uhrbaan

I’m currently trying to learn openGL and I am using GLFW.

in the window, I am using the glfwSetKeyCallback function for single key presses/ key combinations (like CTRL + q or ESC for closing window with a switch statement) and I am using another function that runs every few milisecond for constant keypresses (like W for moving forward or A for moving left using multiple if statements)

seperating the two usecases in two different function makes it easier for me, but I was wondering if it was a good idea to use them like that or if I should use all the different usecases in a single function, either the callback or the one that is called every few miliseconds. (I hope that was clear)

Thanks in advance for your advice !


Check the Answers

This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?