int main(int argc, char* argv[]) { // Set the callback functions DXUTSetCallbackD3D9DeviceAcceptable(IsD3D9DeviceAcceptable); DXUTSetCallbackD3D9DeviceCreated(OnD3D9CreateDevice); DXUTSetCallbackD3D9DeviceReset(OnD3D9ResetDevice); DXUTSetCallbackD3D9FrameRender(OnD3D9FrameRender); DXUTSetCallbackD3D9DeviceLost(OnD3D9LostDevice); DXUTSetCallbackD3D9DeviceDestroyed(OnD3D9DestroyDevice); DXUTSetCallbackDeviceChanging(ModifyDeviceSettings); DXUTSetCallbackMsgProc(MsgProc); DXUTSetCallbackFrameMove(OnFrameMove); // Initialize DXUT and create the desired Win32 window and D3D device for the application DXUTInit(true, false); // Parse the command line and show msgboxes DXUTSetHotkeyHandling(true, true, true); // handle the default hotkeys DXUTSetCursorSettings(true, true); // Show the cursor and clip it when in full screen DXUTCreateWindow(L"01_WindowDx9"); DXUTCreateDevice(true, 800, 600); DXUTMainLoop(); return DXUTGetExitCode(); }
int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow ) { // Enable run-time memory check for debug builds. #if defined(DEBUG) | defined(_DEBUG) _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); #endif Initialize(); // Set DXUT callbacks DXUTSetCallbackDeviceChanging( ModifyDeviceSettings ); DXUTSetCallbackMsgProc( MsgProc ); DXUTSetCallbackKeyboard( OnKeyboard ); DXUTSetCallbackMouse( OnMouse, true ); DXUTSetCallbackD3D11DeviceAcceptable( IsD3D11DeviceAcceptable ); DXUTSetCallbackD3D11DeviceCreated( OnD3D11CreateDevice ); DXUTSetCallbackD3D11SwapChainResized( OnD3D11ResizedSwapChain ); DXUTSetCallbackD3D11FrameRender( OnD3D11FrameRender ); DXUTSetCallbackD3D11SwapChainReleasing( OnD3D11ReleasingSwapChain ); DXUTSetCallbackD3D11DeviceDestroyed( OnD3D11DestroyDevice ); InitApp(); if (gMultithreaded) { InitWin32Threads(); } DXUTInit( true, true, NULL ); DXUTSetCursorSettings( true, true ); DXUTCreateWindow( L"ISPC HDR Texture Compressor" ); // Try to create a device with DX11 feature set DXUTCreateDevice (D3D_FEATURE_LEVEL_11_0, true, 1280, 1024 ); BOOL DX11Available = false; // If we don't have an adequate driver, then we revert to DX10 feature set... DXUTDeviceSettings settings = DXUTGetDeviceSettings(); if(settings.d3d11.DriverType == D3D_DRIVER_TYPE_UNKNOWN || settings.d3d11.DriverType == D3D_DRIVER_TYPE_NULL) { DXUTCreateDevice(D3D_FEATURE_LEVEL_10_1, true, 1280, 1024); // !HACK! Force enumeration here in order to relocate hardware with new feature level DXUTGetD3D11Enumeration(true); DXUTCreateDevice(D3D_FEATURE_LEVEL_10_1, true, 1280, 1024); const TCHAR *noDx11msg = _T("Your hardware does not seem to support DX11. BC7 Compression is disabled."); MessageBox(NULL, noDx11msg, _T("Error"), MB_OK); } else { DX11Available = true; } FillProfiles(DX11Available); DXUTMainLoop(); // Destroy all of the threads... DestroyThreads(); return DXUTGetExitCode(); }