MCPcopy Create free account
hub / github.com/diasurgical/DevilutionX / SpawnWindow

Function SpawnWindow

Source/utils/display.cpp:264–373  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

262}
263
264bool SpawnWindow(const char *lpWindowName)
265{
266#ifdef __vita__
267 scePowerSetArmClockFrequency(444);
268#endif
269#ifdef NXDK
270 {
271 Size windowSize = forceResolution.width != 0 ? forceResolution : *sgOptions.Graphics.resolution;
272 VIDEO_MODE xmode;
273 void *p = nullptr;
274 while (XVideoListModes(&xmode, 0, 0, &p)) {
275 if (windowSize.width >= xmode.width && windowSize.height == xmode.height)
276 break;
277 }
278 XVideoSetMode(xmode.width, xmode.height, xmode.bpp, xmode.refresh);
279 }
280#endif
281
282#if SDL_VERSION_ATLEAST(2, 0, 4)
283 SDL_SetHint(SDL_HINT_IME_INTERNAL_EDITING, "1");
284#endif
285#if SDL_VERSION_ATLEAST(2, 0, 6) && defined(__vita__)
286 SDL_SetHint(SDL_HINT_TOUCH_MOUSE_EVENTS, "0");
287#endif
288#if SDL_VERSION_ATLEAST(2, 0, 10)
289 SDL_SetHint(SDL_HINT_MOUSE_TOUCH_EVENTS, "0");
290#endif
291#if SDL_VERSION_ATLEAST(2, 0, 2)
292 SDL_SetHint(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, "0");
293#endif
294#if SDL_VERSION_ATLEAST(2, 0, 12)
295 SDL_SetHint(SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS, "0");
296#endif
297
298 int initFlags = SDL_INIT_VIDEO | SDL_INIT_JOYSTICK;
299#ifndef NOSOUND
300 initFlags |= SDL_INIT_AUDIO;
301#endif
302#ifndef USE_SDL1
303 initFlags |= SDL_INIT_GAMECONTROLLER;
304
305 SDL_SetHint(SDL_HINT_ORIENTATIONS, "LandscapeLeft LandscapeRight");
306#endif
307 if (SDL_Init(initFlags) <= -1) {
308 ErrSdl();
309 }
310 RegisterCustomEvents();
311
312#ifndef USE_SDL1
313 if (sgOptions.Controller.szMapping[0] != '\0') {
314 SDL_GameControllerAddMapping(sgOptions.Controller.szMapping);
315 }
316#endif
317
318#ifdef USE_SDL1
319 // On SDL 1, there are no ADDED/REMOVED events.
320 // Always try to initialize the first joystick.
321 Joystick::Add(0);

Callers 1

init_create_windowFunction · 0.85

Calls 4

RegisterCustomEventsFunction · 0.85
GetPreferredWindowSizeFunction · 0.85
SetVideoModeToPrimaryFunction · 0.85
ReinitializeRendererFunction · 0.85

Tested by

no test coverage detected