Skip to content

Commit e0a3e70

Browse files
Merge pull request #120 from suve/add-sdlstdinc-math-functions
Add sdlstdinc math functions This patch adds the cstdlib-like math functions found in SDL_stdinc.h. The doc-comments are based on Linux man-pages and research into SDL's git history.
2 parents 4fe2132 + a0c4392 commit e0a3e70

File tree

2 files changed

+372
-5
lines changed

2 files changed

+372
-5
lines changed

units/sdl2.pas

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,6 @@ function SDL_FRectEmpty(const r: PSDL_FRect): Boolean;
259259
Result := (r = NIL) or (r^.w <= cfloat(0.0)) or (r^.h <= cfloat(0.0))
260260
end;
261261

262-
{ FIXME: This the Pascal System.Abs() function, instead of the C SDL_fabsf() function. }
263262
function SDL_FRectEqualsEpsilon(const a, b: PSDL_FRect; const epsilon: cfloat): Boolean;
264263
begin
265264
Result :=
@@ -269,13 +268,13 @@ function SDL_FRectEqualsEpsilon(const a, b: PSDL_FRect; const epsilon: cfloat):
269268
(a = b)
270269
or
271270
(
272-
(Abs(a^.x - b^.x) <= epsilon)
271+
(SDL_fabsf(a^.x - b^.x) <= epsilon)
273272
and
274-
(Abs(a^.y - b^.y) <= epsilon)
273+
(SDL_fabsf(a^.y - b^.y) <= epsilon)
275274
and
276-
(Abs(a^.w - b^.w) <= epsilon)
275+
(SDL_fabsf(a^.w - b^.w) <= epsilon)
277276
and
278-
(Abs(a^.h - b^.h) <= epsilon)
277+
(SDL_fabsf(a^.h - b^.h) <= epsilon)
279278
)
280279
)
281280
end;

0 commit comments

Comments
 (0)