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

Function ddgr_Init

dd_grwin32/ddgrWin32Init.cpp:92–136  ·  view source on GitHub ↗

ddgr_Init app = application object. subsystem = subsystem name ('DirectDraw', 'GDI') fullscreen = whether it's full screen or windowed */

Source from the content-addressed store, hash-verified

90 fullscreen = whether it's full screen or windowed
91*/
92bool ddgr_Init(oeApplication *app, char *subsystem, bool fullscreen) {
93 static bool first_time = true;
94 int subsys_id;
95
96 // close old systems
97 if (first_time) {
98 atexit(ddgr_Close);
99 first_time = false;
100 } else if (LIB_DATA(init)) {
101 ddgr_Close();
102 }
103
104 // find subsystem id based off of subsystem requested.
105 for (subsys_id = 0; DDGR_subsystems[subsys_id] != -1; subsys_id++) {
106 if (strcmp(DDGR_subsystem_names[subsys_id], subsystem) == 0)
107 break;
108 }
109
110 if (DDGR_subsystems[subsys_id] == -1)
111 ddgr_FatalError("Subsystem %s not found during startup.", subsystem);
112
113 LIB_DATA(subsystem) = DDGR_subsystems[subsys_id];
114
115 // Initialize that subsystem
116 switch (DDGR_subsystems[subsys_id]) {
117 case DDGR_GDI_SUBSYSTEM:
118 ddgr_gdi_Init(app, fullscreen, false);
119 break;
120 case DDGR_GDIX_SUBSYSTEM:
121 ddgr_gdi_Init(app, fullscreen, true);
122 break;
123 case DDGR_DX_SUBSYSTEM:
124 ddgr_dx_Init(app);
125 break;
126
127 default:
128 Int3();
129 }
130
131 LIB_DATA(init) = true;
132 DDGR_subsysid = subsys_id;
133 DDGR_fullscreen = fullscreen;
134
135 return true;
136}
137
138void ddgr_Close() {
139 if (!LIB_DATA(init))

Callers 2

GameToEditorFunction · 0.85
InitGraphicsFunction · 0.85

Calls 4

ddgr_CloseFunction · 0.85
ddgr_FatalErrorFunction · 0.85
ddgr_gdi_InitFunction · 0.85
ddgr_dx_InitFunction · 0.85

Tested by

no test coverage detected