Skip to main content
GameDev.net gamedev.net
🔒 Locked

pong dx9

Started by pbivens67 Jan 17, 2023 at 6:35 PM 1 replies 3.6k views
Original Post
pbivens67
pbivens67

I still want to move my pong paddles.

void init_graphics(void)
{
		// create the vertices using the CUSTOMVERTEX struct
		CUSTOMVERTEX vertices[] =
		{
			{ 775.0f, 250.0f + move_paddle, 0.5f, 1.0f, D3DCOLOR_XRGB(0, 255, 0), },
			{ 800.0f, 250.0f + move_paddle, 0.5f, 1.0f, D3DCOLOR_XRGB(0, 255, 0), },
			{ 775.0f, 350.0f + move_paddle, 0.5f, 1.0f, D3DCOLOR_XRGB(0, 255, 0), },
			{ 800.0f, 250.0f + move_paddle, 0.5f, 1.0f, D3DCOLOR_XRGB(0, 255, 0), },
			{ 800.0f, 350.0f + move_paddle, 0.5f, 1.0f, D3DCOLOR_XRGB(0, 255, 0), },
			{ 775.0f, 350.0f + move_paddle, 0.5f, 1.0f, D3DCOLOR_XRGB(0, 255, 0), },

			{ 0.0f, 250.0f, 0.5f, 1.0f, D3DCOLOR_XRGB(255, 0, 0), },
			{ 25.0f, 250.0f, 0.5f, 1.0f, D3DCOLOR_XRGB(255, 0, 0), },
			{ 0.0f, 350.0f, 0.5f, 1.0f, D3DCOLOR_XRGB(255, 0, 0), },
			{ 25.0f, 250.0f, 0.5f, 1.0f, D3DCOLOR_XRGB(255, 0, 0), },
			{ 25.0f, 350.0f, 0.5f, 1.0f, D3DCOLOR_XRGB(255, 0, 0), },
			{ 0.0f, 350.0f, 0.5f, 1.0f, D3DCOLOR_XRGB(255, 0, 0), },

			{ 395.0f, 295.0f, 0.5f, 1.0f, D3DCOLOR_XRGB(255, 255, 255), },
			{ 405.0f, 295.0f, 0.5f, 1.0f, D3DCOLOR_XRGB(255, 255, 255), },
			{ 395.0f, 305.0f, 0.5f, 1.0f, D3DCOLOR_XRGB(255, 255, 255), },
			{ 405.0f, 295.0f, 0.5f, 1.0f, D3DCOLOR_XRGB(255, 255, 255), },
			{ 405.0f, 305.0f, 0.5f, 1.0f, D3DCOLOR_XRGB(255, 255, 255), },
			{ 395.0f, 305.0f, 0.5f, 1.0f, D3DCOLOR_XRGB(255, 255, 255), },
		};
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)
		{
			move_paddle--;
			return 0;
		}
		if (wParam == VK_DOWN)
		{
			move_paddle++;
			return 0;
		}
		break;
	}
	break;
	}
	return DefWindowProc(hWnd, message, wParam, lParam);
}
Tom Sloper
Tom Sloper

Thread locked because OP started a duplicate thread today in another forum.

-- Tom Sloper    --      sloperama.com

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.