d3d全屏模式

d3d全屏模式

 

通常我们创建的d3d程序时都是非全屏模式, 但是游戏大部分是全屏模式, 怎么创建这两种模式呢?

 

创建的时候有2点不同: 创建窗口, 创建设备.

 

1. 创建普通模式:

 

a. 创建窗口:

    m_hMainWin = CreateWindowW( m_szWinClsName, m_szWinTitle, WS_OVERLAPPEDWINDOW
,

        CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInst, NULL);

b. 创建设备:

    D3DPRESENT_PARAMETERS d3dpp;

    ZeroMemory( &d3dpp, sizeof(d3dpp) );

    d3dpp.Windowed   = TRUE;

    d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;

    d3dpp.BackBufferFormat = d3ddm.Format;

    m_pD3D->CreateDevice( D3DADAPTER_DEFAULT…

 

2. 创建全屏模式:

 

a. 创建窗口:

    m_hMainWin = CreateWindowW( m_szWinClsName,
m_szWinTitle, WS_EX_TOPMOST
,

        CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInst, NULL);

b.
创建设备:

    D3DPRESENT_PARAMETERS d3dpp;

    ZeroMemory( &d3dpp, sizeof(d3dpp) );

    d3dpp.Windowed   = FALSE;

    d3dpp.BackBufferHeight = 1024;

    d3dpp.BackBufferWidth = 1280;

    d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;

    d3dpp.BackBufferFormat = d3ddm.Format;

    m_pD3D->CreateDevice( D3DADAPTER_DEFAULT…

 

注意红色部分.

版权所有,禁止转载. 如需转载,请先征得博主的同意,并且表明文章出处,否则按侵权处理.

    分享到:
This entry was posted in DirectX3D and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*