本文整理汇总了C++中LPDIRECT3D9::GetAdapterMonitor方法的典型用法代码示例。如果您正苦于以下问题:C++ LPDIRECT3D9::GetAdapterMonitor方法的具体用法?C++ LPDIRECT3D9::GetAdapterMonitor怎么用?C++ LPDIRECT3D9::GetAdapterMonitor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LPDIRECT3D9
的用法示例。
在下文中一共展示了LPDIRECT3D9::GetAdapterMonitor方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
HMONITOR HookIDirect3D9::GetAdapterMonitor(LPVOID _this, UINT Adapter)
{
LOG_API();
return pD3D->GetAdapterMonitor(Adapter);
}
示例2: ResetDevice
// Reset the Direct3D device to resize window or toggle fullscreen/windowed
bool ResetDevice( HWND hWnd, bool ToggleFullscreen = false )
{
// If currently windowed...
if (!Fullscreen)
{
// Get current window and client window dimensions
RECT NewClientRect;
GetWindowRect( hWnd, &WindowRect );
GetClientRect( hWnd, &NewClientRect );
// If not switching to fullscreen, then we must ensure the window is changing size, if
// it isn't then return without doing anything
if (!ToggleFullscreen && NewClientRect.right == ClientRect.right &&
NewClientRect.bottom == ClientRect.bottom)
{
return true;
}
ClientRect = NewClientRect;
}
// Toggle fullscreen if requested
if (ToggleFullscreen)
{
Fullscreen = !Fullscreen;
}
// Reset the structure used to create the D3DDevice
D3DPRESENT_PARAMETERS d3dpp;
ZeroMemory( &d3dpp, sizeof(d3dpp) );
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE; // Don't wait for vertical sync
d3dpp.BackBufferCount = 1;
d3dpp.EnableAutoDepthStencil = TRUE;
d3dpp.AutoDepthStencilFormat = D3DFMT_D24S8;
if (!Fullscreen)
{
// Set windowed parameters - need to set the back buffer dimensions when reseting,
// match them to the window client area
d3dpp.Windowed = TRUE;
d3dpp.BackBufferWidth = ClientRect.right;
d3dpp.BackBufferHeight = ClientRect.bottom;
d3dpp.BackBufferFormat = D3DFMT_UNKNOWN;
}
else
{
// Get current dimensions of primary monitor
MONITORINFO monitorInfo;
monitorInfo.cbSize = sizeof(MONITORINFO);
if (GetMonitorInfo( g_pD3D->GetAdapterMonitor( D3DADAPTER_DEFAULT ), &monitorInfo ))
{
d3dpp.BackBufferWidth = monitorInfo.rcMonitor.right - monitorInfo.rcMonitor.left;
d3dpp.BackBufferHeight = monitorInfo.rcMonitor.bottom - monitorInfo.rcMonitor.top;
}
else
{
d3dpp.BackBufferWidth = 1280;
d3dpp.BackBufferHeight = 1024;
}
// Set other fullscreen parameters
d3dpp.Windowed = FALSE;
d3dpp.BackBufferFormat = D3DFMT_A8R8G8B8;
}
ViewportWidth = d3dpp.BackBufferWidth;
ViewportHeight = d3dpp.BackBufferHeight;
// Need to recreate resources when reseting. Any resources (vertex & index buffers, textures) created
// using D3DPOOL_MANAGED rather than D3DPOOL_DEFAULT will be recreated automatically. Dynamic resources
// must be in D3DPOOL_DEFAULT, so they must be recreated manually. D3DX fonts are such an example.
// Other dynamic resources are those that are updated during the game loop, e.g. procedural textures,
// or dynamic terrain
if (g_pFont != NULL)
g_pFont->Release();
// Reset the Direct3D device with the new settings
if (FAILED(g_pd3dDevice->Reset( &d3dpp )))
{
return false;
}
// If reseting to windowed mode, we need to reset the window size
if (!Fullscreen)
{
SetWindowPos( hWnd, HWND_NOTOPMOST, WindowRect.left, WindowRect.top,
WindowRect.right - WindowRect.left, WindowRect.bottom - WindowRect.top, 0 );
}
// Need to set up states again after reset
g_pd3dDevice->SetSamplerState( 0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR );
g_pd3dDevice->SetSamplerState( 0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR );
g_pd3dDevice->SetSamplerState( 0, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR );
g_pd3dDevice->SetSamplerState( 1, D3DSAMP_MINFILTER, D3DTEXF_LINEAR );
g_pd3dDevice->SetSamplerState( 1, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR );
g_pd3dDevice->SetSamplerState( 1, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR );
g_pd3dDevice->SetSamplerState( 2, D3DSAMP_MINFILTER, D3DTEXF_LINEAR );
g_pd3dDevice->SetSamplerState( 2, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR );
g_pd3dDevice->SetSamplerState( 2, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR );
//.........这里部分代码省略.........