title: GetAsyncKeyState() very CPU heavy? Am I using it correctly?
body: <p>I am using GetAsyncKeyState() in a simple pong game of mine to check if the user has pressed the arrow keys. I read online that you need to use this function a certain way however I found out that it is very CPU heavy (using 50% of my CPU!). This was rather disconcerting, however, after some playing around I found out that if I added a <code>sleep(1);</code> then the CPU usage went down to 0% and everything still worked fine. There must be a better way of using this function or at least a better way of lowering CPU usage. </p>
  
  <p>Any help here would be much appreciated!</p>
  
  <p>My Code:</p>
  
  <pre><code>while(true)
  {
      for(i = 8; i &lt; 191; ++i)
      {
          if(GetAsyncKeyState(i) == -32767)
          {
              if(i == VK_LEFT)
                   // do stuff
              else if(i == VK_RIGHT)
                   // do stuff
              else if(i == VK_UP)
                   // do stuff
              else if(i == VK_DOWN)
                   // do stuff
          }
      }
      Sleep(1);
  }
  </code></pre>