title: How to glfwSetKeyCallback for different classes?
body: <p>I use <strong>GLFW</strong> and I have different <strong>classes</strong> representing the different <strong>states</strong> in my Application and one state-managing class.
  I want to use GLFW to receive the key-input and pass it to the current state (so to another class).</p>
  
  <p>The only way I could think of was giving each class an own <strong>keycallback</strong>-function and use
  glfwSetKeyCallback(window, keyCallback);</p>
  
  <pre><code>keycallback(GLFWwindow *window, int key, int scancode, int action, int mods)
  </code></pre>
  
  <p>It didn't work that way </p>
  
  <pre><code>cannot convert 'IntroState::handleKeyEvent' from type 'void (IntroState::)(GLFWwindow*, int, int, int, int)' to type 'GLFWkeyfun {aka void (*)(GLFWwindow*, int, int, int, int)}'
       glfwSetKeyCallback(m_manager-&gt;window, handleKeyEvent);
  </code></pre>
  
  <hr>
  
  <p>People recommended something like that:</p>
  
  <pre><code>void GLFWCALL functionname( int key, int action );
  </code></pre>
  
  <p>But the GLFWCALL-macro has been removed from GLFW (<a href="http://www.glfw.org/docs/3.0/moving.html#moving_stdcall" rel="nofollow">Official Note</a>).</p>
  
  <hr>
  
  <p>I have read that you can use a static function.</p>
  
  <pre><code>static void keyCallback(GLFWwindow*, int, int, int);
  </code></pre>
  
  <p>But I need to access non-static member functions and get some problems when the callback-function is static.</p>
  
  <hr>
  
  <h2>The actual question:</h2>
  
  <p>How can I make the current "state"-class get the key-input from GLFW? 
  like</p>
  
  <pre><code>states.back()-&gt;handlekeyEvent(int, int, int);
  </code></pre>