DirectX initialization of DirectX

If you have friends reading these series of blogs, congratulations! You will see the worst blog in history about DirectX. Haha, if you don't understand, you can communicate in a timely manner
There are too many materials about DirectX, just like the textbooks I mentioned in my previous blog, they are all the Bible of the gaming industry. I suggest taking a look, they are all entry-level. So I will explain it in a note taking style here
Initialize DirectX
Initializing DirectX is divided into four steps, and only the methods are listed here. The specific steps can be found in any game programming book Creating a DirectX interface Function DirectX3DCreate9 (.)
Obtain device hardware information
Function GetDeviceCaps
Three Fill D3DPRESENT_ Arameters structure This one is to define a D3DPRESENT_ Parameters structure, fill in the content inside
Creating Direct3D device interfaces Function CreatDevice
I won't go into much detail about this kind of initialization work, and I don't know how to handle children's shoes. You can ask me for a demo See, I'll say it's the worst technology BLOG in history, haha
Below are some initialization codes posted
//Create a Direct3D interface object
//--------------------------------------------------------------------------------------
LPDIECT3D9 pD3D= NULL// Creating Direct3D Interface Objects If (NULL== (pD3D= Direct3DCreate9 (D3D_SDK VERSION)))//Initialize the Direct3D interface object and negotiate the DirectX version
Return E_ FAIL
//Obtain hardware device information
D3DCAPS9 caps; Int flag= 0
If (FAILED (pD3D -> GetDeviceCaps (D3DADAPTER-DEFAULT, D3DDEVTYPE-HAL,& caps))
Return E_ FAIL
If (caps. DevCaps& D3DDEVCAPS-HWTRANSFORMANDLIGHT)
Flag; D3DCREATE_ HARDWARE_ VERTEXPROCESSING; //Supports hardware vertex operations
Else
Flag; D3DCREATE_ Software_ VERTEXPROCESSING// Hardware vertex operations are not supported
//Fill D3DPRESENT_ Arameters structure D3DPRESENT_ Parameters d3dpp;
ZeroMemory (& d3dpp, sizeof (d3dpp))
D3dpp BackBufferWidth= WINDOW_ WIDTH
D3dpp BackBufferHeight= WINDOW_ HELIGHT
D3dpp BackBufferFormat= D3DFMT_ A8R8G8B8
D3dpp BackBufferCount= 1
D3dpp MultiSampleType; D3DMULTISAMPLE_ NONE
D3dpp MultiSampleQuality; 0
D3dpp SwapEffect= D3DSWAPEFFECT_ DISCARD;
D3dpp. hDeviceWindow= Hwnd
D3dpp Window= True
D3dpp Enable AutoDepthStencil= True;
D3dpp AutoDepthStencilFormat= D3DFMT_ D24S8
D3dpp Flags; 0
D3dpp FullScreen_ RefreshRateInhz= 0
D3dpp PresentationInterval; D3DPRESENT_ INTERVAL_ IMMEDIATE
//Create Direct3D device interface
If (FAILED (pD3D -> Create Device (D3DAPTER-DEFAULT, D3DDEVTYPE-HAL,
Hwnd, vp,& D3dpp,& G_ Pd3dDevice)
Return E_ FAIL
SAFE_ RELEASE (pD3D)//Release the LPDICT3D9 interface object