summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 40aef8e)
raw | patch | inline | side by side (parent: 40aef8e)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Wed, 9 Oct 2019 19:52:33 +0000 (22:52 +0300) | ||
committer | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Sun, 13 Oct 2019 14:19:20 +0000 (17:19 +0300) |
diff --git a/src/game/Doom2DF.lpr b/src/game/Doom2DF.lpr
index 7934ed1d97d51ae066cb963c295423364cd71a75..7f869f160006312da7185f9baf3d2a2a8e88cfe6 100644 (file)
--- a/src/game/Doom2DF.lpr
+++ b/src/game/Doom2DF.lpr
{$ERROR Sound driver not selected. Use -dUSE_SOUNDSTUB or -dUSE_SDLMIXER or -dUSE_FMOD or -dUSE_OPENAL}
{$ENDIF}
+{$IFDEF ENABLE_HOLMES}
+ {$IFDEF HEADLESS}
+ {$ERROR Holmes in HEADLESS mode has no sense}
+ {$ENDIF}
+ {$IFNDEF USE_SDL2}
+ {$ERROR Holmes supported only with SDL2}
+ {$ENDIF}
+ {$IFDEF USE_GLES1}
+ {$ERROR Holmes not supported with GLES}
+ {$ENDIF}
+{$ENDIF}
+
uses
{$IFDEF ANDROID}
ctypes,
diff --git a/src/game/g_main.pas b/src/game/g_main.pas
index 222002baa53a1a312be411a51bcc1a3f6253431a..7d0dfb264e1daefb77761bbb7fc4a3ba0d935380 100644 (file)
--- a/src/game/g_main.pas
+++ b/src/game/g_main.pas
uses
{$INCLUDE ../nogl/noGLuses.inc}
{$IFDEF ENABLE_HOLMES}
- g_holmes, fui_wadread, fui_style, fui_gfx_gl,
+ g_holmes, sdlcarcass, fui_ctls, fui_wadread, fui_style, fui_gfx_gl,
{$ENDIF}
wadreader, e_log, g_window,
e_graphics, e_input, g_game, g_console, g_gui,
end;
end;
g_holmes_imfunctional := not flexloaded;
+
+ if (not g_holmes_imfunctional) then
+ begin
+ uiInitialize();
+ uiContext.font := 'win14';
+ end;
+
+ if assigned(oglInitCB) then oglInitCB;
{$ENDIF}
//g_Res_CreateDatabases(); // it will be done before connecting to the server for the first time
e_WriteLog('Entering SDLMain', TMsgType.Notify);
-{$WARNINGS OFF}
- SDLMain();
-{$WARNINGS ON}
+ {$WARNINGS OFF}
+ SDLMain();
+ {$WARNINGS ON}
+
+ {$IFDEF ENABLE_HOLMES}
+ if assigned(oglDeinitCB) then oglDeinitCB;
+ {$ENDIF}
sys_Final;
end;
diff --git a/src/game/g_window.pas b/src/game/g_window.pas
index 992c0234419ffd4c5370b705fe8815a4eac8bd09..002e51aa92284fa9db8cdaf39da94dcc8174dc71 100644 (file)
--- a/src/game/g_window.pas
+++ b/src/game/g_window.pas
begin
{$IFDEF HEADLESS}
e_NoGraphics := true;
-{$ELSE}
- {$IFDEF ENABLE_HOLMES}
- if (not g_holmes_imfunctional) then
- begin
- uiInitialize();
- uiContext.font := 'win14';
- end;
- {$ENDIF}
{$ENDIF}
idx := 1;
index 21501c6705baacbfc11a2711f7789163b9c9556e..4120c0271cc8f29f3ec32f284105990b41bad66e 100644 (file)
implementation
uses
- SysUtils, SDL, GL, Math,
- e_log, e_graphics, e_input,
+ SysUtils, SDL, Math,
+ e_log, e_graphics, e_input, e_sound,
g_options, g_window, g_console, g_game, g_menu, g_gui, g_main;
const
SDL_JOYAXISMOTION: HandleJoyAxis(ev.jaxis);
SDL_JOYHATMOTION: HandleJoyHat(ev.jhat);
SDL_VIDEOEXPOSE: sys_Repaint;
+ SDL_ACTIVEEVENT: e_MuteChannels((ev.active.gain = 0) and gMuteWhenInactive);
end
end
end;
index afc18999b4df54d9ac716742cb87eda0b9bc0df7..3e55f4510c99f411bfb28ad649ea34f97b278bc6 100644 (file)
implementation
uses
- SysUtils, SDL2, GL, Math,
- e_log, e_graphics, e_input,
- g_touch,
- g_options, g_window, g_console, g_game, g_menu, g_gui, g_main;
+ SysUtils, SDL2, Math,
+ e_log, e_graphics, e_input, e_sound,
+ {$IFDEF ENABLE_HOLMES}
+ g_holmes, sdlcarcass, fui_ctls,
+ {$ENDIF}
+ g_touch, g_options, g_window, g_console, g_game, g_menu, g_gui, g_main;
const
GameTitle = 'Doom 2D: Forever (SDL 2)';
g_Game_SetupScreenSize;
g_Menu_Reset;
g_Game_ClearLoading;
+ {$IFDEF ENABLE_HOLMES}
+ if assigned(oglInitCB) then oglInitCB;
+ {$ENDIF}
end;
function InitWindow (w, h, bpp: Integer; fullScreen: Boolean): Boolean;
var flags: UInt32;
begin
+ // note: on window close make: if assigned(oglDeinitCB) then oglDeinitCB;
e_LogWritefln('InitWindow %s %s %s %s', [w, h, bpp, fullScreen]);
result := false;
if window = nil then
SDL_WINDOWEVENT_RESIZED: UpdateSize(ev.data1, ev.data2);
SDL_WINDOWEVENT_EXPOSED: sys_Repaint;
SDL_WINDOWEVENT_CLOSE: result := true;
+ SDL_WINDOWEVENT_FOCUS_LOST, SDL_WINDOWEVENT_MINIMIZED:
+ begin
+ e_UnpressAllKeys;
+ if gMuteWhenInactive then
+ e_MuteChannels(true);
+ {$IFDEF ENABLE_HOLMES}
+ if assigned(winBlurCB) then winBlurCB;
+ {$ENDIF}
+ end;
+ SDL_WINDOWEVENT_FOCUS_GAINED, SDL_WINDOWEVENT_MAXIMIZED, SDL_WINDOWEVENT_RESTORED:
+ begin
+ e_MuteChannels(false);
+ {$IFDEF ENABLE_HOLMES}
+ if assigned(winFocusCB) then winFocusCB;
+ {$ENDIF}
+ end;
end
end;
down := (ev.type_ = SDL_KEYDOWN);
if key = SDL_SCANCODE_AC_BACK then
key := SDL_SCANCODE_ESCAPE;
+ {$IFDEF ENABLE_HOLMES}
+ if fuiOnSDLEvent(PSDL_Event(@ev)^) then
+ begin
+ // event eaten, but...
+ if not down then e_KeyUpDown(key, false);
+ exit;
+ end;
+ {$ENDIF}
if ev._repeat = 0 then
begin
if g_dbg_input then
SDL_JOYDEVICEREMOVED: HandleJoyRemove(ev.jdevice);
SDL_TEXTINPUT: HandleTextInput(ev.text);
SDL_FINGERMOTION, SDL_FINGERDOWN, SDL_FINGERUP: g_Touch_HandleEvent(ev.tfinger);
+ {$IFDEF ENABLE_HOLMES}
+ SDL_MOUSEBUTTONDOWN, SDL_MOUSEBUTTONUP, SDL_MOUSEWHEEL, SDL_MOUSEMOTION: fuiOnSDLEvent(ev);
+ {$ENDIF}
end
end
end;
ok := InitWindow(gScreenWidth, gScreenHeight, gBPP, gFullscreen);
if not ok then
raise Exception.Create('SDL: Failed to set videomode: ' + SDL_GetError);
+ SDL_ShowCursor(SDL_DISABLE);
end;
procedure sys_Final;