procedure e_TextureFontBuild(Tex: DWORD; var FontID: DWORD; XCount, YCount: Word;
Space: ShortInt=0);
var
+{$IF not DEFINED(USE_NANOGL) and not DEFINED(USE_NOGL)}
loop1 : GLuint;
cx, cy : real;
+{$ENDIF}
i, id: DWORD;
begin
if e_NoGraphics then Exit;
charbuff: packed array [0..15] of AnsiChar;
procedure Main();
-var
- sdlflags: LongWord;
-{$IF not DEFINED(HEADLESS) and DEFINED(ENABLE_HOLMES)}
- flexloaded: Boolean;
+{$IFDEF ENABLE_HOLMES}
+ var flexloaded: Boolean;
{$ENDIF}
begin
e_InitWritelnDriver();
{$ELSE}
procedure g_Options_SetDefaultVideo;
begin
- {$WARNING stub}
gScreenWidth := 640;
gScreenHeight := 480;
gBPP := 32;
flag: Boolean;
wNeedTimeReset: Boolean = false;
wMinimized: Boolean = false;
- wMaximized: Boolean = false;
- wLoadingProgress: Boolean = false;
wLoadingQuit: Boolean = false;
procedure ResetTimer ();
{$ENDIF}
procedure ProcessLoading (forceUpdate: Boolean=false);
-var
{$IFNDEF HEADLESS}
-// ev: TSDL_Event;
+var
stt: UInt64;
{$ENDIF}
begin
-// FillChar(ev, sizeof(ev), 0);
- wLoadingProgress := true;
-
-// while (SDL_PollEvent(@ev) > 0) do
-// begin
-// EventHandler(ev);
-// if (ev.type_ = SDL_QUITEV) then break;
-// end;
- //e_PollJoysticks();
-
-// if (ev.type_ = SDL_QUITEV) or (gExit = EXIT_QUIT) then
-// begin
-// wLoadingProgress := false;
-// exit;
-// end;
+ if sys_HandleInput() = True then
+ Exit;
{$IFNDEF HEADLESS}
if not wMinimized then
begin
if (NetMode = NET_CLIENT) and (NetState <> NET_STATE_AUTH) then g_Net_Client_UpdateWhileLoading();
end;
-
- wLoadingProgress := false;
end;
function SDLMain (): Integer;
var
idx: Integer;
- {$IF not DEFINED(HEADLESS)}
- ltmp: Integer;
- {$ENDIF}
arg: AnsiString;
mdfo: TStream;
{$IFDEF ENABLE_HOLMES}
end;
end;
+{$IFDEF USE_SYSSTUB}
PrintGLSupportedExtensions;
glLegacyNPOT := GLExtensionSupported('GL_ARB_texture_non_power_of_two') or GLExtensionSupported('GL_OES_texture_npot');
+{$ELSE}
+ glLegacyNPOT := False;
+{$ENDIF}
e_logWritefln('NPOT textures: %s', [glLegacyNPOT]);
gwin_dump_extensions := false;
f.BitsPerPixel := bpp;
f.BytesPerPixel := (bpp + 7) div 8;
m := SDL_ListModes(@f, SDL_OPENGL or SDL_FULLSCREEN);
- if (m <> NIL) and (IntPtr(m) <> -1) then
+ if (m <> NIL) and (UIntPtr(m) <> UIntPtr(-1)) then
begin
count := 0;
while m[count] <> nil do inc(count);
implementation
+ uses SysUtils;
+
(* --------- Utils --------- *)
function sys_GetTicks (): Int64;
begin
- Result := 0
+ Result := Round(TimeStampToMSecs(DateTimeToTimeStamp(Now())))
end;
procedure sys_Delay (ms: Integer);
begin
+ Sleep(ms)
end;
(* --------- Graphics --------- *)
es_glEnableClientState: procedure (arr: GLenum); cdecl;
es_glDisableClientState: procedure (arr: GLenum); cdecl;
es_glDrawArrays: procedure (mode: GLenum; first: GLint; count: GLsizei); cdecl;
- es_glActiveTexture: procedure(texture: GLenum); cdecl;
- es_glClientActiveTexture: procedure(texture: GLenum); cdecl;
+// es_glActiveTexture: procedure(texture: GLenum); cdecl;
+// es_glClientActiveTexture: procedure(texture: GLenum); cdecl;
es_glColor4f: procedure(red, green, blue, alpha: GLfloat); cdecl;
es_glEnable: procedure (cap: GLenum); cdecl;
end;
procedure glEnd;
- var count: Integer;
begin
assert(cmds.mode <> GL_INVALID_ENUM);
assert(Length(cmds.v) mod ValPerVertex = 0);
es_glEnableClientState := SDL_GL_GetProcAddress('glEnableClientState');
es_glDisableClientState := SDL_GL_GetProcAddress('glDisableClientState');
es_glDrawArrays := SDL_GL_GetProcAddress('glDrawArrays');
- es_glActiveTexture := SDL_GL_GetProcAddress('glActiveTexture');
- es_glClientActiveTexture := SDL_GL_GetProcAddress('glClientActiveTexture');
+// es_glActiveTexture := SDL_GL_GetProcAddress('glActiveTexture');
+// es_glClientActiveTexture := SDL_GL_GetProcAddress('glClientActiveTexture');
es_glColor4f := SDL_GL_GetProcAddress('glColor4f');
es_glEnable := SDL_GL_GetProcAddress('glEnable');
es_glEnableClientState := nil;
es_glDisableClientState := nil;
es_glDrawArrays := nil;
- es_glActiveTexture := nil;
- es_glClientActiveTexture := nil;
+// es_glActiveTexture := nil;
+// es_glClientActiveTexture := nil;
es_glColor4f := nil;
es_glEnable := nil;
result := UInt64(r)*1000000 div mFrequency;
{$ENDIF}
end;
-(* !!!
-{$ELSEIF DEFINED(USE_SDL)}
-function getTimeMicro: UInt64; inline;
-begin
- {$WARNING use inaccurate profiling timer}
- result := SDL_GetTicks() * 1000
-end;
-*)
{$ELSEIF DEFINED(USE_SDL2)}
function getTimeMicro (): UInt64; inline;
begin
{$ELSE}
function getTimeMicro: UInt64; inline;
begin
- {$WARNING use stub profiling timer}
+ result := Round(TimeStampToMSecs(DateTimeToTimeStamp(Now())) * 1000);
end;
{$ENDIF}