There is a code written in Java :

public class KeyCallback extends GLFWKeyCallback { public static final boolean[] keys = new boolean[65536]; @Override public void invoke(long window, int key, int scancode, int action, int mods) { keys[key] = action != GLFW.GLFW_RELEASE; } } 

How to write the same thing, only in C ++ ?

  • rewrite the whole class in C ++? - Mikhail Vaysman

1 answer 1

KeyCallback.h

 class KeyCallback : public GLFWKeyCallback { public : static bool keys[]; void invoke(long window, int key, int scancode, int action, int mods) override; } 

KeyCallback.cpp

 void KeyCallback::invoke(long window, int key, int scancode, int action, int mods) { keys[key] = action != GLFW.GLFW_RELEASE; } bool KeyCallback::keys[] = new bool[65536] 
  • Thank! I just declared the array did keys [65536] and because of this I got errors) - ARTEM Frolov