DEADSOFTWARE

eec03232f7d26e99fd2619d39994ff5291b26257
[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 (): PChar;
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 := PChar(Format(GameTitle, [info]))
144 end;
146 function InitWindow (w, h, bpp: Integer; fullScreen, maximized: Boolean): Boolean;
147 var flags: UInt32; x, y: cint;
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 window := SDL_CreateWindow(GetTitle(), x, y, w, h, flags);
182 if window <> nil then
183 begin
184 context := SDL_GL_CreateContext(window);
185 if context <> nil then
186 begin
187 if not LoadGL then
188 begin
189 e_LogWriteln('GL: unable to load OpenGL functions', TMsgType.Fatal);
190 SDL_GL_DeleteContext(context); context := nil;
191 exit;
192 end;
193 if (fullscreen = false) and (maximized = false) and (wc = false) then
194 begin
195 SDL_GetWindowPosition(window, @x, @y);
196 wx := x; wy := y
197 end;
198 gFullScreen := fullscreen;
199 gWinMaximized := maximized;
200 gRC_FullScreen := fullscreen;
201 gRC_Maximized := maximized;
202 UpdateSize(w, h);
203 result := true
204 end
205 else
206 begin
207 // SDL_DestroyWindow(window);
208 e_LogWritefln('SDL: unable to create OpenGL context: %s', [SDL_GetError])
209 end
210 end
211 else
212 begin
213 e_LogWritefln('SDL: unable to create window: %s', [SDL_GetError])
214 end
215 end
216 else
217 begin
218 if fullScreen then flags := SDL_WINDOW_FULLSCREEN else flags := 0;
219 SDL_SetWindowFullscreen(window, flags);
220 SDL_SetWindowSize(window, w, h);
221 if maximized then SDL_MaximizeWindow(window);
222 // always reset to center when changing fullscreen->windowed for safety purposes
223 if wc or (gFullscreen and not fullscreen) or (gWinMaximized and not maximized) then
224 begin
225 x := SDL_WINDOWPOS_CENTERED;
226 y := SDL_WINDOWPOS_CENTERED
227 end
228 else
229 begin
230 x := wx;
231 y := wy
232 end;
233 SDL_SetWindowPosition(window, x, y);
234 if (fullscreen = false) and (maximized = false) and (wc = false) then
235 begin
236 SDL_GetWindowPosition(window, @x, @y);
237 wx := x; wy := y
238 end;
239 gFullScreen := fullscreen;
240 gWinMaximized := maximized;
241 gRC_FullScreen := fullscreen;
242 gRC_Maximized := maximized;
243 UpdateSize(w, h);
244 result := true
245 end
246 end;
248 procedure sys_Repaint;
249 begin
250 SDL_GL_SwapWindow(window)
251 end;
253 procedure sys_EnableVSync (yes: Boolean);
254 begin
255 if yes then
256 SDL_GL_SetSwapInterval(1)
257 else
258 SDL_GL_SetSwapInterval(0)
259 end;
261 function sys_GetDisplayModes (bpp: Integer): SSArray;
262 var i, count, num, pw, ph: Integer; m: TSDL_DisplayMode;
263 begin
264 result := nil;
265 num := SDL_GetNumDisplayModes(display);
266 if num < 0 then
267 e_LogWritefln('SDL: unable to get numer of available display modes: %s', [SDL_GetError]);
268 if num > 0 then
269 begin
270 e_LogWritefln('Video modes for display %s:', [display]);
271 SetLength(result, num);
272 i := 0; count := 0; pw := 0; ph := 0;
273 while i < num do
274 begin
275 SDL_GetDisplayMode(display, i, @m);
276 if ((pw <> m.w) or (ph <> m.h)) then
277 begin
278 e_LogWritefln('* %sx%sx%s@%s', [m.w, m.h, SDL_BITSPERPIXEL(m.format), m.refresh_rate]);
279 pw := m.w; ph := m.h;
280 result[count] := IntToStr(m.w) + 'x' + IntToStr(m.h);
281 Inc(count);
282 end
283 else
284 begin
285 e_LogWritefln('- %sx%sx%s@%s', [m.w, m.h, SDL_BITSPERPIXEL(m.format), m.refresh_rate]);
286 end;
287 Inc(i)
288 end;
289 SetLength(result, count)
290 end
291 end;
293 function sys_SetDisplayMode (w, h, bpp: Integer; fullScreen, maximized: Boolean): Boolean;
294 begin
295 result := InitWindow(w, h, bpp, fullScreen, maximized)
296 end;
298 (* --------- Joystick --------- *)
300 procedure HandleJoyButton (var ev: TSDL_JoyButtonEvent);
301 var down: Boolean; key: Integer;
302 begin
303 if (ev.which < e_MaxJoys) and (ev.button < e_MaxJoyBtns) then
304 begin
305 key := e_JoyButtonToKey(ev.which, ev.button);
306 down := ev.type_ = SDL_JOYBUTTONDOWN;
307 if g_dbg_input then
308 e_LogWritefln('Input Debug: jbutton, joy=%s, button=%s, keycode=%s, press=%s', [ev.which, ev.button, key, down]);
309 e_KeyUpDown(key, down);
310 g_Console_ProcessBind(key, down)
311 end
312 else
313 begin
314 if g_dbg_input then
315 begin
316 down := ev.type_ = SDL_JOYBUTTONDOWN;
317 e_LogWritefln('Input Debug: NOT IN RANGE! jbutton, joy=%s, button=%s, press=%s', [ev.which, ev.button, down])
318 end
319 end
320 end;
322 procedure HandleJoyAxis (var ev: TSDL_JoyAxisEvent);
323 var key, minuskey: Integer;
324 begin
325 if (ev.which < e_MaxJoys) and (ev.axis < e_MaxJoyAxes) then
326 begin
327 key := e_JoyAxisToKey(ev.which, ev.axis, AX_PLUS);
328 minuskey := e_JoyAxisToKey(ev.which, ev.axis, AX_MINUS);
330 if g_dbg_input then
331 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]]);
333 if ev.value < JoystickZeroAxes[ev.which, ev.axis] - e_JoystickDeadzones[ev.which] then
334 begin
335 if (e_KeyPressed(key)) then
336 begin
337 e_KeyUpDown(key, False);
338 g_Console_ProcessBind(key, False)
339 end;
340 e_KeyUpDown(minuskey, True);
341 g_Console_ProcessBind(minuskey, True)
342 end
343 else if ev.value > JoystickZeroAxes[ev.which, ev.axis] + e_JoystickDeadzones[ev.which] then
344 begin
345 if (e_KeyPressed(minuskey)) then
346 begin
347 e_KeyUpDown(minuskey, False);
348 g_Console_ProcessBind(minuskey, False)
349 end;
350 e_KeyUpDown(key, True);
351 g_Console_ProcessBind(key, True)
352 end
353 else
354 begin
355 if (e_KeyPressed(minuskey)) then
356 begin
357 e_KeyUpDown(minuskey, False);
358 g_Console_ProcessBind(minuskey, False)
359 end;
360 if (e_KeyPressed(key)) then
361 begin
362 e_KeyUpDown(key, False);
363 g_Console_ProcessBind(key, False)
364 end
365 end
366 end
367 else
368 begin
369 if g_dbg_input then
370 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]])
371 end
372 end;
374 procedure HandleJoyHat (var ev: TSDL_JoyHatEvent);
375 var
376 down: Boolean;
377 i, key: Integer;
378 hat: array [HAT_LEFT..HAT_DOWN] of Boolean;
379 begin
380 if (ev.which < e_MaxJoys) and (ev.hat < e_MaxJoyHats) then
381 begin
382 if g_dbg_input then
383 e_LogWritefln('Input Debug: jhat, joy=%s, hat=%s, value=%s', [ev.which, ev.hat, ev.value]);
384 hat[HAT_UP] := LongBool(ev.value and SDL_HAT_UP);
385 hat[HAT_DOWN] := LongBool(ev.value and SDL_HAT_DOWN);
386 hat[HAT_LEFT] := LongBool(ev.value and SDL_HAT_LEFT);
387 hat[HAT_RIGHT] := LongBool(ev.value and SDL_HAT_RIGHT);
388 for i := HAT_LEFT to HAT_DOWN do
389 begin
390 if JoystickHatState[ev.which, ev.hat, i] <> hat[i] then
391 begin
392 down := hat[i];
393 key := e_JoyHatToKey(ev.which, ev.hat, i);
394 e_KeyUpDown(key, down);
395 g_Console_ProcessBind(key, down)
396 end
397 end;
398 JoystickHatState[ev.which, ev.hat] := hat
399 end
400 else
401 begin
402 if g_dbg_input then
403 e_LogWritefln('Input Debug: NOT IN RANGE! jhat, joy=%s, hat=%s, value=%s', [ev.which, ev.hat, ev.value])
404 end
405 end;
407 procedure HandleJoyAdd (var ev: TSDL_JoyDeviceEvent);
408 var i: Integer;
409 begin
410 if (ev.which < e_MaxJoys) then
411 begin
412 JoystickHandle[ev.which] := SDL_JoystickOpen(ev.which);
413 if JoystickHandle[ev.which] <> nil then
414 begin
415 e_LogWritefln('Added Joystick %s', [ev.which]);
416 e_JoystickAvailable[ev.which] := True;
417 for i := 0 to Min(SDL_JoystickNumAxes(JoystickHandle[ev.which]), e_MaxJoyAxes) - 1 do
418 JoystickZeroAxes[ev.which, i] := SDL_JoystickGetAxis(JoystickHandle[ev.which], i)
419 end
420 else
421 begin
422 e_LogWritefln('Warning! Failed to open Joystick %s', [ev.which])
423 end
424 end
425 else
426 begin
427 e_LogWritefln('Warning! Added Joystick %s, but we support only <= %s', [ev.which, e_MaxJoys])
428 end
429 end;
431 procedure HandleJoyRemove (var ev: TSDL_JoyDeviceEvent);
432 begin
433 e_LogWritefln('Removed Joystick %s', [ev.which]);
434 if (ev.which < e_MaxJoys) then
435 begin
436 e_JoystickAvailable[ev.which] := False;
437 if JoystickHandle[ev.which] <> nil then
438 SDL_JoystickClose(JoystickHandle[ev.which]);
439 JoystickHandle[ev.which] := nil
440 end
441 end;
443 (* --------- Input --------- *)
445 function HandleWindow (var ev: TSDL_WindowEvent): Boolean;
446 begin
447 result := false;
448 if g_dbg_input then
449 e_LogWritefln('Window Event: event = %s, data1 = %s, data2 = %s', [ev.event, ev.data1, ev.data2]);
450 case ev.event of
451 SDL_WINDOWEVENT_RESIZED: UpdateSize(ev.data1, ev.data2);
452 SDL_WINDOWEVENT_EXPOSED: sys_Repaint;
453 SDL_WINDOWEVENT_CLOSE: result := true;
454 SDL_WINDOWEVENT_MOVED:
455 begin
456 wx := ev.data1;
457 wy := ev.data2
458 end;
459 SDL_WINDOWEVENT_FOCUS_LOST, SDL_WINDOWEVENT_MINIMIZED:
460 begin
461 e_UnpressAllKeys;
462 if gMuteWhenInactive then
463 e_MuteChannels(true);
464 {$IFDEF ENABLE_HOLMES}
465 if assigned(winBlurCB) then winBlurCB;
466 {$ENDIF}
467 end;
468 SDL_WINDOWEVENT_FOCUS_GAINED, SDL_WINDOWEVENT_MAXIMIZED, SDL_WINDOWEVENT_RESTORED:
469 begin
470 if ev.event = SDL_WINDOWEVENT_MAXIMIZED then
471 begin
472 gWinMaximized := true;
473 gRC_Maximized := true
474 end
475 else if ev.event = SDL_WINDOWEVENT_RESTORED then
476 begin
477 gWinMaximized := false;
478 gRC_Maximized := false
479 end;
480 e_MuteChannels(false);
481 {$IFDEF ENABLE_HOLMES}
482 if assigned(winFocusCB) then winFocusCB;
483 {$ENDIF}
484 end;
485 end
486 end;
488 procedure HandleKeyboard (var ev: TSDL_KeyboardEvent);
489 var down: Boolean; key: Integer;
490 begin
491 key := ev.keysym.scancode;
492 down := (ev.type_ = SDL_KEYDOWN);
493 if key = SDL_SCANCODE_AC_BACK then
494 key := SDL_SCANCODE_ESCAPE;
495 {$IFDEF ENABLE_HOLMES}
496 if fuiOnSDLEvent(PSDL_Event(@ev)^) then
497 begin
498 // event eaten, but...
499 if not down then e_KeyUpDown(key, false);
500 exit;
501 end;
502 {$ENDIF}
503 if ev._repeat = 0 then
504 begin
505 if g_dbg_input then
506 e_LogWritefln('Input Debug: keysym, press=%s, scancode=%s', [down, key]);
507 e_KeyUpDown(key, down);
508 g_Console_ProcessBind(key, down);
509 end
510 else
511 begin
512 if g_dbg_input then
513 e_LogWritefln('Input Debug: keyrep, scancode=%s', [key]);
514 g_Console_ProcessBindRepeat(key);
515 end
516 end;
518 procedure HandleTextInput (var ev: TSDL_TextInputEvent);
519 var ch: UnicodeChar; sch: AnsiChar;
520 begin
521 Utf8ToUnicode(@ch, PChar(ev.text), 1);
522 sch := AnsiChar(wchar2win(ch));
523 if g_dbg_input then
524 e_LogWritefln('Input Debug: text, text="%s", ch = %s, sch = %s', [ev.text, Ord(ch), Ord(sch)]);
525 if IsValid1251(Word(ch)) and IsPrintable1251(ch) then
526 CharPress(sch);
527 end;
529 function sys_HandleInput (): Boolean;
530 var ev: TSDL_Event;
531 begin
532 result := false;
533 ZeroMemory(@ev, sizeof(ev));
534 while SDL_PollEvent(@ev) <> 0 do
535 begin
536 case ev.type_ of
537 SDL_QUITEV: result := true;
538 SDL_WINDOWEVENT: result := HandleWindow(ev.window);
539 SDL_KEYUP, SDL_KEYDOWN: HandleKeyboard(ev.key);
540 SDL_JOYBUTTONDOWN, SDL_JOYBUTTONUP: HandleJoyButton(ev.jbutton);
541 SDL_JOYAXISMOTION: HandleJoyAxis(ev.jaxis);
542 SDL_JOYHATMOTION: HandleJoyHat(ev.jhat);
543 SDL_JOYDEVICEADDED: HandleJoyAdd(ev.jdevice);
544 SDL_JOYDEVICEREMOVED: HandleJoyRemove(ev.jdevice);
545 SDL_TEXTINPUT: HandleTextInput(ev.text);
546 SDL_FINGERMOTION, SDL_FINGERDOWN, SDL_FINGERUP: g_Touch_HandleEvent(ev.tfinger);
547 {$IFDEF ENABLE_HOLMES}
548 SDL_MOUSEBUTTONDOWN, SDL_MOUSEBUTTONUP, SDL_MOUSEWHEEL, SDL_MOUSEMOTION: fuiOnSDLEvent(ev);
549 {$ENDIF}
550 end
551 end
552 end;
554 procedure sys_RequestQuit;
555 var ev: TSDL_Event;
556 begin
557 ev.type_ := SDL_QUITEV;
558 SDL_PushEvent(@ev)
559 end;
561 (* --------- Init --------- *)
563 procedure sys_Init;
564 var flags: UInt32;
565 begin
566 e_WriteLog('Init SDL2', TMsgType.Notify);
567 {$IFDEF HEADLESS}
568 {$IFDEF USE_SDLMIXER}
569 flags := SDL_INIT_TIMER or SDL_INIT_AUDIO or $00004000;
570 {$ELSE}
571 flags := SDL_INIT_TIMER or $00004000;
572 {$ENDIF}
573 {$ELSE}
574 flags := SDL_INIT_TIMER or SDL_INIT_VIDEO;
575 {$ENDIF}
576 SDL_SetHint(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, '0');
577 if SDL_Init(flags) <> 0 then
578 raise Exception.Create('SDL: Init failed: ' + SDL_GetError);
579 {$IFNDEF HEADLESS}
580 if SDL_InitSubSystem(SDL_INIT_JOYSTICK) <> 0 then
581 e_LogWritefln('SDL: Init subsystem failed: %s', [SDL_GetError()]);
582 {$ENDIF}
583 SDL_ShowCursor(SDL_DISABLE);
584 end;
586 procedure sys_Final;
587 begin
588 e_WriteLog('Releasing SDL2', TMsgType.Notify);
589 if context <> nil then
590 begin
591 FreeGL;
592 SDL_GL_DeleteContext(context);
593 context := nil;
594 end;
595 if window <> nil then
596 begin
597 SDL_DestroyWindow(window);
598 window := nil;
599 end;
600 SDL_Quit
601 end;
603 initialization
604 conRegVar('sdl2_display_index', @display, 'use display index as base', '');
605 conRegVar('sdl2_window_x', @wx, 'window position x', '');
606 conRegVar('sdl2_window_y', @wy, 'window position y', '');
607 conRegVar('sdl2_window_center', @wc, 'force window creation at center', '');
608 display := 0;
609 wx := SDL_WINDOWPOS_CENTERED;
610 wy := SDL_WINDOWPOS_CENTERED;
611 wc := false
612 end.