procedure e_ReleaseEngine();
procedure e_BeginRender();
procedure e_Clear(Mask: TGLbitfield; Red, Green, Blue: Single); overload;
+procedure e_Clear(Red, Green, Blue: Single); overload;
procedure e_Clear(); overload;
procedure e_EndRender();
glClear(Mask);
end;
+procedure e_Clear(Red, Green, Blue: Single); overload;
+begin
+ if e_NoGraphics then Exit;
+ glClearColor(Red, Green, Blue, 0);
+ glClear(GL_COLOR_BUFFER_BIT);
+end;
+
procedure e_Clear(); overload;
begin
if e_NoGraphics then Exit;
function PointToRect(X, Y, X1, Y1: Integer; Width, Height: Word): Integer;
function GetAngle(baseX, baseY, pointX, PointY: Integer): SmallInt;
function GetAngle2(vx, vy: Integer): SmallInt;
-function GetLines(Text: string; FontID: DWORD; MaxWidth: Word): SSArray;
-procedure Sort(var a: SSArray);
function Sscanf(const s: string; const fmt: string;
const Pointers: array of Pointer): Integer;
function InDWArray(a: DWORD; arr: DWArray): Boolean;
uses
Math, geom, e_log, g_map, g_gfx, g_player, SysUtils, MAPDEF,
- StrUtils, e_graphics, g_monsters, g_items, g_game;
+ StrUtils, g_monsters, g_items, g_game;
{$PUSH}
{$WARN 2054 OFF} // unknwon env var
end;
end;
-function GetLines (text: string; FontID: DWORD; MaxWidth: Word): SSArray;
- var
- k: Integer = 1;
- lines: Integer = 0;
- i, len, lastsep: Integer;
-
- function PrepareStep (): Boolean; inline;
- begin
- // Skip leading spaces.
- while PChar(text)[k-1] = ' ' do k += 1;
- Result := k <= len;
- i := k;
- end;
-
- function GetLine (j: Integer; Strip: Boolean): String; inline;
- begin
- // Exclude trailing spaces from the line.
- if Strip then
- while text[j] = ' ' do j -= 1;
-
- Result := Copy(text, k, j-k+1);
- end;
-
- function LineWidth (): Integer; inline;
- var w, h: Word;
- begin
- e_CharFont_GetSize(FontID, GetLine(i, False), w, h);
- Result := w;
- end;
-
-begin
- Result := nil;
- len := Length(text);
- //e_LogWritefln('GetLines @%s len=%s [%s]', [MaxWidth, len, text]);
-
- while PrepareStep() do
- begin
- // Get longest possible sequence (this is not constant because fonts are not monospaced).
- lastsep := 0;
- repeat
- if text[i] in [' ', '.', ',', ':', ';']
- then lastsep := i;
- i += 1;
- until (i > len) or (LineWidth() > MaxWidth);
-
- // Do not include part of a word if possible.
- if (lastsep-k > 3) and (i <= len) and (text[i] <> ' ')
- then i := lastsep + 1;
-
- // Add line.
- SetLength(Result, lines + 1);
- Result[lines] := GetLine(i-1, True);
- //e_LogWritefln(' -> (%s:%s::%s) [%s]', [k, i, LineWidth(), Result[lines]]);
- lines += 1;
-
- k := i;
- end;
-end;
-
-procedure Sort(var a: SSArray);
-var
- i, j: Integer;
- s: string;
-begin
- if a = nil then Exit;
-
- for i := High(a) downto Low(a) do
- for j := Low(a) to High(a)-1 do
- if LowerCase(a[j]) > LowerCase(a[j+1]) then
- begin
- s := a[j];
- a[j] := a[j+1];
- a[j+1] := s;
- end;
-end;
-
function Sscanf(const s: String; const fmt: String;
const Pointers: array of Pointer): Integer;
var
implementation
uses
- {$INCLUDE ../nogl/noGLuses.inc}
g_textures, g_sound, SysUtils, e_res,
g_game, Math, StrUtils, g_player, g_options, g_console, r_playermodel,
g_map, g_weapons, xdynrec, wadreader;
Box: Array [0..8] of DWORD;
Saved_Windows: SSArray;
+function GetLines (text: string; FontID: DWORD; MaxWidth: Word): SSArray;
+ var
+ k: Integer = 1;
+ lines: Integer = 0;
+ i, len, lastsep: Integer;
+
+ function PrepareStep (): Boolean; inline;
+ begin
+ // Skip leading spaces.
+ while PChar(text)[k-1] = ' ' do k += 1;
+ Result := k <= len;
+ i := k;
+ end;
+
+ function GetLine (j: Integer; Strip: Boolean): String; inline;
+ begin
+ // Exclude trailing spaces from the line.
+ if Strip then
+ while text[j] = ' ' do j -= 1;
+
+ Result := Copy(text, k, j-k+1);
+ end;
+
+ function LineWidth (): Integer; inline;
+ var w, h: Word;
+ begin
+ e_CharFont_GetSize(FontID, GetLine(i, False), w, h);
+ Result := w;
+ end;
+
+begin
+ Result := nil;
+ len := Length(text);
+ //e_LogWritefln('GetLines @%s len=%s [%s]', [MaxWidth, len, text]);
+
+ while PrepareStep() do
+ begin
+ // Get longest possible sequence (this is not constant because fonts are not monospaced).
+ lastsep := 0;
+ repeat
+ if text[i] in [' ', '.', ',', ':', ';']
+ then lastsep := i;
+ i += 1;
+ until (i > len) or (LineWidth() > MaxWidth);
+
+ // Do not include part of a word if possible.
+ if (lastsep-k > 3) and (i <= len) and (text[i] <> ' ')
+ then i := lastsep + 1;
+
+ // Add line.
+ SetLength(Result, lines + 1);
+ Result[lines] := GetLine(i-1, True);
+ //e_LogWritefln(' -> (%s:%s::%s) [%s]', [k, i, LineWidth(), Result[lines]]);
+ lines += 1;
+
+ k := i;
+ end;
+end;
+
+procedure Sort(var a: SSArray);
+var
+ i, j: Integer;
+ s: string;
+begin
+ if a = nil then Exit;
+
+ for i := High(a) downto Low(a) do
+ for j := Low(a) to High(a)-1 do
+ if LowerCase(a[j]) > LowerCase(a[j+1]) then
+ begin
+ s := a[j];
+ a[j] := a[j+1];
+ a[j+1] := s;
+ end;
+end;
procedure g_GUI_Init();
begin
if FBackTexture <> '' then // Here goes code duplication from g_game.pas:DrawMenuBackground()
if g_Texture_Get(FBackTexture, ID) then
begin
- e_Clear(GL_COLOR_BUFFER_BIT, 0, 0, 0);
+ e_Clear(0, 0, 0);
e_GetTextureSize(ID, @tw, @th);
if tw = th then
tw := round(tw * 1.333 * (gScreenHeight / th))
e_DrawSize(ID, (gScreenWidth - tw) div 2, 0, 0, False, False, tw, gScreenHeight);
end
else
- e_Clear(GL_COLOR_BUFFER_BIT, 0.5, 0.5, 0.5);
+ e_Clear(0.5, 0.5, 0.5);
// small hack here
if FName = 'AuthorsMenu' then
SetLength(FItems, Length(FItems)+1);
FItems[High(FItems)] := Item;
- if FSort then g_Basic.Sort(FItems);
+ if FSort then g_gui.Sort(FItems);
end;
function TGUIListBox.ItemExists (item: String): Boolean;
FStartLine := 0;
FIndex := -1;
- if FSort then g_Basic.Sort(FItems);
+ if FSort then g_gui.Sort(FItems);
end;
procedure TGUIListBox.SelectItem(Item: String);
implementation
uses
- {$INCLUDE ../nogl/noGLuses.inc}
g_gui, g_textures, e_graphics, g_main, g_window, g_game, g_map,
g_basic, g_console, g_sound, g_gfx, g_player, g_options, g_weapons,
e_log, SysUtils, CONFIG, g_playermodel, DateUtils,
implementation
uses
- e_input, e_graphics, e_log, g_window, g_net, g_console,
+ e_input, e_log, g_window, g_net, g_console,
g_map, g_game, g_sound, g_gui, g_menu, g_options, g_language, g_basic, r_game,
wadreader, g_system, utils, hashtable;
implementation
uses
- {$INCLUDE ../nogl/noGLuses.inc}
{$IFDEF USE_SDL2}
SDL2,
{$ENDIF}
implementation
uses
- {$INCLUDE ../nogl/noGLuses.inc}
e_texture, g_basic, g_map, g_game, g_gfx, g_weapons, g_triggers, g_items,
g_console, g_language, g_monsters, g_player, g_grid, e_log, geom, utils, xstreams;
implementation
uses
-{$INCLUDE ../nogl/noGLuses.inc}
{$IFDEF ENABLE_HOLMES}
g_holmes,
{$ENDIF}
interface
uses
- {$IFDEF USE_MEMPOOL}mempool,{$ENDIF}
MAPDEF, g_textures, g_basic, g_weapons, e_graphics, utils, g_gfx,
ImagingTypes, Imaging, ImagingUtility;
implementation
uses
- {$INCLUDE ../nogl/noGLuses.inc}
g_main, g_sound, g_console, SysUtils, g_player, CONFIG,
e_sound, g_options, g_map, Math, e_log, wadreader;
interface
uses
- SysUtils, Classes,
- e_graphics, g_phys, g_textures;
+ SysUtils, Classes, g_phys, g_textures;
function g_GetSaveName (n: Integer; out valid: Boolean): AnsiString;
uses
SysUtils, Variants, Classes,
- MAPDEF, e_graphics, g_basic, g_sound,
+ MAPDEF, g_basic, g_sound,
xdynrec, hashtable, exoma;
type
uses
SysUtils, Classes, mempool,
- g_textures, g_basic, e_graphics, g_phys, xprofiler;
+ g_textures, g_basic, g_phys, xprofiler;
type