title: Is there a way to process only one input event after a key is pressed using GLFW?
body: <p>Currently, when holding down the desired key, the input registers multiple times. Is there a way to process only the first event after the key is pressed and ignore the following events until the key is released? </p>
  
  <p>I'm using a processInput function, with the following condition:</p>
  
  <pre><code>if (glfwGetKey(window, GLFW_KEY_LEFT) == GLFW_PRESS) {
          currentXPos--;
          if (currentXPos &lt; 0)
              currentXPos = 0;
  }
  </code></pre>
  
  <p><code>currentXPos</code> is just an integer that's affected by the left/right arrow keys. I have an equivalent <code>currentYPos</code> integer also that's affected by the up/down arrow keys. I need to increment/decrement currentXPos once per key-press. I've tried adding a global bool initially set to true and on execution setting it to false, like this:</p>
  
  <pre><code>if (glfwGetKey(window, GLFW_KEY_LEFT) == GLFW_PRESS) {
          if (canMove) {
              canMove = false;
              currentXPos--;
              if (currentXPos &lt; 0)
                  currentXPos = 0;
          }
  }
  
  if (glfwGetKey(window, GLFW_KEY_LEFT) == GLFW_RELEASE) {
          canMove = true;
  }
  </code></pre>
  
  <p>This does work with the single key, but if I implement this functionality with the right arrow key as well, (for incrementing the same value), the below function constantly returns GLFW_RELEASE after the first release, setting the canMove bool to true and ultimately making it redundant;</p>
  
  <pre><code>if (glfwGetKey(window, GLFW_KEY_RIGHT) == GLFW_RELEASE) {
              canMove = true;
  }
  </code></pre>
  
  <p>I've tried using glfwWaitEvents() but that still processes multiple inputs when help for longer than 0.5 seconds or so (the same effect as holding down any character on the keyboard in a search bar/text editor).</p>