Advertisement

more directx9 tutorial

Started by March 18, 2021 09:42 PM
10 comments, last by pbivens67 3 years, 8 months ago

I am trying to get my paddle sprite to move but it won't move at all. Here is my keyboard input code.

//WindowProc - Handles input sent to the window.
LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	switch(message)
	{
	case WM_DESTROY:
		{
			PostQuitMessage(0);
			return 0;
		} break;
	case WM_CLOSE:
		{
			PostQuitMessage(0);
			return 0;
		} break;
	case WM_KEYDOWN:
	{
		switch (wParam)
		{
		case VK_LEFT:
			move_x--;
			InvalidateRect(hWnd, NULL, FALSE);
			break;
		case VK_RIGHT:
			move_x++;
			InvalidateRect(hWnd, NULL, FALSE);
			break;
		} break;
	} break;

	}

	return DefWindowProc(hWnd, message, wParam, lParam);
}

This topic is closed to new replies.

Advertisement