Original Post
Hello,
I''ve got a little problem with getting an input from the keyboard. The user presses and holds an arrow key and the player moves accordingly, although when the key is held the player only initially moves, then pauses for a brief moment, then continues along in a smooth fashion.
Im using code very similar to that used in the nexe keyboard tutorial (which, apparently is also very similar to that of the DX SDK).
Here is the processing of the keyboard input
I have set the cooperative level as NONEXCLUSIVE FOREGROUND.
Regards,
bangz.
http://www.thebigredhouse.co.uk - vote Richard Bangs
void KeyboardInput(HWND hwnd)
{
hr = lpDIDEVICE8->GetDeviceState(sizeof(UCHAR)*256,(LPVOID) buffer);
if(hr == DIERR_INPUTLOST)
{
//reaquire iterface
hr = lpDIDEVICE8->Acquire();
if(FAILED(hr))
{
DIShutdown();
}
}
if(KEYDOWN(buffer,DIK_RIGHT))
{
g_paddle.Translate(0.05, 0);
}
else if(KEYDOWN(buffer,DIK_LEFT))
{
g_paddle.Translate(-0.05, 0);
}
}