1,安装directx sdk
2.安装createDecive项目
初学者一定做的第一件是找到main函数(函数入口)
INT WINAPI wWinMain( HINSTANCE hInst, HINSTANCE, LPWSTR, INT )
绘制主流程
一.注册窗口
WNDCLASSEX wc =
{
sizeof( WNDCLASSEX ), CS_CLASSDC, MsgProc, 0L, 0L,
GetModuleHandle( NULL ), NULL, NULL, NULL, NULL,
L"D3D Tutorial", NULL
};
RegisterClassEx( &wc );
二.创建窗口
HWND hWnd = CreateWindow( L"D3D Tutorial", L"D3D Tutorial 01: CreateDevice",
WS_OVERLAPPEDWINDOW, 100, 100, 300, 300,
GetDesktopWindow(), NULL, wc.hInstance, NULL );
三.初始化d3d
<pre name="code" class="cpp"> if( SUCCEEDED( InitD3D( hWnd ) ) )
四.显示窗口
<pre name="code" class="cpp"> ShowWindow( hWnd, SW_SHOWDEFAULT );
UpdateWindow( hWnd );
五.消息处理
<pre name="code" class="cpp"> MSG msg;
while( GetMessage( &msg, NULL, 0, 0 ) )
{
TranslateMessage( &msg );
DispatchMessage( &msg );
}