I"m currently building a game using Borland C++ Builder 6, and am having trouble detecting a key press. I have a game loop where I do everything (drawing, key presses, etc).

Here is the game loop

Code:
void __fastcall TForm1::GameLoop(TObject*, bool &done)
{

...


   //Key presses are acted upon here
  if (keys.right == true)
    {
      User->MoveRight();
         Draw(BackBuffer, User, Baddy, ClientRect, BackGround, laser,missile, Health);
    }

  if (keys.left == true)
    {
        User->MoveLeft();
         Draw(BackBuffer, User, Baddy, ClientRect, BackGround, laser, missile, Health);

    }

  if (keys.up == true)
  {
        User->MoveUp();
         Draw(BackBuffer, User, Baddy, ClientRect, BackGround, laser, missile, Health);
  }

  if (keys.down == true)
  {
   User->MoveDown();
         Draw(BackBuffer, User, Baddy, ClientRect, BackGround, laser, missile, Health);
  }

done = false;

}
and get key presses here...


Code:
void __fastcall TForm1::FormKeyUp(TObject *Sender, WORD &Key, TShiftState Shift)
{
 if (Key == VK_RIGHT)  //move piece right
    {
        keys.right = false;
    }

  if (Key == VK_LEFT)
    {
     keys.left = false;
    }

  if (Key==VK_UP)
  {
     keys.up = false;
  }

  if (Key == VK_DOWN)
  {
    keys.down = false;
  }

}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormKeyDown(TObject *Sender, WORD &Key, TShiftState Shift)
{
 if (Key == VK_ESCAPE) Application->Terminate();

 if (Key == VK_RIGHT)  //move piece right
    {
        keys.right = true;
    }

  if (Key == VK_LEFT)
    {
     keys.left = true;
    }

  if (Key==VK_UP)
  {
     keys.up = true;
  }

  if (Key == VK_DOWN)
  {
    keys.down = true;
  }
}
and the struct keys is declared properly

When I press a key, nothing happens.

If anyone can help, that would be great!

Thx!