void Magnify::Capture() { POINT Point; ::GetCursorPos( &Point ); RECT Rect; ::GetWindowRect( DXUTGetHWND(), &Rect ); int nWidthDiff = 0; int nHeightDiff = 0; if( DXUTIsWindowed() ) { nWidthDiff = (int)( ( ( Rect.right - Rect.left ) - m_nBackBufferWidth ) * ( 1.0f / 2.0f ) ); nHeightDiff = (int)( ( ( Rect.bottom - Rect.top ) - m_nBackBufferHeight ) * ( 4.0f / 5.0f ) ); } SetPosition( Point.x - ( Rect.left + nWidthDiff ), Point.y - ( Rect.top + nHeightDiff ) ); D3D10_BOX SourceRegion; SourceRegion.left = m_nPositionX - m_nHalfPixelRegion; SourceRegion.right = m_nPositionX + m_nHalfPixelRegion; SourceRegion.top = m_nPositionY - m_nHalfPixelRegion; SourceRegion.bottom = m_nPositionY + m_nHalfPixelRegion; SourceRegion.front = 0; SourceRegion.back = 1; }
//-------------------------------------------------------------------------------------- // Create any D3D9 resources that won't live through a device reset (D3DPOOL_DEFAULT) // or that are tied to the back buffer size //-------------------------------------------------------------------------------------- HRESULT CALLBACK OnD3D9ResetDevice( IDirect3DDevice9* pd3dDevice, const D3DSURFACE_DESC* pBackBufferSurfaceDesc, void* pUserContext ) { HRESULT hr; V_RETURN( g_DialogResourceManager.OnD3D9ResetDevice() ); V_RETURN( g_SettingsDlg.OnD3D9ResetDevice() ); if( g_pFont9 ) V_RETURN( g_pFont9->OnResetDevice() ); if( g_pEffect9 ) V_RETURN( g_pEffect9->OnResetDevice() ); V_RETURN( D3DXCreateSprite( pd3dDevice, &g_pSprite9 ) ); g_pTxtHelper = new CDXUTTextHelper( g_pFont9, g_pSprite9, NULL, NULL, 15 ); // Setup the camera's projection parameters float fAspectRatio = pBackBufferSurfaceDesc->Width / ( FLOAT )pBackBufferSurfaceDesc->Height; g_Camera.SetProjParams( D3DX_PI / 4, fAspectRatio, 0.1f, 1000.0f ); g_Camera.SetWindow( pBackBufferSurfaceDesc->Width, pBackBufferSurfaceDesc->Height ); g_HUD.SetLocation( pBackBufferSurfaceDesc->Width - 170, 0 ); g_HUD.SetSize( 170, 170 ); g_SampleUI.SetLocation( pBackBufferSurfaceDesc->Width - 170, pBackBufferSurfaceDesc->Height - 350 ); g_SampleUI.SetSize( 170, 300 ); // load the mesh V_RETURN( g_Mesh.Create( pd3dDevice, L"misc\\ball.sdkmesh" ) ); // Load the texture WCHAR str[MAX_PATH]; V_RETURN( DXUTFindDXSDKMediaFileCch( str, MAX_PATH, L"misc\\seafloor.dds" ) ); V_RETURN( CreateDDSTextureFromFile( pd3dDevice, str, &g_pTexture9 ) ); if( DXUTIsWindowed() ) g_SampleUI.GetButton( IDC_LOAD_TEXTURE )->SetEnabled( true ); else g_SampleUI.GetButton( IDC_LOAD_TEXTURE )->SetEnabled( false ); return S_OK; }
bool RenderWin32DX9Imp::isWindowed() { return DXUTIsWindowed(); }