Closed Mark-Bowers closed 4 years ago
Sure, as long as it doesn't mess up callbacks or make them slow. I imagine the way to do it is nest the callbacks and optional application pointer into an object, and the pointer to that parent object is what gets attached to the GLFW window.
Thanks, that was the exact approach I had in mind. I'll give it a try.
It turns out I don't need these functions after all. I am now using the following technique:
GLFW.SetKeyCallback(s.window, (w,k,sc,a,m)->keyboard(s,w,k,sc,a,m))
where s
is my context parameter and a local variable in the function that I am calling SetKeyCallback
from and keyboard
is my callback function.
I would like to be able to have access to
glfwSetWindowUserPointer
andglfwGetWindowUserPointer
to avoid having to access a global, variable that contains the application context, from my callback functions. Unfortunately these functions have been appropriated the GLFW package as a way to keep track of a window's registered callbacks.Is there any interest in a PR that supports the
GLFW.SetWindowUserPointer
/GLFW.GetWindowUserPointer
APIs?