Initializes DX subsystem
| 43 | |
| 44 | // Initializes DX subsystem |
| 45 | bool ddgr_dx_Init(oeApplication *app) { |
| 46 | DX_DATA(hPrimaryWnd) = (HWND)((oeWin32Application *)app)->m_hWnd; |
| 47 | |
| 48 | DX_DATA(lpDD) = NULL; |
| 49 | |
| 50 | // Initialize DirectDraw system if we're going fullscreen, and GDIX system |
| 51 | HRESULT hres; |
| 52 | |
| 53 | hres = DirectDrawCreate(NULL, &DX_DATA(lpDD), NULL); |
| 54 | if (hres != DD_OK) { |
| 55 | ddgr_PushError("Failure to initialize DirectDraw driver (%d)", LOWORD(hres)); |
| 56 | return false; |
| 57 | } |
| 58 | |
| 59 | hres = |
| 60 | DX_DATA(lpDD)->SetCooperativeLevel(DX_DATA(hPrimaryWnd), DDSCL_ALLOWREBOOT | DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); |
| 61 | |
| 62 | if (hres != DD_OK) { |
| 63 | ddgr_PushError("Failed to set DirectDraw fullscreen access level (%d)", LOWORD(hres)); |
| 64 | return false; |
| 65 | } |
| 66 | |
| 67 | DX_DATA(vidrefs) = 0; // reset video reference count. |
| 68 | DX_DATA(init) = true; |
| 69 | |
| 70 | mprintf(0, "DX system initialized.\n"); |
| 71 | |
| 72 | return true; |
| 73 | } |
| 74 | |
| 75 | // Closes DX subsystem |
| 76 | void ddgr_dx_Close() { |
no test coverage detected