I am trying to create a callback in a plugin that I wrote for GLFW, and its purpose is to retrieve keys that have been pressed on the keyboard. How do I make a callback in Xojo for a Plugin callback?
The raw C++ code is:
GLFWSetKeyCallback(GLFWWindow* window, GLFWkeyfun callback)
My example program initializes this call in a button pressed event:
Sub Pressed() Handles Pressed Call GLFWSS.glfwSetKeyCallback(Window1.Handle, AddressOf key_callback) End Sub
Public Sub key_callback(win as Ptr, aKey as Int32, aScancode as Int32, aAction as Int32, aMods as Int32) TextArea1.text = TextArea1.text + "Key Pressed" End Sub
Here is a simple example program. PluginCallback1.xojo_binary_project PluginCallback1
key_callback doesn’t fire, and no text is shown in the TextArea1 control. Does anyone have helpful thoughts on how to get the callback to fire?
OS: Windows 11
Xojo 2022 r3.2