Original Post
Hi guys. I have input processing like this. How can I arrange it so that I can have simultaneous input? Basically, whats happening in the game is once I press a key to move an object, and then press another key to move the second object, the second object does not move and only the first does. The second object only moves after I let go of both keys and press the move key for the second object. The question is, how can I make it so that both objects will move when I press both keys at once?
LRESULT D3DPong::WndProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch(uMsg)
{
case WM_KEYDOWN:
if(wParam == VK_ESCAPE)
{
// Exit when escape is pressed
m_bShouldExit = true;
}
else if(wParam == VK_RETURN)
{
// Toggle windowed / fullscreen
m_thePresentParams.Windowed = !m_thePresentParams.Windowed;
ResetDevice();
}
else if(wParam == VK_LEFT)//1ST PADDLE - LEFT
{
m_paddleOnePos.x -= m_fPaddleSpeed;
if(m_paddleOnePos.x < -(m_coordWidth/2))
m_paddleOnePos.x = -(m_coordWidth/2);
}
else if(wParam == VK_RIGHT)//1ST PADDLE - RIGHT
{
m_paddleOnePos.x += m_fPaddleSpeed;
if(m_paddleOnePos.x > (m_coordWidth / 2 - m_paddleTexW))
m_paddleOnePos.x = (m_coordWidth / 2 - m_paddleTexW);
}
else if(wParam == 'A')//2ND PADDLE - LEFT
{
m_paddleTwoPos.x -= m_fPaddleSpeed;
// m_paddleTwoPos.x -= m_paddleTexW;
if(m_paddleTwoPos.x < -(m_coordWidth/2))
m_paddleTwoPos.x = -(m_coordWidth/2);
}
else if(wParam == 'D')//2ND PADDLE - RIGHT
{
m_paddleTwoPos.x += m_fPaddleSpeed;
if(m_paddleTwoPos.x > ((m_coordWidth/2) - m_paddleTexW))
m_paddleTwoPos.x = ((m_coordWidth/2) - m_paddleTexW);
}
break;
}
// Pass all messages along to parent class
return D3DWindow::WndProc(uMsg, wParam, lParam);
}