diff --git a/src/game/g_window.pas b/src/game/g_window.pas
index cbc10281f3f8df5809a1971fb1999830816223b7..29f79e480c403d6e6779e61f2a87f72a71fed84d 100644 (file)
--- a/src/game/g_window.pas
+++ b/src/game/g_window.pas
+{$MODE DELPHI}
unit g_window;
interface
unit g_window;
interface
Result := True;
Exit;
{$ENDIF}
Result := True;
Exit;
{$ENDIF}
-
+
Result := False;
e_WriteLog('Setting display mode...', MSG_NOTIFY);
Result := False;
e_WriteLog('Setting display mode...', MSG_NOTIFY);
wFlags := SDL_WINDOW_OPENGL or SDL_WINDOW_RESIZABLE;
if gFullscreen then wFlags := wFlags or SDL_WINDOW_FULLSCREEN;
if gWinMaximized then wFlags := wFlags or SDL_WINDOW_MAXIMIZED;
wFlags := SDL_WINDOW_OPENGL or SDL_WINDOW_RESIZABLE;
if gFullscreen then wFlags := wFlags or SDL_WINDOW_FULLSCREEN;
if gWinMaximized then wFlags := wFlags or SDL_WINDOW_MAXIMIZED;
-
+
if h_Wnd <> nil then
begin
SDL_DestroyWindow(h_Wnd);
h_Wnd := nil;
end;
if h_Wnd <> nil then
begin
SDL_DestroyWindow(h_Wnd);
h_Wnd := nil;
end;
-
+
if gFullscreen then
begin
mode.w := gScreenWidth;
if gFullscreen then
begin
mode.w := gScreenWidth;
h_Wnd := SDL_CreateWindow(PChar(wTitle), gWinRealPosX, gWinRealPosY, gScreenWidth, gScreenHeight, wFlags);
if h_Wnd = nil then Exit;
h_Wnd := SDL_CreateWindow(PChar(wTitle), gWinRealPosX, gWinRealPosY, gScreenWidth, gScreenHeight, wFlags);
if h_Wnd = nil then Exit;
-
+
SDL_GL_MakeCurrent(h_Wnd, h_GL);
SDL_ShowCursor(SDL_DISABLE);
SDL_GL_MakeCurrent(h_Wnd, h_GL);
SDL_ShowCursor(SDL_DISABLE);
Result := False;
wActivate := False;
wDeactivate := False;
Result := False;
wActivate := False;
wDeactivate := False;
-
+
case ev.event of
SDL_WINDOWEVENT_MOVED:
begin
case ev.event of
SDL_WINDOWEVENT_MOVED:
begin
gWinRealPosY := ev.data2;
end;
end;
gWinRealPosY := ev.data2;
end;
end;
-
+
SDL_WINDOWEVENT_MINIMIZED:
begin
if not wMinimized then
SDL_WINDOWEVENT_MINIMIZED:
begin
if not wMinimized then
wDeactivate := True;
end;
end;
wDeactivate := True;
end;
end;
-
+
SDL_WINDOWEVENT_RESIZED:
begin
gScreenWidth := ev.data1;
SDL_WINDOWEVENT_RESIZED:
begin
gScreenWidth := ev.data1;
e_WriteLog('[DEBUG] WinMsgs: Resized to ' + IntToStr(ev.data1) + 'x' + IntToStr(ev.data2), MSG_NOTIFY);
end;
end;
e_WriteLog('[DEBUG] WinMsgs: Resized to ' + IntToStr(ev.data1) + 'x' + IntToStr(ev.data2), MSG_NOTIFY);
end;
end;
-
+
SDL_WINDOWEVENT_EXPOSED:
SwapBuffers();
SDL_WINDOWEVENT_EXPOSED:
SwapBuffers();
-
+
SDL_WINDOWEVENT_MAXIMIZED:
begin
if wMinimized then
SDL_WINDOWEVENT_MAXIMIZED:
begin
if wMinimized then
end;
end;
end;
end;
end;
end;
-
+
SDL_WINDOWEVENT_RESTORED:
begin
if wMinimized then
SDL_WINDOWEVENT_RESTORED:
begin
if wMinimized then
key := ev.key.keysym.scancode;
KeyPress(key);
end;
key := ev.key.keysym.scancode;
KeyPress(key);
end;
-
+
SDL_TEXTINPUT:
begin
Utf8ToUnicode(@uc, PChar(ev.text.text), 1);
SDL_TEXTINPUT:
begin
Utf8ToUnicode(@uc, PChar(ev.text.text), 1);