MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / ddgr_dx_Init

Function ddgr_dx_Init

dd_grwin32/ddgrWin32DX.cpp:45–73  ·  view source on GitHub ↗

Initializes DX subsystem

Source from the content-addressed store, hash-verified

43
44// Initializes DX subsystem
45bool 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
76void ddgr_dx_Close() {

Callers 1

ddgr_InitFunction · 0.85

Calls 1

ddgr_PushErrorFunction · 0.85

Tested by

no test coverage detected