I've created a class called InputControl. I am using a library called GLFW, and a function glfwSetKeyCallback. The function is defined as:
GLFWkeyfun glfwSetKeyCallback ( GLFWwindow * window, GLFWkeyfun cbfun )
Typedef is as follows:
typedef void(* GLFWkeyfun) (GLFWwindow *, int, int, int, int)
The issue is that I can not convert my method to a function pointer. I feel like I've tried to cast it in every way possible. I'm not sure how else I need to cast this method. Is there something that is specific for passing a relative method as a function pointer? My code is as follows:
#pragma once
#include <GLFW/glfw3.h>
#include "config.h"
class InputControl {
public:
void bind();
void unbind();
private:
void __glfw__keycallback_bind(GLFWwindow* window, int key, int scancode, int action, int mods);
};
InputControl.cpp
void InputControl::bind() {
glfwSetKeyCallback(__application__window, __glfw__keycallback_bind);
}
void InputControl::unbind() {
}
void InputControl::__glfw__keycallback_bind(GLFWwindow * window, int key, int scancode, int action, int mods) {
//... other code here
}
Visual Studio gives me the following error
E0167 argument of type "void (InputControl::*)(GLFWwindow *window, int key, int scancode, int action, int mods)" is incompatible with parameter of type "GLFWkeyfun"