创建一个Direct3D设备g_pD3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd,

int main(int argc, char* argv[])  
{  
  WinMain(GetModuleHandle(0),NULL,NULL,0);  
  return 0;  
}  


//创建程序的窗口
    HWND hWnd = CreateWindow("DX Project 1", "www.andypike.com: Tutorial 1", 
                              WS_OVERLAPPEDWINDOW, 50, 50, 500, 500,
                              GetDesktopWindow(), NULL, wc.hInstance, NULL);

    //Initialize Direct3D
//初始化Direct3D
    if(SUCCEEDED(InitialiseD3D(hWnd)))
    { 
        //Show our window
//显示我们的窗口
        ShowWindow(hWnd, SW_SHOWDEFAULT);
        UpdateWindow(hWnd);

        //Start game running: Enter the game loop
//开始程序的运行:进入游戏循环
        GameLoop();
    }
/

HRESULT InitialiseD3D(HWND hWnd)

//创建一个Direct3D设备
    if(FAILED(g_pD3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, 
                                   D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &g_pD3DDevice)))
    {
        return E_FAIL;
    }


你可能感兴趣的:(DirectX)