The behavior you're seeing is normal and depends on the OS and the keyboard hardware/driver. It will become clear if you just print the callback events, instead of printing the current state of the down/pressed/released arrays:
- You first get a GLFW_PRESS event for the key.
- After some time (several hundred milliseconds at least), the OS starts sending repeat events and you get your first GLFW_REPEAT event.
- The GLFW_REPEAT events have lower frequency than your event loop (the number of times you call glfwPollEvents()).
I call glfwPollEvents() every update which runs at 60 FPS but judging from the print to console it seems like invoke is only called about 20 times per second if I hold down a button constantly. Is there a way to control this or perhaps some good alternative way I can set up keyboard control without using the callback?
Even if you could, it's bad practice. You shouldn't mess with the user's keyboard repeat rate, it's a personal preference.
You could implement your own event repeating though; start a timer/counter on GLFW_PRESS and fire an event every x frames/milliseconds, where x is the repeat rate you want. Stop on GLFW_RELEASE.
I'm trying to track when a button is pressed for the first time. Am I wrong to assume that is what "GLFW_PRESS" does, cause it seems to be doing that but pressed[key] doesn't get set to false until a second has passed.
Correct, GLFW_PRESS is fired only once, the moment the key is pressed. As I explained above, the behavior you're seeing is caused by the code you used, simply because the first GLFW_REPEAT event is delayed.