Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

C++ keyboard D, A, S, W key suport

ok, when trying to add the keys D A S W to my program it says that they are undefined. here is the code:

[code]
void HandleKeys()
{
if (!g_bGameOver)
{
// Steer the blue light cycle in response to arrow key presses
if (GetAsyncKeyState(VK_UP) < 0)
SteerCycle(0, 0);
else if (GetAsyncKeyState(VK_RIGHT) < 0)
SteerCycle(0, 1);
else if (GetAsyncKeyState(VK_DOWN) < 0)
SteerCycle(0, 2);
else if (GetAsyncKeyState(VK_LEFT) < 0)
SteerCycle(0, 3);
// Steer the orange cycle in response to specified key presses
else if (GetAsyncKeyState(VK_W) < 0)
SteerCycle(1, 0);
else if (GetAsyncKeyState(VK_D) < 0)
SteerCycle(1, 1);
else if (GetAsyncKeyState(VK_S) < 0)
SteerCycle(1, 2);
else if (GetAsyncKeyState(VK_A) < 0)
SteerCycle(1, 3);

}
else if (GetAsyncKeyState(VK_RETURN) < 0)
NewGame();
}
[/code]

any clue?

Comments

  • DarkLynxMoonDarkLynxMoon Member Posts: 14
    by the way, the HandleKeys() function contains game specific code. The protocol for it is in my game engine header along with any other code required, but all that there is is the void HandleKeys() in my game engine header and a call to HandleKeys() in my trigger that checks the keyboard state every tick so that it's responsive. (the win32 api has shitty keyboard handleing functions)
Sign In or Register to comment.