1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
// Register the window class.
WNDCLASSEX wc = { sizeof( WNDCLASSEX ), CS_OWNDC, &MsgProc, 0L, 0L,
GetModuleHandle( nullptr ), nullptr, nullptr, nullptr, nullptr, mstrWinName.c_str(), nullptr };
RegisterClassEx( &wc );
// Create the application's window.
mhwndHandler = CreateWindow( mstrWinName.c_str(), mstrWinName.c_str(), WS_OVERLAPPEDWINDOW | WS_VISIBLE,
150, 150, 800, 600, GetDesktopWindow(), nullptr, wc.hInstance, nullptr );
//ShowWindow( mhwndHandler, SW_SHOW );
// Attempt to create D3D environment ...
if( ( mpD3DObject = Direct3DCreate9( D3D_SDK_VERSION ) ) == nullptr )
throw EngineError( "Direct3D create failed", __FL__ );
// Direct3D pixel Format Decription
D3DPRESENT_PARAMETERS d3dpp;
ZeroMemory( &d3dpp, sizeof( d3dpp ) );
D3DDISPLAYMODE dm;
mpD3DObject->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &dm);
d3dpp.BackBufferWidth = 800;
d3dpp.BackBufferHeight = 600;
d3dpp.BackBufferCount = 1;
d3dpp.Windowed = true;
d3dpp.SwapEffect = D3DSWAPEFFECT_COPY;
d3dpp.BackBufferFormat = dm.Format;
// ... and device
if( FAILED( mpD3DObject->CreateDevice( D3DADAPTER_DEFAULT,
D3DDEVTYPE_HAL, mhwndHandler, D3DCREATE_SOFTWARE_VERTEXPROCESSING | D3DCREATE_MULTITHREADED,
&d3dpp, &mpD3DDevice ) ) )
throw EngineError( "Direct3D device creation failed", __FL__ );
ToolInWonder::MyLog::GetInstance().LogMessage( "WideEngine started.", __FL__ ); |
Partager