@@ -168,14 +168,14 @@ interface
168168{ $I sdlmutex.inc} // 2.0.14 WIP
169169{ $I sdltimer.inc} // 2.0.18
170170{ $I sdlpixels.inc} // 2.0.14 WIP
171- { $I sdlrect.inc} // 2.0.14
171+ { $I sdlrect.inc} // 2.24.0
172172{ $I sdlrwops.inc} // 2.0.14
173173{ $I sdlaudio.inc}
174174{ $I sdlblendmode.inc} // 2.0.14
175175{ $I sdlsurface.inc} // 2.0.14
176- { $I sdlshape .inc} // 2.0.14
177- { $I sdlvideo .inc} // 2.0.14
178- { $I sdlhints.inc} // 2.0.22
176+ { $I sdlvideo .inc} // 2.24.0
177+ { $I sdlshape .inc} // 2.24.0
178+ { $I sdlhints.inc} // 2.26.0
179179{ $I sdlloadso.inc} // 2.24.1
180180{ $I sdlmessagebox.inc} // 2.0.14
181181{ $I sdlrenderer.inc} // 2.0.22
@@ -184,21 +184,21 @@ interface
184184{ $I sdlmouse.inc} // 2.0.24
185185{ $I sdlguid.inc} // 2.24.0
186186{ $I sdljoystick.inc} // 2.24.0
187- { $I sdlsensor.inc}
188- { $I sdlgamecontroller.inc} // 2.0.22
187+ { $I sdlsensor.inc} // 2.26.0
188+ { $I sdlgamecontroller.inc} // 2.24.0
189189{ $I sdlhaptic.inc}
190190{ $I sdlhidapi.inc} // 2.0.18
191- { $I sdltouch.inc}
191+ { $I sdltouch.inc} // 2.24.0
192192{ $I sdlgesture.inc}
193193{ $I sdlsyswm.inc}
194- { $I sdlevents.inc}
194+ { $I sdlevents.inc} // 2.24.0
195195{ $I sdllocale.inc} // 2.0.14
196196{ $I sdlclipboard.inc} // 2.24.1
197197{ $I sdlcpuinfo.inc} // 2.0.14
198198{ $I sdlfilesystem.inc} // 2.24.1
199199{ $I sdllog.inc} // 2.0.14
200200{ $I sdlmisc.inc} // 2.0.14
201- { $I sdlsystem.inc}
201+ { $I sdlsystem.inc} // 2.24.0
202202{ $I sdl.inc} // 2.0.14
203203
204204implementation
@@ -255,14 +255,53 @@ function SDL_PointInRect(const p: PSDL_Point; const r: PSDL_Rect): Boolean;
255255
256256function SDL_RectEmpty (const r: PSDL_Rect): Boolean;
257257begin
258- Result := (r^.w <= 0 ) or (r^.h <= 0 );
258+ Result := (r = NIL ) or (r ^.w <= 0 ) or (r^.h <= 0 );
259259end ;
260260
261261function SDL_RectEquals (const a, b: PSDL_Rect): Boolean;
262262begin
263263 Result := (a^.x = b^.x) and (a^.y = b^.y) and (a^.w = b^.w) and (a^.h = b^.h);
264264end ;
265265
266+ function SDL_PointInFRect (const p: PSDL_FPoint; const r: PSDL_FRect): Boolean;
267+ begin
268+ Result :=
269+ (p^.x >= r^.x) and (p^.x < (r^.x + r^.w))
270+ and
271+ (p^.y >= r^.y) and (p^.y < (r^.y + r^.h))
272+ end ;
273+
274+ function SDL_FRectEmpty (const r: PSDL_FRect): Boolean;
275+ begin
276+ Result := (r = NIL ) or (r^.w <= cfloat(0.0 )) or (r^.h <= cfloat(0.0 ))
277+ end ;
278+
279+ { FIXME: This the Pascal System.Abs() function, instead of the C SDL_fabsf() function. }
280+ function SDL_FRectEqualsEpsilon (const a, b: PSDL_FRect; const epsilon: cfloat): Boolean;
281+ begin
282+ Result :=
283+ (a <> NIL ) and
284+ (b <> NIL ) and
285+ (
286+ (a = b)
287+ or
288+ (
289+ (Abs(a^.x - b^.x) <= epsilon)
290+ and
291+ (Abs(a^.y - b^.y) <= epsilon)
292+ and
293+ (Abs(a^.w - b^.w) <= epsilon)
294+ and
295+ (Abs(a^.h - b^.h) <= epsilon)
296+ )
297+ )
298+ end ;
299+
300+ function SDL_FRectEquals (const a, b: PSDL_FRect): Boolean; Inline;
301+ begin
302+ Result := SDL_FRectEqualsEpsilon(a, b, SDL_FLT_EPSILON)
303+ end ;
304+
266305// from "sdl_atomic.h"
267306function SDL_AtomicIncRef (atomic: PSDL_Atomic): cint;
268307begin
@@ -388,13 +427,6 @@ function SDL_SHAPEMODEALPHA(mode: TWindowShapeMode): Boolean;
388427 Result := (mode = ShapeModeDefault) or (mode = ShapeModeBinarizeAlpha) or (mode = ShapeModeReverseBinarizeAlpha);
389428end ;
390429
391- // from "sdl_sysvideo.h"
392-
393- function FULLSCREEN_VISIBLE (W: PSDL_Window): Variant;
394- begin
395- Result := ((W^.flags and SDL_WINDOW_FULLSCREEN) and (W^.flags and SDL_WINDOW_SHOWN) and not (W^.flags and SDL_WINDOW_MINIMIZED));
396- end ;
397-
398430// from "sdl_video.h"
399431
400432function SDL_WINDOWPOS_UNDEFINED_DISPLAY (X: Variant): Variant;
0 commit comments