 dx9 pong
I am trying to build a pong game using dx9. I am able to draw a paddle on the left side of the screen. I want to draw a paddle on the right side of the screen. I am very new at dx9.void render_frame(void){d3ddev->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0);d3ddev->BeginScene();// select which vertex format we are usingd3ddev->SetFVF(CUSTOMFVF);// select the vertex buffer to displayd3ddev->SetStreamSource(0, v_buffer, 0, sizeof(CUSTOMVERTEX));// copy the vertex buffer to the back bufferd3ddev->DrawPrimitive(D3DPT_TRIANGLELIST, 0, 2);d3ddev->EndScene();d3ddev->Present(NULL, NULL, NULL, NULL);}// this is the function that cleans up Direct3D and COMvoid cleanD3D(void){v_buffer->Release();    // close and release the vertex bufferd3ddev->Release();    // close and release the 3D deviced3d->Release();    // close and release Direct3D}// this is the function that puts the 3D models into video RAMvoid init_graphics(void){// create the vertices using the CUSTOMVERTEX structCUSTOMVERTEX vertices[] ={{ 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), },};// create a vertex buffer interface called v_bufferd3ddev->CreateVertexBuffer(6 * sizeof(CUSTOMVERTEX),0,CUSTOMFVF,D3DPOOL_MANAGED,&v_buffer,NULL);VOID* pVoid;    // a void pointer// lock v_buffer and load the vertices into itv_buffer->Lock(0, 0, (void**)&pVoid, 0);memcpy(pVoid, vertices, sizeof(vertices));v_buffer->Unlock();}  
well, I was able to draw two paddles like I asked above. ;pbivens67 said:like I asked above.There was no question.;well, I have drawn two paddles and one ball, however I am unsure of how to move the paddles, here is the code I am using to render the paddles and the keyboard input.int move_paddle = 0;// this is the main message handler for the programLRESULT 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--;ValidateRect(hWnd, NULL);return 0;}if (wParam == VK_DOWN){move_paddle++;ValidateRect(hWnd, NULL);return 0;}break;}break;}return DefWindowProc(hWnd, message, wParam, lParam);}void init_graphics(void){// create the vertices using the CUSTOMVERTEX structCUSTOMVERTEX 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), },};void init_graphics(void){// create the vertices using the CUSTOMVERTEX structCUSTOMVERTEX 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), },};;Just in case you missed it, DX9 is more than 20 years old, was superceded in 2006, and passed its official “end of life” over a decade ago. If you use it, much of the functionality needs to be emulated on modern cards because it is so far out of date.Most of the tools are out of support as well. But if it works for you, go for it I guess. ;I am using at a platform before I learn dx11.-