I am trying to move a pong paddle but I can't seem to get it to move.
float x = 0.0f, y = 0.0f;
// this is the main message handler for the program
LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_DESTROY:
{
PostQuitMessage(0);
return 0;
}
case WM_KEYDOWN:
{
if (wParam == VK_UP)
{
y--;
}
if (wParam == VK_DOWN)
{
y++;
}
}
break;
}
return DefWindowProc(hWnd, message, wParam, lParam);
}
void init_graphics(void)
{
// create the vertices using the CUSTOMVERTEX struct
CUSTOMVERTEX vertices[] =
{
{ 0.0f, 250.0f+y, 0.0f, 1.0f, D3DCOLOR_XRGB(255, 0, 0), },
{ 25.0f, 250.0f+y, 0.0f, 1.0f, D3DCOLOR_XRGB(255, 0, 0), },
{ 0.0f, 350.0f+y, 0.0f, 1.0f, D3DCOLOR_XRGB(255, 0, 0), },
{ 25.0f, 350.0f+y, 0.0f, 1.0f, D3DCOLOR_XRGB(255, 0, 0), },
{ 775.0f, 250.0f, 0.0f, 1.0f, D3DCOLOR_XRGB(0, 0, 255), },
{ 800.0f, 250.0f, 0.0f, 1.0f, D3DCOLOR_XRGB(0, 0, 255), },
{ 775.0f, 350.0f, 0.0f, 1.0f, D3DCOLOR_XRGB(0, 0, 255), },
{ 800.0f, 350.0f, 0.0f, 1.0f, D3DCOLOR_XRGB(0, 0, 255), },
{ 395.0f, 295.0f, 0.0f, 1.0f, D3DCOLOR_XRGB(255, 255, 255), },
{ 405.0f, 295.0f, 0.0f, 1.0f, D3DCOLOR_XRGB(255, 255, 255), },
{ 395.0f, 305.0f, 0.0f, 1.0f, D3DCOLOR_XRGB(255, 255, 255), },
{ 405.0f, 305.0f, 0.0f, 1.0f, D3DCOLOR_XRGB(255, 255, 255), },
};