forked from ev1313/Pascal-SDL-2-Headers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sdlrect.inc
83 lines (65 loc) · 2.39 KB
/
sdlrect.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
//from "sdl_rect.h"
type
{**
* The structure that defines a point
*
* SDL_EnclosePoints
*}
PSDL_Point = ^TSDL_Point;
TSDL_Point = record
x: SInt32;
y: SInt32;
end;
{**
* A rectangle, with the origin at the upper left.
*
* SDL_RectEmpty
* SDL_RectEquals
* SDL_HasIntersection
* SDL_IntersectRect
* SDL_UnionRect
* SDL_EnclosePoints
*}
PSDL_Rect = ^TSDL_Rect;
TSDL_Rect = record
x,y: SInt32;
w,h: SInt32;
end;
{**
* Returns true if the rectangle has no area.
*}
//changed from variant(b�����h!) to TSDL_Rect
//maybe PSDL_Rect?
function SDL_RectEmpty(X: TSDL_Rect): Boolean;
{**
* Returns true if the two rectangles are equal.
*}
function SDL_RectEquals(A: TSDL_Rect; B: TSDL_Rect): Boolean;
{**
* Determine whether two rectangles intersect.
*
* SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
*}
function SDL_HasIntersection(const A: PSDL_Rect; const B: PSDL_Rect): TSDL_Bool cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasIntersection' {$ENDIF} {$ENDIF};
{**
* Calculate the intersection of two rectangles.
*
* SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
*}
function SDL_IntersectRect(const A: PSDL_Rect; const B: PSDL_Rect; result: PSDL_Rect): TSDL_Bool cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_IntersectRect' {$ENDIF} {$ENDIF};
{**
* Calculate the union of two rectangles.
*}
procedure SDL_UnionRect(const A: PSDL_Rect; const B: PSDL_Rect; result: PSDL_Rect) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UnionRect' {$ENDIF} {$ENDIF};
{**
* Calculate a minimal rectangle enclosing a set of points
*
* SDL_TRUE if any points were within the clipping rect
*}
function SDL_EnclosePoints(const points: PSDL_Point; count: SInt32; const clip: PSDL_Rect; result: PSDL_Rect): TSDL_Bool cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_EnclosePoints' {$ENDIF} {$ENDIF};
{**
* Calculate the intersection of a rectangle and line segment.
*
* SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
*}
function SDL_IntersectRectAndLine(const rect: PSDL_Rect; X1: PInt; Y1: PInt; X2: PInt; Y2: PInt): TSDL_Bool cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_IntersectRectAndLine' {$ENDIF} {$ENDIF};