DEADSOFTWARE

9cd1ee194b0ae4b89bb587e593c689067fd477cb
[d2df-sdl.git] / src / game / sdl2 / g_system.pas
1 (* Copyright (C) Doom 2D: Forever Developers
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, version 3 of the License ONLY.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14 *)
15 {$INCLUDE ../shared/a_modes.inc}
16 unit g_system;
18 interface
20 uses Utils;
22 (* --- Utils --- *)
23 function sys_GetTicks (): Int64;
24 procedure sys_Delay (ms: Integer);
26 (* --- Graphics --- *)
27 function sys_GetDisplayModes (bpp: Integer): SSArray;
28 function sys_SetDisplayMode (w, h, bpp: Integer; fullscreen, maximized: Boolean): Boolean;
29 procedure sys_EnableVSync (yes: Boolean);
30 procedure sys_Repaint;
32 (* --- Input --- *)
33 function sys_HandleInput (): Boolean;
34 procedure sys_RequestQuit;
36 (* --- Init --- *)
37 procedure sys_Init;
38 procedure sys_Final;
40 implementation
42 uses
43 SysUtils, SDL2, Math, ctypes,
44 e_log, e_graphics, e_input, e_sound,
45 {$INCLUDE ../nogl/noGLuses.inc}
46 {$IFDEF ENABLE_HOLMES}
47 g_holmes, sdlcarcass, fui_ctls,
48 {$ENDIF}
49 g_touch, g_options, g_window, g_console, g_game, g_menu, g_gui, g_main, g_basic;
51 const
52 GameTitle = 'Doom 2D: Forever (SDL 2, %s)';
54 var
55 window: PSDL_Window;
56 context: TSDL_GLContext;
57 display, wx, wy: Integer;
58 wc: Boolean;
59 JoystickHandle: array [0..e_MaxJoys - 1] of PSDL_Joystick;
60 JoystickHatState: array [0..e_MaxJoys - 1, 0..e_MaxJoyHats - 1, HAT_LEFT..HAT_DOWN] of Boolean;
61 JoystickZeroAxes: array [0..e_MaxJoys - 1, 0..e_MaxJoyAxes - 1] of Integer;
63 (* --------- Utils --------- *)
65 function sys_GetTicks (): Int64;
66 begin
67 result := SDL_GetTicks()
68 end;
70 procedure sys_Delay (ms: Integer);
71 begin
72 SDL_Delay(ms)
73 end;
75 (* --------- Graphics --------- *)
77 function LoadGL: Boolean;
78 begin
79 result := true;
80 {$IFDEF NOGL_INIT}
81 nogl_Init;
82 if glRenderToFBO and (not nogl_ExtensionSupported('GL_OES_framebuffer_object')) then
83 {$ELSE}
84 if glRenderToFBO and (not Load_GL_ARB_framebuffer_object) then
85 {$ENDIF}
86 begin
87 e_LogWriteln('GL: framebuffer objects not supported; disabling FBO rendering');
88 glRenderToFBO := false;
89 end;
90 end;
92 procedure FreeGL;
93 begin
94 {$IFDEF NOGL_INIT}
95 nogl_Quit();
96 {$ENDIF}
97 end;
99 procedure UpdateSize (w, h: Integer);
100 begin
101 gWinSizeX := w;
102 gWinSizeY := h;
103 gRC_Width := w;
104 gRC_Height := h;
105 if glRenderToFBO then
106 begin
107 // store real window size in gWinSize, downscale resolution now
108 w := round(w / r_pixel_scale);
109 h := round(h / r_pixel_scale);
110 if not e_ResizeFramebuffer(w, h) then
111 begin
112 e_LogWriteln('GL: could not create framebuffer, falling back to --no-fbo');
113 glRenderToFBO := False;
114 w := gWinSizeX;
115 h := gWinSizeY;
116 end;
117 end;
118 gScreenWidth := w;
119 gScreenHeight := h;
120 {$IFDEF ENABLE_HOLMES}
121 fuiScrWdt := w;
122 fuiScrHgt := h;
123 {$ENDIF}
124 e_ResizeWindow(w, h);
125 e_InitGL;
126 g_Game_SetupScreenSize;
127 {$IFNDEF ANDROID}
128 (* This will fix menu reset on keyboard showing *)
129 g_Menu_Reset;
130 {$ENDIF}
131 g_Game_ClearLoading;
132 {$IFDEF ENABLE_HOLMES}
133 if assigned(oglInitCB) then oglInitCB;
134 {$ENDIF}
135 end;
137 function GetTitle (): AnsiString;
138 var info: AnsiString;
139 begin
140 info := g_GetBuildHash(false);
141 if info = 'custom build' then
142 info := info + ' by ' + g_GetBuilderName() + ' ' + GAME_BUILDDATE + ' ' + GAME_BUILDTIME;
143 result := Format(GameTitle, [info]);
144 end;
146 function InitWindow (w, h, bpp: Integer; fullScreen, maximized: Boolean): Boolean;
147 var flags: UInt32; x, y: cint; title: AnsiString;
148 begin
149 // note: on window close make: if assigned(oglDeinitCB) then oglDeinitCB;
150 e_LogWritefln('InitWindow %s %s %s %s', [w, h, bpp, fullScreen]);
151 result := false;
152 if window = nil then
153 begin
154 {$IFDEF USE_GLES1}
155 SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 1);
156 SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1);
157 SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
158 {$ELSE}
159 SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
160 SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1);
161 SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
162 SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
163 SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
164 SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
165 SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
166 SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8); // lights; it is enough to have 1-bit stencil buffer for lighting, but...
167 {$ENDIF}
168 flags := SDL_WINDOW_OPENGL or SDL_WINDOW_RESIZABLE;
169 if fullScreen then flags := flags or SDL_WINDOW_FULLSCREEN;
170 if maximized then flags := flags or SDL_WINDOW_MAXIMIZED;
171 if wc then
172 begin
173 x := SDL_WINDOWPOS_CENTERED;
174 y := SDL_WINDOWPOS_CENTERED
175 end
176 else
177 begin
178 x := wx;
179 y := wy
180 end;
181 title := GetTitle();
182 window := SDL_CreateWindow(PChar(title), x, y, w, h, flags);
183 if window <> nil then
184 begin
185 context := SDL_GL_CreateContext(window);
186 if context <> nil then
187 begin
188 if not LoadGL then
189 begin
190 e_LogWriteln('GL: unable to load OpenGL functions', TMsgType.Fatal);
191 SDL_GL_DeleteContext(context); context := nil;
192 exit;
193 end;
194 if (fullscreen = false) and (maximized = false) and (wc = false) then
195 begin
196 SDL_GetWindowPosition(window, @x, @y);
197 wx := x; wy := y
198 end;
199 gFullScreen := fullscreen;
200 gWinMaximized := maximized;
201 gRC_FullScreen := fullscreen;
202 gRC_Maximized := maximized;
203 UpdateSize(w, h);
204 result := true
205 end
206 else
207 begin
208 // SDL_DestroyWindow(window);
209 e_LogWritefln('SDL: unable to create OpenGL context: %s', [SDL_GetError])
210 end
211 end
212 else
213 begin
214 e_LogWritefln('SDL: unable to create window: %s', [SDL_GetError])
215 end
216 end
217 else
218 begin
219 if fullScreen then flags := SDL_WINDOW_FULLSCREEN else flags := 0;
220 SDL_SetWindowFullscreen(window, flags);
221 SDL_SetWindowSize(window, w, h);
222 if maximized then SDL_MaximizeWindow(window);
223 // always reset to center when changing fullscreen->windowed for safety purposes
224 if wc or (gFullscreen and not fullscreen) or (gWinMaximized and not maximized) then
225 begin
226 x := SDL_WINDOWPOS_CENTERED;
227 y := SDL_WINDOWPOS_CENTERED
228 end
229 else
230 begin
231 x := wx;
232 y := wy
233 end;
234 SDL_SetWindowPosition(window, x, y);
235 if (fullscreen = false) and (maximized = false) and (wc = false) then
236 begin
237 SDL_GetWindowPosition(window, @x, @y);
238 wx := x; wy := y
239 end;
240 gFullScreen := fullscreen;
241 gWinMaximized := maximized;
242 gRC_FullScreen := fullscreen;
243 gRC_Maximized := maximized;
244 UpdateSize(w, h);
245 result := true
246 end
247 end;
249 procedure sys_Repaint;
250 begin
251 SDL_GL_SwapWindow(window)
252 end;
254 procedure sys_EnableVSync (yes: Boolean);
255 begin
256 if yes then
257 SDL_GL_SetSwapInterval(1)
258 else
259 SDL_GL_SetSwapInterval(0)
260 end;
262 function sys_GetDisplayModes (bpp: Integer): SSArray;
263 var i, count, num, pw, ph: Integer; m: TSDL_DisplayMode;
264 begin
265 result := nil;
266 num := SDL_GetNumDisplayModes(display);
267 if num < 0 then
268 e_LogWritefln('SDL: unable to get numer of available display modes: %s', [SDL_GetError]);
269 if num > 0 then
270 begin
271 e_LogWritefln('Video modes for display %s:', [display]);
272 SetLength(result, num);
273 i := 0; count := 0; pw := 0; ph := 0;
274 while i < num do
275 begin
276 SDL_GetDisplayMode(display, i, @m);
277 if ((pw <> m.w) or (ph <> m.h)) then
278 begin
279 e_LogWritefln('* %sx%sx%s@%s', [m.w, m.h, SDL_BITSPERPIXEL(m.format), m.refresh_rate]);
280 pw := m.w; ph := m.h;
281 result[count] := IntToStr(m.w) + 'x' + IntToStr(m.h);
282 Inc(count);
283 end
284 else
285 begin
286 e_LogWritefln('- %sx%sx%s@%s', [m.w, m.h, SDL_BITSPERPIXEL(m.format), m.refresh_rate]);
287 end;
288 Inc(i)
289 end;
290 SetLength(result, count)
291 end
292 end;
294 function sys_SetDisplayMode (w, h, bpp: Integer; fullScreen, maximized: Boolean): Boolean;
295 begin
296 result := InitWindow(w, h, bpp, fullScreen, maximized)
297 end;
299 (* --------- Joystick --------- *)
301 procedure HandleJoyButton (var ev: TSDL_JoyButtonEvent);
302 var down: Boolean; key: Integer;
303 begin
304 if (ev.which < e_MaxJoys) and (ev.button < e_MaxJoyBtns) then
305 begin
306 key := e_JoyButtonToKey(ev.which, ev.button);
307 down := ev.type_ = SDL_JOYBUTTONDOWN;
308 if g_dbg_input then
309 e_LogWritefln('Input Debug: jbutton, joy=%s, button=%s, keycode=%s, press=%s', [ev.which, ev.button, key, down]);
310 e_KeyUpDown(key, down);
311 g_Console_ProcessBind(key, down)
312 end
313 else
314 begin
315 if g_dbg_input then
316 begin
317 down := ev.type_ = SDL_JOYBUTTONDOWN;
318 e_LogWritefln('Input Debug: NOT IN RANGE! jbutton, joy=%s, button=%s, press=%s', [ev.which, ev.button, down])
319 end
320 end
321 end;
323 procedure HandleJoyAxis (var ev: TSDL_JoyAxisEvent);
324 var key, minuskey: Integer;
325 begin
326 if (ev.which < e_MaxJoys) and (ev.axis < e_MaxJoyAxes) then
327 begin
328 key := e_JoyAxisToKey(ev.which, ev.axis, AX_PLUS);
329 minuskey := e_JoyAxisToKey(ev.which, ev.axis, AX_MINUS);
331 if g_dbg_input then
332 e_LogWritefln('Input Debug: jaxis, joy=%s, axis=%s, value=%s, zeroaxes=%s, deadzone=%s', [ev.which, ev.axis, ev.value, JoystickZeroAxes[ev.which, ev.axis], e_JoystickDeadzones[ev.which]]);
334 if ev.value < JoystickZeroAxes[ev.which, ev.axis] - e_JoystickDeadzones[ev.which] then
335 begin
336 if (e_KeyPressed(key)) then
337 begin
338 e_KeyUpDown(key, False);
339 g_Console_ProcessBind(key, False)
340 end;
341 e_KeyUpDown(minuskey, True);
342 g_Console_ProcessBind(minuskey, True)
343 end
344 else if ev.value > JoystickZeroAxes[ev.which, ev.axis] + e_JoystickDeadzones[ev.which] then
345 begin
346 if (e_KeyPressed(minuskey)) then
347 begin
348 e_KeyUpDown(minuskey, False);
349 g_Console_ProcessBind(minuskey, False)
350 end;
351 e_KeyUpDown(key, True);
352 g_Console_ProcessBind(key, True)
353 end
354 else
355 begin
356 if (e_KeyPressed(minuskey)) then
357 begin
358 e_KeyUpDown(minuskey, False);
359 g_Console_ProcessBind(minuskey, False)
360 end;
361 if (e_KeyPressed(key)) then
362 begin
363 e_KeyUpDown(key, False);
364 g_Console_ProcessBind(key, False)
365 end
366 end
367 end
368 else
369 begin
370 if g_dbg_input then
371 e_LogWritefln('Input Debug: NOT IN RANGE! jaxis, joy=%s, axis=%s, value=%s, zeroaxes=%s, deadzone=%s', [ev.which, ev.axis, ev.value, JoystickZeroAxes[ev.which, ev.axis], e_JoystickDeadzones[ev.which]])
372 end
373 end;
375 procedure HandleJoyHat (var ev: TSDL_JoyHatEvent);
376 var
377 down: Boolean;
378 i, key: Integer;
379 hat: array [HAT_LEFT..HAT_DOWN] of Boolean;
380 begin
381 if (ev.which < e_MaxJoys) and (ev.hat < e_MaxJoyHats) then
382 begin
383 if g_dbg_input then
384 e_LogWritefln('Input Debug: jhat, joy=%s, hat=%s, value=%s', [ev.which, ev.hat, ev.value]);
385 hat[HAT_UP] := LongBool(ev.value and SDL_HAT_UP);
386 hat[HAT_DOWN] := LongBool(ev.value and SDL_HAT_DOWN);
387 hat[HAT_LEFT] := LongBool(ev.value and SDL_HAT_LEFT);
388 hat[HAT_RIGHT] := LongBool(ev.value and SDL_HAT_RIGHT);
389 for i := HAT_LEFT to HAT_DOWN do
390 begin
391 if JoystickHatState[ev.which, ev.hat, i] <> hat[i] then
392 begin
393 down := hat[i];
394 key := e_JoyHatToKey(ev.which, ev.hat, i);
395 e_KeyUpDown(key, down);
396 g_Console_ProcessBind(key, down)
397 end
398 end;
399 JoystickHatState[ev.which, ev.hat] := hat
400 end
401 else
402 begin
403 if g_dbg_input then
404 e_LogWritefln('Input Debug: NOT IN RANGE! jhat, joy=%s, hat=%s, value=%s', [ev.which, ev.hat, ev.value])
405 end
406 end;
408 procedure HandleJoyAdd (var ev: TSDL_JoyDeviceEvent);
409 var i: Integer;
410 begin
411 if (ev.which < e_MaxJoys) then
412 begin
413 JoystickHandle[ev.which] := SDL_JoystickOpen(ev.which);
414 if JoystickHandle[ev.which] <> nil then
415 begin
416 e_LogWritefln('Added Joystick %s', [ev.which]);
417 e_JoystickAvailable[ev.which] := True;
418 for i := 0 to Min(SDL_JoystickNumAxes(JoystickHandle[ev.which]), e_MaxJoyAxes) - 1 do
419 JoystickZeroAxes[ev.which, i] := SDL_JoystickGetAxis(JoystickHandle[ev.which], i)
420 end
421 else
422 begin
423 e_LogWritefln('Warning! Failed to open Joystick %s', [ev.which])
424 end
425 end
426 else
427 begin
428 e_LogWritefln('Warning! Added Joystick %s, but we support only <= %s', [ev.which, e_MaxJoys])
429 end
430 end;
432 procedure HandleJoyRemove (var ev: TSDL_JoyDeviceEvent);
433 begin
434 e_LogWritefln('Removed Joystick %s', [ev.which]);
435 if (ev.which < e_MaxJoys) then
436 begin
437 e_JoystickAvailable[ev.which] := False;
438 if JoystickHandle[ev.which] <> nil then
439 SDL_JoystickClose(JoystickHandle[ev.which]);
440 JoystickHandle[ev.which] := nil
441 end
442 end;
444 (* --------- Input --------- *)
446 function HandleWindow (var ev: TSDL_WindowEvent): Boolean;
447 begin
448 result := false;
449 if g_dbg_input then
450 e_LogWritefln('Window Event: event = %s, data1 = %s, data2 = %s', [ev.event, ev.data1, ev.data2]);
451 case ev.event of
452 SDL_WINDOWEVENT_RESIZED: UpdateSize(ev.data1, ev.data2);
453 SDL_WINDOWEVENT_EXPOSED: sys_Repaint;
454 SDL_WINDOWEVENT_CLOSE: result := true;
455 SDL_WINDOWEVENT_MOVED:
456 begin
457 wx := ev.data1;
458 wy := ev.data2
459 end;
460 SDL_WINDOWEVENT_FOCUS_LOST, SDL_WINDOWEVENT_MINIMIZED:
461 begin
462 e_UnpressAllKeys;
463 if gMuteWhenInactive then
464 e_MuteChannels(true);
465 {$IFDEF ENABLE_HOLMES}
466 if assigned(winBlurCB) then winBlurCB;
467 {$ENDIF}
468 end;
469 SDL_WINDOWEVENT_FOCUS_GAINED, SDL_WINDOWEVENT_MAXIMIZED, SDL_WINDOWEVENT_RESTORED:
470 begin
471 if ev.event = SDL_WINDOWEVENT_MAXIMIZED then
472 begin
473 gWinMaximized := true;
474 gRC_Maximized := true
475 end
476 else if ev.event = SDL_WINDOWEVENT_RESTORED then
477 begin
478 gWinMaximized := false;
479 gRC_Maximized := false
480 end;
481 e_MuteChannels(false);
482 {$IFDEF ENABLE_HOLMES}
483 if assigned(winFocusCB) then winFocusCB;
484 {$ENDIF}
485 end;
486 end
487 end;
489 procedure HandleKeyboard (var ev: TSDL_KeyboardEvent);
490 var down: Boolean; key: Integer;
491 begin
492 key := ev.keysym.scancode;
493 down := (ev.type_ = SDL_KEYDOWN);
494 if key = SDL_SCANCODE_AC_BACK then
495 key := SDL_SCANCODE_ESCAPE;
496 {$IFDEF ENABLE_HOLMES}
497 if fuiOnSDLEvent(PSDL_Event(@ev)^) then
498 begin
499 // event eaten, but...
500 if not down then e_KeyUpDown(key, false);
501 exit;
502 end;
503 {$ENDIF}
504 if ev._repeat = 0 then
505 begin
506 if g_dbg_input then
507 e_LogWritefln('Input Debug: keysym, press=%s, scancode=%s', [down, key]);
508 e_KeyUpDown(key, down);
509 g_Console_ProcessBind(key, down);
510 end
511 else
512 begin
513 if g_dbg_input then
514 e_LogWritefln('Input Debug: keyrep, scancode=%s', [key]);
515 g_Console_ProcessBindRepeat(key);
516 end
517 end;
519 procedure HandleTextInput (var ev: TSDL_TextInputEvent);
520 var ch: UnicodeChar; sch: AnsiChar;
521 begin
522 Utf8ToUnicode(@ch, PChar(ev.text), 1);
523 sch := AnsiChar(wchar2win(ch));
524 if g_dbg_input then
525 e_LogWritefln('Input Debug: text, text="%s", ch = %s, sch = %s', [ev.text, Ord(ch), Ord(sch)]);
526 if IsValid1251(Word(ch)) and IsPrintable1251(ch) then
527 CharPress(sch);
528 end;
530 function sys_HandleInput (): Boolean;
531 var ev: TSDL_Event;
532 begin
533 result := false;
534 ZeroMemory(@ev, sizeof(ev));
535 while SDL_PollEvent(@ev) <> 0 do
536 begin
537 case ev.type_ of
538 SDL_QUITEV: result := true;
539 SDL_WINDOWEVENT: result := HandleWindow(ev.window);
540 SDL_KEYUP, SDL_KEYDOWN: HandleKeyboard(ev.key);
541 SDL_JOYBUTTONDOWN, SDL_JOYBUTTONUP: HandleJoyButton(ev.jbutton);
542 SDL_JOYAXISMOTION: HandleJoyAxis(ev.jaxis);
543 SDL_JOYHATMOTION: HandleJoyHat(ev.jhat);
544 SDL_JOYDEVICEADDED: HandleJoyAdd(ev.jdevice);
545 SDL_JOYDEVICEREMOVED: HandleJoyRemove(ev.jdevice);
546 SDL_TEXTINPUT: HandleTextInput(ev.text);
547 SDL_FINGERMOTION, SDL_FINGERDOWN, SDL_FINGERUP: g_Touch_HandleEvent(ev.tfinger);
548 {$IFDEF ENABLE_HOLMES}
549 SDL_MOUSEBUTTONDOWN, SDL_MOUSEBUTTONUP, SDL_MOUSEWHEEL, SDL_MOUSEMOTION: fuiOnSDLEvent(ev);
550 {$ENDIF}
551 end
552 end
553 end;
555 procedure sys_RequestQuit;
556 var ev: TSDL_Event;
557 begin
558 ev.type_ := SDL_QUITEV;
559 SDL_PushEvent(@ev)
560 end;
562 (* --------- Init --------- *)
564 procedure sys_Init;
565 var flags: UInt32;
566 begin
567 e_WriteLog('Init SDL2', TMsgType.Notify);
568 {$IFDEF HEADLESS}
569 {$IFDEF USE_SDLMIXER}
570 flags := SDL_INIT_TIMER or SDL_INIT_AUDIO or $00004000;
571 {$ELSE}
572 flags := SDL_INIT_TIMER or $00004000;
573 {$ENDIF}
574 {$ELSE}
575 flags := SDL_INIT_TIMER or SDL_INIT_VIDEO;
576 {$ENDIF}
577 SDL_SetHint(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, '0');
578 if SDL_Init(flags) <> 0 then
579 raise Exception.Create('SDL: Init failed: ' + SDL_GetError);
580 {$IFNDEF HEADLESS}
581 if SDL_InitSubSystem(SDL_INIT_JOYSTICK) <> 0 then
582 e_LogWritefln('SDL: Init subsystem failed: %s', [SDL_GetError()]);
583 {$ENDIF}
584 SDL_ShowCursor(SDL_DISABLE);
585 end;
587 procedure sys_Final;
588 begin
589 e_WriteLog('Releasing SDL2', TMsgType.Notify);
590 if context <> nil then
591 begin
592 FreeGL;
593 SDL_GL_DeleteContext(context);
594 context := nil;
595 end;
596 if window <> nil then
597 begin
598 SDL_DestroyWindow(window);
599 window := nil;
600 end;
601 SDL_Quit
602 end;
604 initialization
605 conRegVar('sdl2_display_index', @display, 'use display index as base', '');
606 conRegVar('sdl2_window_x', @wx, 'window position x', '');
607 conRegVar('sdl2_window_y', @wy, 'window position y', '');
608 conRegVar('sdl2_window_center', @wc, 'force window creation at center', '');
609 display := 0;
610 wx := SDL_WINDOWPOS_CENTERED;
611 wy := SDL_WINDOWPOS_CENTERED;
612 wc := false
613 end.