I think I now understand your issue - I think your problem is with the callback and the action GLFW_REPEAT
.
GLFW does handle mutliple GLFW_PRESS
or GLFW_RELEASE
events on the same frame, but Windows only generates repeat events for one key, and only does so at a specific regular frequency not your application frame rate.
Basically GLFW_REPEAT
is not intended for multiple physical key input, it’s designed for typing words like aaaaaaaaaaaarrrrrrrrrrrrrrrrggggggggghhhh. I think we should consider adding a note to the documentation to clarify this.
So if you want to know which key is down on a given frame you need to keep a state of the keys you’re interested in, or better yet just keep the state of what action you map each key to:
static in move_forwards = 0;
static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
{
if( key == 'W' )
{
if( GLFW_RELEASE == action )
{
move_forwards = 0;
}
else
{
move_forwards = 1;
}
}
}
Edit: I’ve added an issue about the documentation: https://github.com/glfw/glfw/issues/1596