title: Handling multiple keys input at once with GLFW
body: <p>I am trying to create basic camera movement with glfwSetKeyCallback function. The problem is it doesn't handle inputting multiple keys at once, like W and A should move it diagonally upper-left direction. Instead it acts like knowing only about last inputted key. So let's say I press A to move left, it goes left, then I press W to go diagonally upper-left, instead it 'forgets' about A being pressed and goes upward.</p>
  
  <pre><code>float cameraSpeed = 0.02f;
      if (key == GLFW_KEY_ESCAPE &amp;&amp; (action == GLFW_PRESS || action == GLFW_REPEAT))
          glfwSetWindowShouldClose(window, GLFW_TRUE);
      if (key == GLFW_KEY_W &amp;&amp; (action == GLFW_PRESS || action == GLFW_REPEAT))
          Game::GetInstance()-&gt;cameraY += cameraSpeed;
      if (key == GLFW_KEY_A &amp;&amp; (action == GLFW_PRESS || action == GLFW_REPEAT))
          Game::GetInstance()-&gt;cameraX -= cameraSpeed;
      if (key == GLFW_KEY_S &amp;&amp; (action == GLFW_PRESS || action == GLFW_REPEAT))
          Game::GetInstance()-&gt;cameraY -= cameraSpeed;
      if (key == GLFW_KEY_D &amp;&amp; (action == GLFW_PRESS || action == GLFW_REPEAT))
          Game::GetInstance()-&gt;cameraX += cameraSpeed;
  </code></pre>
  
  <p>The one solution that got into my mind was like create my own boolean tab of keyboard inputs and use GLFW function only to set them, like:</p>
  
  <pre><code>if (key == GLFW_KEY_A &amp;&amp; action == GLFW_PRESS)
          // set 'A' to true;
  if (key == GLFW_KEY_A &amp;&amp; action == GLFW_RELEASE)
          // set 'A' to false;
  </code></pre>
  
  <p>And then do what I want with it in totally separate function/class/whatever. It doesn't appear clean to me though. What is a good solution to the problem?</p>