in a way, yes...
this is my initialization function in my direct3d wrapper. i pass in the hWnd of my window, the size of it, and a bool for fullscreen. my wrapper then tells directx to do this:
Code:
BOOL CDisplay::Init( HWND hWnd, int iWidth, int iHeight, BOOL bFullScreen )
{
// create the main d3d obj
m_d3dObj = Direct3DCreate9( D3D_SDK_VERSION );
if ( !m_d3dObj )
{
MessageBox( NULL, "Failed to create d3d object", "error", MB_OK );
m_pEL->Log( "Failed to create d3d object" );
return false;
}
// setup device parameters
memset( &m_d3dPresent, 0, sizeof( m_d3dPresent ) );
m_d3dPresent.BackBufferWidth = iWidth;
m_d3dPresent.BackBufferHeight = iHeight;
// windowed = D3DFMT_UNKNOWN
// fullscreen = D3DFMT_R5G6B5
m_d3dPresent.BackBufferFormat = (bFullScreen ? D3DFMT_R5G6B5 : D3DFMT_UNKNOWN);
m_d3dPresent.BackBufferCount = 1;
m_d3dPresent.Windowed = !bFullScreen;
m_d3dPresent.hDeviceWindow = hWnd;
m_d3dPresent.SwapEffect = D3DSWAPEFFECT_DISCARD;
m_d3dPresent.Flags = D3DPRESENTFLAG_LOCKABLE_BACKBUFFER;
HRESULT hr = 0;
hr = m_d3dObj->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING,
&m_d3dPresent, &m_d3dDevice );
*m_pEL << DXGetErrorString9( hr ) << " - " << DXGetErrorDescription9( hr ) << "\n";
if ( FAILED( hr ) )
{
MessageBox( NULL, "Failed creating d3d device", "error", MB_OK );
m_pEL->Log( "Failed creating d3d device" );
m_d3dObj->Release();
m_d3dObj = NULL;
return false;
}
m_hWnd = hWnd;
return true;
}