summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: dbf81af)
raw | patch | inline | side by side (parent: dbf81af)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Sat, 12 Oct 2019 19:33:23 +0000 (22:33 +0300) | ||
committer | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Sun, 13 Oct 2019 14:19:20 +0000 (17:19 +0300) |
index ccfd9c4bc2715732e3d746db9f45e1f02065ff9d..175f4743f966649b11b87f20332213900945246d 100644 (file)
{$IFDEF HEADLESS}
// HACK: shit this into env and hope for the best
SetEnvVar('SDL_AUDIODRIVER', 'dummy');
- {$ELSEIF}
+ {$ENDIF}
if NoOutput then begin Result := true; Exit end;
diff --git a/src/game/g_main.pas b/src/game/g_main.pas
index 7d0dfb264e1daefb77761bbb7fc4a3ba0d935380..6a6df2af907e9a4c3f4d83943bb6ac24013ecc87 100644 (file)
--- a/src/game/g_main.pas
+++ b/src/game/g_main.pas
{$ENDIF}
e_WriteToStdOut := False; //{$IFDEF HEADLESS}True;{$ELSE}False;{$ENDIF}
- e_WriteLog('Init Input', TMsgType.Notify);
e_InitInput;
- e_WriteLog('Read config file', TMsgType.Notify);
+ sys_Init;
g_Options_Read(GameDir + '/' + CONFIG_FILENAME);
- g_Console_SysInit;
-
- //GetSystemDefaultLCID()
+ if sys_SetDisplayMode(gScreenWidth, gScreenHeight, gBPP, gFullScreen) = False then
+ raise Exception.Create('Failed to set videomode on startup.');
- //e_WriteLog('Read language file', MSG_NOTIFY);
- //g_Language_Load(DataDir + gLanguage + '.txt');
+ g_Console_SysInit;
e_WriteLog(gLanguage, TMsgType.Notify);
g_Language_Set(gLanguage);
- sys_Init;
-
{$IF not DEFINED(HEADLESS) and DEFINED(ENABLE_HOLMES)}
flexloaded := true;
if not fuiAddWad('flexui.wad') then
diff --git a/src/game/g_menu.pas b/src/game/g_menu.pas
index 3ffef2697e07622dbaceb277f30d1c8036471315..6cbc68e5d96ab006b8fab7f6d7d8e8bb1b682d92 100644 (file)
--- a/src/game/g_menu.pas
+++ b/src/game/g_menu.pas
begin
Name := 'mOptionsControlsJoystickMenu';
for i := 0 to e_MaxJoys - 1 do
- if e_JoystickAvailable[i] then
- with AddScroll(Format(_lc[I_MENU_CONTROL_DEADZONE], [i + 1])) do
- begin
- Name := 'scDeadzone' + IntToStr(i);
- Max := 20
- end
+ with AddScroll(Format(_lc[I_MENU_CONTROL_DEADZONE], [i + 1])) do
+ begin
+ Name := 'scDeadzone' + IntToStr(i);
+ Max := 20
+ end
end;
Menu.DefControl := 'mOptionsControlsJoystickMenu';
g_GUI_AddWindow(Menu);
diff --git a/src/game/g_options.pas b/src/game/g_options.pas
index ac80a1b1f786cd8d11f7356510ca1c743b344b6a..f889ea36e6e63f42154783ab7de5d3ae21145ad4 100644 (file)
--- a/src/game/g_options.pas
+++ b/src/game/g_options.pas
percentage: Integer;
begin
(* Display 0 = Primary display *)
- SDL_GetDesktopDisplayMode(0, @display);
- {$IF DEFINED(ANDROID)}
+ gScreenWidth := 640;
+ gScreenHeight := 480;
+ //gBPP := SDL_BITSPERPIXEL(dispaly.format);
+ gBPP := 32;
+ {$IFDEF ANDROID}
+ gFullScreen := True; (* rotation not allowed? *)
+ {$ELSE}
+ gFullScreen := False;
+ {$ENDIF}
+ if SDL_GetDesktopDisplayMode(0, @display) = 0 then
+ begin
+ {$IFDEF ANDROID}
gScreenWidth := display.w;
gScreenHeight := display.h;
- //gBPP := SDL_BITSPERPIXEL(dispaly.format);
- gBPP := 32;
- gFullScreen := True; (* rotation not allowed? *)
{$ELSE}
(* Window must be smaller than display *)
closest.w := display.w;
gScreenWidth := closest.w;
gScreenHeight := closest.h;
//gBPP := SDL_BITSPERPIXEL(closest.format); (* Resolution list didn't work for some reason *)
- gBPP := 32;
- gFullScreen := False;
{$ENDIF}
+ end
+ else
+ begin
+ e_LogWritefln('SDL: Failed to get desktop display mode: %s', [SDL_GetError])
+ end;
(* Must be positioned on primary display *)
gWinRealPosX := SDL_WINDOWPOS_CENTERED;
gWinRealPosY := SDL_WINDOWPOS_CENTERED;
index 4120c0271cc8f29f3ec32f284105990b41bad66e..4a4a3cb34c92799203e3db627d004a33d2d7769a 100644 (file)
uses
SysUtils, SDL, Math,
+ {$INCLUDE ../nogl/noGLuses.inc}
e_log, e_graphics, e_input, e_sound,
g_options, g_window, g_console, g_game, g_menu, g_gui, g_main;
screen := SDL_SetVideoMode(w, h, bpp, flags);
if screen <> nil then
begin
+ {$IFDEF USE_NOGL}
+ nogl_Init;
+ {$ENDIF}
SDL_WM_SetCaption(GameTitle, nil);
UpdateSize(w, h);
result := True
(* --------- Init --------- *)
procedure sys_Init;
- var flags: Uint32; ok: Boolean; i: Integer;
+ var flags: Uint32; i: Integer;
begin
e_WriteLog('Init SDL', TMsgType.Notify);
flags := SDL_INIT_VIDEO or SDL_INIT_AUDIO or
(*or SDL_INIT_NOPARACHUTE*);
if SDL_Init(flags) <> 0 then
raise Exception.Create('SDL: Init failed: ' + SDL_GetError);
- ok := InitWindow(gScreenWidth, gScreenHeight, gBPP, gFullScreen);
- if not ok then
- raise Exception.Create('SDL: Failed to set videomode: ' + SDL_GetError);
SDL_EnableUNICODE(1);
SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
for i := 0 to e_MaxJoys - 1 do
e_WriteLog('Releasing SDL', TMsgType.Notify);
for i := 0 to e_MaxJoys - 1 do
RemoveJoystick(i);
- SDL_FreeSurface(screen);
+ if screen <> nil then
+ begin
+ {$IFDEF USE_NOGL}
+ nogl_Quit;
+ {$ENDIF}
+ SDL_FreeSurface(screen)
+ end;
SDL_Quit
end;
index 3e55f4510c99f411bfb28ad649ea34f97b278bc6..9485fd9b6e9a0897a5eb328b7232ae8f7ac8a3d9 100644 (file)
uses
SysUtils, SDL2, Math,
e_log, e_graphics, e_input, e_sound,
+ {$INCLUDE ../nogl/noGLuses.inc}
{$IFDEF ENABLE_HOLMES}
g_holmes, sdlcarcass, fui_ctls,
{$ENDIF}
e_ResizeWindow(w, h);
e_InitGL;
g_Game_SetupScreenSize;
- g_Menu_Reset;
+ {$IFNDEF ANDOIRD}
+ (* This will fix menu reset on keyboard showing *)
+ g_Menu_Reset;
+ {$ENDIF}
g_Game_ClearLoading;
{$IFDEF ENABLE_HOLMES}
if assigned(oglInitCB) then oglInitCB;
context := SDL_GL_CreateContext(window);
if context <> nil then
begin
+ {$IFDEF USE_NOGL}
+ nogl_Init;
+ {$ENDIF}
UpdateSize(w, h);
result := true
end
(* --------- Init --------- *)
procedure sys_Init;
- var flags: UInt32; ok: Boolean;
+ var flags: UInt32;
begin
e_WriteLog('Init SDL2', TMsgType.Notify);
{$IFDEF HEADLESS}
SDL_SetHint(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, '0');
if SDL_Init(flags) <> 0 then
raise Exception.Create('SDL: Init failed: ' + SDL_GetError);
- 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;
begin
e_WriteLog('Releasing SDL2', TMsgType.Notify);
if context <> nil then
+ begin
+ {$IFDEF USE_NOGL}
+ nogl_Quit;
+ {$ENDIF}
SDL_GL_DeleteContext(context);
+ context := nil;
+ end;
if window <> nil then
+ begin
SDL_DestroyWindow(window);
- window := nil;
- context := nil;
+ window := nil;
+ end;
SDL_Quit
end;
diff --git a/src/lib/enet/enet.pp b/src/lib/enet/enet.pp
index f0c27befc708d2b1efcf2e1b20dbe187b1ede89d..cbb96b0f33d6d2cc3f444eaf5b87a79ebbccbf48 100644 (file)
--- a/src/lib/enet/enet.pp
+++ b/src/lib/enet/enet.pp
{$ENDIF}
{$ELSE}
{$IFDEF DARWIN}
- {$LINKLIB libenet.a}
+ {$LINKLIB libenet}
{$DEFINE libraryLibENetDecl := cdecl}
{$DEFINE libraryLibENetImp := cdecl; external}
{$DEFINE libraryLibENetVar := cvar; external}
diff --git a/src/nogl/noGL.pas b/src/nogl/noGL.pas
index 20d18bc4fbb1672ff45fdc016b96ca0d20df9a3d..941c8d2dab660957757dd89af164294463b2b0b5 100644 (file)
--- a/src/nogl/noGL.pas
+++ b/src/nogl/noGL.pas
GL_KEEP = $1E00;
GL_INCR = $1E02;
GL_LINEAR = $2601;
- GL_EXTENSIONS = $1F03;
GL_TEXTURE_ENV = $2300;
GL_TEXTURE_ENV_MODE = $2200;
GL_MODULATE = $2100;
+ GL_VENDOR = $1F00;
+ GL_RENDERER = $1F01;
+ GL_VERSION = $1F02;
+ GL_EXTENSIONS = $1F03;
+ GL_SHADING_LANGUAGE_VERSION = $8B8C;
+
// const
// GL_CULL_FACE = $0B44;
// GL_FLOAT = $1406;