MCPcopy Create free account
hub / github.com/ZDoom/Raze / I_InitGraphics

Function I_InitGraphics

source/common/platform/win32/hardware.cpp:75–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73}
74
75void I_InitGraphics ()
76{
77 // If the focus window is destroyed, it doesn't go back to the active window.
78 // (e.g. because the net pane was up, and a button on it had focus)
79 if (GetFocus() == NULL && GetActiveWindow() == mainwindow.GetHandle())
80 {
81 // Make sure it's in the foreground and focused. (It probably is
82 // already foregrounded but may not be focused.)
83 SetForegroundWindow(mainwindow.GetHandle());
84 SetFocus(mainwindow.GetHandle());
85 // Note that when I start a 2-player game on the same machine, the
86 // window for the game that isn't focused, active, or foregrounded
87 // still receives a WM_ACTIVATEAPP message telling it that it's the
88 // active window. The window that is really the active window does
89 // not receive a WM_ACTIVATEAPP message, so both games think they
90 // are the active app. Huh?
91 }
92
93#ifdef HAVE_VULKAN
94 if (V_GetBackend() == 1)
95 {
96 // first try Vulkan, if that fails OpenGL
97 try
98 {
99 Video = new Win32VulkanVideo();
100 }
101 catch (CVulkanError &error)
102 {
103 Printf(TEXTCOLOR_RED "Initialization of Vulkan failed: %s\n", error.what());
104 Video = new Win32GLVideo();
105 }
106 }
107 else
108#endif
109 {
110 Video = new Win32GLVideo();
111 }
112
113 // we somehow STILL don't have a display!!
114 if (Video == NULL)
115 I_FatalError ("Failed to initialize display");
116
117}

Callers 1

V_Init2Function · 0.50

Calls 5

V_GetBackendFunction · 0.85
PrintfFunction · 0.85
I_FatalErrorFunction · 0.85
GetHandleMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected