Physics

# Physics

## Description

The physics contains code to check and perform collisions between bitmaps and shapes in SwinGame. This code will help you determine if two sprites have hit each other, or allow you to bounce one sprite off another or off a stationary shape.

The functions that contain the text "collision" are used to determine if two things have collided, for example BitmapPointCollision is used to determine if a bitmap (with a specified location) has collided with a given point.

The procedures that contain the text "collide" are used to perform a "bounce" style collision, where a sprite is bounced off some other thing. For example CollideCircleLine is used to bounce a sprite (which should be treated like a circle) off a given line.

### Bitmap Collision

Returns True if two bitmaps have collided using per pixel testing if required. The pt1 and pt2 (Point2D) parameters specify the world location of the bitmaps (bmp1 and bmp2).

• Bitmap Collision (bmp1, const pt1, bmp2, const pt2) : Boolean [show]

Returns True if two bitmaps have collided using per pixel testing if required. The pt1 and pt2 (Point2D) parameters specify the world location of the bitmaps (bmp1 and bmp2).

Parameters:
bmp1 : Bitmap
pt1 : Point2D
bmp2 : Bitmap
pt2 : Point2D
Returns:
Boolean :
Signatures by Language:
C/C++: bool bitmap_at_points_collision(bitmap bmp1, const point2d *pt1, bitmap bmp2, const point2d *pt2);
C/C++: bool bitmap_at_points_collision_byval(bitmap bmp1, const point2d pt1, bitmap bmp2, const point2d pt2);
C++: bool bitmap_collision(bitmap bmp1, const point2d &pt1, bitmap bmp2, const point2d &pt2);
Pascal: function BitmapCollision(bmp1: Bitmap; const pt1: Point2D; bmp2: Bitmap; const pt2: Point2D): Boolean;
• Bitmap Collision (bmp1, x1, y1, bmp2, x2, y2) : Boolean [show]

Returns True if two bitmaps have collided using per pixel testing if required. The x and y parameters specify the world location of the bitmaps (bmp1 and bmp2).

Parameters:
bmp1 : Bitmap
x1 : Longint
y1 : Longint
bmp2 : Bitmap
x2 : Longint
y2 : Longint
Returns:
Boolean :
Signatures by Language:
C/C++: bool bitmap_collision(bitmap bmp1, int32_t x1, int32_t y1, bitmap bmp2, int32_t x2, int32_t y2);
Pascal: function BitmapCollision(bmp1: Bitmap; x1: Longint; y1: Longint; bmp2: Bitmap; x2: Longint; y2: Longint): Boolean;
• Bitmap Collision (bmp1, const pt1, const part1, bmp2, const pt2, const part2) : Boolean [show]

Returns True if the specified parts (part1 and part2 rectangles) of the two bitmaps (bmp1 and bmpt2) have collided, using pixel level collision if required. The pt1 and pt2 (Point2D) parameters specify the world location of the bitmaps (bmp1 and bmp2).

Parameters:
bmp1 : Bitmap
pt1 : Point2D
part1 : Rectangle
bmp2 : Bitmap
pt2 : Point2D
part2 : Rectangle
Returns:
Boolean :
Signatures by Language:
C/C++: bool bitmaps_parts_collision(bitmap bmp1, const point2d *pt1, const rectangle *part1, bitmap bmp2, const point2d *pt2, const rectangle *part2);
C/C++: bool bitmaps_parts_collision_byval(bitmap bmp1, const point2d pt1, const rectangle part1, bitmap bmp2, const point2d pt2, const rectangle part2);
C++: bool bitmap_collision(bitmap bmp1, const point2d &pt1, const rectangle &part1, bitmap bmp2, const point2d &pt2, const rectangle &part2);
Pascal: function BitmapCollision(bmp1: Bitmap; const pt1: Point2D; const part1: Rectangle; bmp2: Bitmap; const pt2: Point2D; const part2: Rectangle): Boolean;

### Bitmap Part Point Collision

Returns True if a point (pt) is located within the part (rectangle) of the bitmap bmp when it is drawn at x,y, using pixel level collisions. For bounding box collisions use the rectangle collision functions. The x and y values specify the world location of the bitmap. The point pt needs to be provided in world coordinates.

• Bitmap Part Point Collision (bmp, x, y, const part, const pt) : Boolean [show]

Returns True if a point (pt) is located within the part (rectangle) of the bitmap bmp when it is drawn at x,y, using pixel level collisions. For bounding box collisions use the rectangle collision functions. The x and y values specify the world location of the bitmap. The point pt needs to be provided in world coordinates.

Parameters:
bmp : Bitmap
x : Longint
y : Longint
part : Rectangle
pt : Point2D
Returns:
Boolean :
Signatures by Language:
C/C++: bool bitmap_part_point_xycollision(bitmap bmp, int32_t x, int32_t y, const rectangle *part, const point2d *pt);
C/C++: bool bitmap_part_point_xycollision_byval(bitmap bmp, int32_t x, int32_t y, const rectangle part, const point2d pt);
C++: bool bitmap_part_point_collision(bitmap bmp, int32_t x, int32_t y, const rectangle &part, const point2d &pt);
Pascal: function BitmapPartPointCollision(bmp: Bitmap; x: Longint; y: Longint; const part: Rectangle; const pt: Point2D): Boolean;
• Bitmap Part Point Collision (bmp, x, y, const part, ptX, ptY) : Boolean [show]

Returns True if a point (ptX,ptY) is located within the part (rectangle) of the bitmap bmp when it is drawn at x,y, using pixel level collisions. For bounding box collisions use the rectangle collision functions. The x and y values specify the world location of the bitmap. The ptX and ptY needs to be provided in world coordinates.

Parameters:
bmp : Bitmap
x : Longint
y : Longint
part : Rectangle
ptX : Single
ptY : Single
Returns:
Boolean :
Signatures by Language:
C/C++: bool bitmap_part_point_collision(bitmap bmp, int32_t x, int32_t y, const rectangle *part, float ptX, float ptY);
C/C++: bool bitmap_part_point_collision_byval(bitmap bmp, int32_t x, int32_t y, const rectangle part, float ptX, float ptY);
C++: bool bitmap_part_point_collision(bitmap bmp, int32_t x, int32_t y, const rectangle &part, float ptX, float ptY);
Pascal: function BitmapPartPointCollision(bmp: Bitmap; x: Longint; y: Longint; const part: Rectangle; ptX: Single; ptY: Single): Boolean;

### Bitmap Point Collision

Returns True if a point (pt) is located within the bitmap bmp when it is drawn at x,y, using pixel level collisions. The x and y values specify the world location of the bitmap. The point pt needs to be provided in world coordinates.

• Bitmap Point Collision (bmp, x, y, const pt) : Boolean [show]

Returns True if a point (pt) is located within the bitmap bmp when it is drawn at x,y, using pixel level collisions. The x and y values specify the world location of the bitmap. The point pt needs to be provided in world coordinates.

Parameters:
bmp : Bitmap
x : Longint
y : Longint
pt : Point2D
Returns:
Boolean :
Signatures by Language:
C/C++: bool bitmap_point_pt_collision(bitmap bmp, int32_t x, int32_t y, const point2d *pt);
C/C++: bool bitmap_point_pt_collision_byval(bitmap bmp, int32_t x, int32_t y, const point2d pt);
C++: bool bitmap_point_collision(bitmap bmp, int32_t x, int32_t y, const point2d &pt);
Pascal: function BitmapPointCollision(bmp: Bitmap; x: Longint; y: Longint; const pt: Point2D): Boolean;
• Bitmap Point Collision (bmp, x, y, ptX, ptY) : Boolean [show]

Returns True if a point (ptX,ptY) is located within the bitmap bmp when it is drawn at x,y, using pixel level collisions. The x and y values specify the world location of the bitmap. The ptX and ptY needs to be provided in world coordinates.

Parameters:
bmp : Bitmap
x : Longint
y : Longint
ptX : Single
ptY : Single
Returns:
Boolean :
Signatures by Language:
C/C++: bool bitmap_point_collision(bitmap bmp, int32_t x, int32_t y, float ptX, float ptY);
Pascal: function BitmapPointCollision(bmp: Bitmap; x: Longint; y: Longint; ptX: Single; ptY: Single): Boolean;

### Bitmap Rect Collision

Returns True if the indicated part of the bitmap has collided with the specified rectangle.

• Bitmap Rect Collision (bmp, const pt, const part, const rect) : Boolean [show]

Returns True if the indicated part of the bitmap has collided with the specified rectangle.

Parameters:
bmp : Bitmap
pt : Point2D
part : Rectangle
rect : Rectangle
Returns:
Boolean :
Signatures by Language:
C/C++: bool bitmap_part_at_pt_rect_collision(bitmap bmp, const point2d *pt, const rectangle *part, const rectangle *rect);
C/C++: bool bitmap_part_at_pt_rect_collision_byval(bitmap bmp, const point2d pt, const rectangle part, const rectangle rect);
C++: bool bitmap_rect_collision(bitmap bmp, const point2d &pt, const rectangle &part, const rectangle &rect);
Pascal: function BitmapRectCollision(bmp: Bitmap; const pt: Point2D; const part: Rectangle; const rect: Rectangle): Boolean;
• Bitmap Rect Collision (bmp, x, y, const rect) : Boolean [show]

Returns True if the bitmap bmp has collided with the rectangle specified using pixel level testing if required. The x and y values specify the world location of the bitmap. The rectangle rect needs to be provided in world coordinates.

Parameters:
bmp : Bitmap
x : Longint
y : Longint
rect : Rectangle
Returns:
Boolean :
Signatures by Language:
C/C++: bool bitmap_rectangle_collision(bitmap bmp, int32_t x, int32_t y, const rectangle *rect);
C/C++: bool bitmap_rectangle_collision_byval(bitmap bmp, int32_t x, int32_t y, const rectangle rect);
C++: bool bitmap_rect_collision(bitmap bmp, int32_t x, int32_t y, const rectangle &rect);
Pascal: function BitmapRectCollision(bmp: Bitmap; x: Longint; y: Longint; const rect: Rectangle): Boolean;
• Bitmap Rect Collision (bmp, x, y, const part, const rect) : Boolean [show]

Returns True if the indicated part of the bitmap has collided with the specified rectangle.

Parameters:
bmp : Bitmap
x : Longint
y : Longint
part : Rectangle
rect : Rectangle
Returns:
Boolean :
Signatures by Language:
C/C++: bool bitmap_part_rect_collision(bitmap bmp, int32_t x, int32_t y, const rectangle *part, const rectangle *rect);
C/C++: bool bitmap_part_rect_collision_byval(bitmap bmp, int32_t x, int32_t y, const rectangle part, const rectangle rect);
C++: bool bitmap_rect_collision(bitmap bmp, int32_t x, int32_t y, const rectangle &part, const rectangle &rect);
Pascal: function BitmapRectCollision(bmp: Bitmap; x: Longint; y: Longint; const part: Rectangle; const rect: Rectangle): Boolean;
• Bitmap Rect Collision (bmp, x, y, rectX, rectY, rectWidth, rectHeight) : Boolean [show]

Returns True if the bitmap bmp has collided with the rectangle specified using pixel level testing if required. The x and y values specify the world location of the bitmap. The rectangles world position (rectX and rectY) and size (rectWidth and rectHeight) need to be provided.

Parameters:
bmp : Bitmap
x : Longint
y : Longint
rectX : Longint
rectY : Longint
rectWidth : Longint
rectHeight : Longint
Returns:
Boolean :
Signatures by Language:
C/C++: bool bitmap_rect_collision(bitmap bmp, int32_t x, int32_t y, int32_t rectX, int32_t rectY, int32_t rectWidth, int32_t rectHeight);
Pascal: function BitmapRectCollision(bmp: Bitmap; x: Longint; y: Longint; rectX: Longint; rectY: Longint; rectWidth: Longint; rectHeight: Longint): Boolean;

### Cell Bitmap Collision

Returns true if the cell in the specified bitmap has collided with a bitmap.

• Cell Bitmap Collision (bmp1, cell, const pt1, bmp2, const pt2) : Boolean [show]

Returns true if the cell in the specified bitmap has collided with a bitmap.

Parameters:
bmp1 : Bitmap
cell : Longint
pt1 : Point2D
bmp2 : Bitmap
pt2 : Point2D
Returns:
Boolean :
Signatures by Language:
C/C++: bool cell_bitmap_collision_at_pt(bitmap bmp1, int32_t cell, const point2d *pt1, bitmap bmp2, const point2d *pt2);
C/C++: bool cell_bitmap_collision_at_pt_byval(bitmap bmp1, int32_t cell, const point2d pt1, bitmap bmp2, const point2d pt2);
C++: bool cell_bitmap_collision(bitmap bmp1, int32_t cell, const point2d &pt1, bitmap bmp2, const point2d &pt2);
Pascal: function CellBitmapCollision(bmp1: Bitmap; cell: Longint; const pt1: Point2D; bmp2: Bitmap; const pt2: Point2D): Boolean;
• Cell Bitmap Collision (bmp1, cell, const pt1, bmp2, const pt2, const part) : Boolean [show]

Returns true if the cell in the specified bitmap has collided with a part of a bitmap.

Parameters:
bmp1 : Bitmap
cell : Longint
pt1 : Point2D
bmp2 : Bitmap
pt2 : Point2D
part : Rectangle
Returns:
Boolean :
Signatures by Language:
C/C++: bool cell_bitmap_part_collision_at_pt(bitmap bmp1, int32_t cell, const point2d *pt1, bitmap bmp2, const point2d *pt2, const rectangle *part);
C/C++: bool cell_bitmap_part_collision_at_pt_byval(bitmap bmp1, int32_t cell, const point2d pt1, bitmap bmp2, const point2d pt2, const rectangle part);
C++: bool cell_bitmap_collision(bitmap bmp1, int32_t cell, const point2d &pt1, bitmap bmp2, const point2d &pt2, const rectangle &part);
Pascal: function CellBitmapCollision(bmp1: Bitmap; cell: Longint; const pt1: Point2D; bmp2: Bitmap; const pt2: Point2D; const part: Rectangle): Boolean;
• Cell Bitmap Collision (bmp1, cell, x1, y1, bmp2, x2, y2) : Boolean [show]

Returns true if the cell in the specified bitmap has collided with a bitmap.

Parameters:
bmp1 : Bitmap
cell : Longint
x1 : Longint
y1 : Longint
bmp2 : Bitmap
x2 : Longint
y2 : Longint
Returns:
Boolean :
Signatures by Language:
C/C++: bool cell_bitmap_collision(bitmap bmp1, int32_t cell, int32_t x1, int32_t y1, bitmap bmp2, int32_t x2, int32_t y2);
Pascal: function CellBitmapCollision(bmp1: Bitmap; cell: Longint; x1: Longint; y1: Longint; bmp2: Bitmap; x2: Longint; y2: Longint): Boolean;
• Cell Bitmap Collision (bmp1, cell, x1, y1, bmp2, x2, y2, const part) : Boolean [show]

Returns true if the cell in the specified bitmap has collided with a part of a bitmap.

Parameters:
bmp1 : Bitmap
cell : Longint
x1 : Longint
y1 : Longint
bmp2 : Bitmap
x2 : Longint
y2 : Longint
part : Rectangle
Returns:
Boolean :
Signatures by Language:
C/C++: bool cell_bitmap_part_collision(bitmap bmp1, int32_t cell, int32_t x1, int32_t y1, bitmap bmp2, int32_t x2, int32_t y2, const rectangle *part);
C/C++: bool cell_bitmap_part_collision_byval(bitmap bmp1, int32_t cell, int32_t x1, int32_t y1, bitmap bmp2, int32_t x2, int32_t y2, const rectangle part);
C++: bool cell_bitmap_collision(bitmap bmp1, int32_t cell, int32_t x1, int32_t y1, bitmap bmp2, int32_t x2, int32_t y2, const rectangle &part);
Pascal: function CellBitmapCollision(bmp1: Bitmap; cell: Longint; x1: Longint; y1: Longint; bmp2: Bitmap; x2: Longint; y2: Longint; const part: Rectangle): Boolean;

### Cell Collision

Returns true if the cells within the two bitmaps have collided at the given points.

• Cell Collision (bmp1, cell1, const pt1, bmp2, cell2, const pt2) : Boolean [show]

Returns true if the cells within the two bitmaps have collided at the given points.

Parameters:
bmp1 : Bitmap
cell1 : Longint
pt1 : Point2D
bmp2 : Bitmap
cell2 : Longint
pt2 : Point2D
Returns:
Boolean :
Signatures by Language:
C/C++: bool cell_collision_at_pt(bitmap bmp1, int32_t cell1, const point2d *pt1, bitmap bmp2, int32_t cell2, const point2d *pt2);
C/C++: bool cell_collision_at_pt_byval(bitmap bmp1, int32_t cell1, const point2d pt1, bitmap bmp2, int32_t cell2, const point2d pt2);
C++: bool cell_collision(bitmap bmp1, int32_t cell1, const point2d &pt1, bitmap bmp2, int32_t cell2, const point2d &pt2);
Pascal: function CellCollision(bmp1: Bitmap; cell1: Longint; const pt1: Point2D; bmp2: Bitmap; cell2: Longint; const pt2: Point2D): Boolean;
• Cell Collision (bmp1, cell1, x1, y1, bmp2, cell2, x2, y2) : Boolean [show]

Returns true if the cells within the two bitmaps have collided at their specified x,y locations.

Parameters:
bmp1 : Bitmap
cell1 : Longint
x1 : Longint
y1 : Longint
bmp2 : Bitmap
cell2 : Longint
x2 : Longint
y2 : Longint
Returns:
Boolean :
Signatures by Language:
C/C++: bool cell_collision(bitmap bmp1, int32_t cell1, int32_t x1, int32_t y1, bitmap bmp2, int32_t cell2, int32_t x2, int32_t y2);
Pascal: function CellCollision(bmp1: Bitmap; cell1: Longint; x1: Longint; y1: Longint; bmp2: Bitmap; cell2: Longint; x2: Longint; y2: Longint): Boolean;

### Cell Rect Collision

Returns true if the cell of the bitmap has collided with a given rectangle.

• Cell Rect Collision (bmp, cell, const pt, const rect) : Boolean [show]

Returns true if the cell of the bitmap has collided with a given rectangle.

Parameters:
bmp : Bitmap
cell : Longint
pt : Point2D
rect : Rectangle
Returns:
Boolean :
Signatures by Language:
C/C++: bool cell_rect_collision_at_pt(bitmap bmp, int32_t cell, const point2d *pt, const rectangle *rect);
C/C++: bool cell_rect_collision_at_pt_byval(bitmap bmp, int32_t cell, const point2d pt, const rectangle rect);
C++: bool cell_rect_collision(bitmap bmp, int32_t cell, const point2d &pt, const rectangle &rect);
Pascal: function CellRectCollision(bmp: Bitmap; cell: Longint; const pt: Point2D; const rect: Rectangle): Boolean;
• Cell Rect Collision (bmp, cell, x, y, const rect) : Boolean [show]

Returns true if the cell of the bitmap has collided with a given rectangle.

Parameters:
bmp : Bitmap
cell : Longint
x : Longint
y : Longint
rect : Rectangle
Returns:
Boolean :
Signatures by Language:
C/C++: bool cell_rect_collision(bitmap bmp, int32_t cell, int32_t x, int32_t y, const rectangle *rect);
C/C++: bool cell_rect_collision_byval(bitmap bmp, int32_t cell, int32_t x, int32_t y, const rectangle rect);
C++: bool cell_rect_collision(bitmap bmp, int32_t cell, int32_t x, int32_t y, const rectangle &rect);
Pascal: function CellRectCollision(bmp: Bitmap; cell: Longint; x: Longint; y: Longint; const rect: Rectangle): Boolean;

### Circle Circle Collision

Returns True if the circles have collided.

• Circle Circle Collision (const c1, const c2) : Boolean [show]

Returns True if the circles have collided.

Parameters:
c1 : Circle
c2 : Circle
Returns:
Boolean :
Signatures by Language:
C/C++: bool circle_circle_collision(const circle *c1, const circle *c2);
C/C++: bool circle_circle_collision_byval(const circle c1, const circle c2);
C++: bool circle_circle_collision(const circle &c1, const circle &c2);
Pascal: function CircleCircleCollision(const c1: Circle; const c2: Circle): Boolean;

### Circle Line Collision

Returns True if the Sprite s, represented by a bounding circle, has collided with a line. The diameter for the bounding circle is based on the sprites width or height value -- whatever is largest.

• Circle Line Collision (s, const line) : Boolean [show]

Returns True if the Sprite s, represented by a bounding circle, has collided with a line. The diameter for the bounding circle is based on the sprites width or height value -- whatever is largest.

Parameters:
s : Sprite
line : LineSegment
Returns:
Boolean :
Signatures by Language:
C/C++: bool sprite_circle_line_collision(sprite s, const line_segment *line);
C/C++: bool sprite_circle_line_collision_byval(sprite s, const line_segment line);
C++: bool circle_line_collision(sprite s, const line_segment &line);
Pascal: function CircleLineCollision(s: Sprite; const line: LineSegment): Boolean;

### Circle Lines Collision

Returns True if the circle has collided with any of the lines from the rect rectangle.

• Circle Lines Collision (const c, const lines) : Boolean [show]

Returns True if the circle has collided with any of the lines from the rect rectangle.

Parameters:
c : Circle
lines : LinesArray
Returns:
Boolean :
Signatures by Language:
C/C++: bool circle_lines_collision(const circle *c, const lines_array lines, int32_t lines_len);
C/C++: bool circle_lines_collision_byval(const circle c, const lines_array lines, int32_t lines_len);
C++: bool circle_lines_collision(const circle &c, const lines_array lines, int32_t lines_len);
Pascal: function CircleLinesCollision(const c: Circle; const lines: LinesArray): Boolean;

### Circle Rect Collision

Returns True if the Circle collised with rectangle rect.

• Circle Rect Collision (const c, const rect) : Boolean [show]

Returns True if the Circle collised with rectangle rect.

Parameters:
c : Circle
rect : Rectangle
Returns:
Boolean :
Signatures by Language:
C/C++: bool circle_rect_collision(const circle *c, const rectangle *rect);
C/C++: bool circle_rect_collision_byval(const circle c, const rectangle rect);
C++: bool circle_rect_collision(const circle &c, const rectangle &rect);
Pascal: function CircleRectCollision(const c: Circle; const rect: Rectangle): Boolean;

### Circle Triangle Collision

Returns True if the Circle has collided with the Triangle tri.

• Circle Triangle Collision (const c, const tri) : Boolean [show]

Returns True if the Circle has collided with the Triangle tri.

Parameters:
c : Circle
tri : Triangle
Returns:
Boolean :
Signatures by Language:
C/C++: bool circle_triangle_collision(const circle *c, const triangle *tri);
C/C++: bool circle_triangle_collision_byval(const circle c, const triangle tri);
C++: bool circle_triangle_collision(const circle &c, const triangle &tri);
Pascal: function CircleTriangleCollision(const c: Circle; const tri: Triangle): Boolean;

### Collide Circle Circle

Perform a physical collidion with a sprite circle bouncing off a stationary circle.

• Collide Circle Circle (s, const c) [show]

Perform a physical collidion with a sprite circle bouncing off a stationary circle.

Parameters:
s : Sprite
c : Circle
Signatures by Language:
C/C++: void collide_circle_circle(sprite s, const circle *c);
C/C++: void collide_circle_circle_byval(sprite s, const circle c);
C++: void collide_circle_circle(sprite s, const circle &c);
Pascal: procedure CollideCircleCircle(s: Sprite; const c: Circle);

### Collide Circle Line

Perform a physical collision with a circle bouncing off a line.

• Collide Circle Line (s, const line) [show]

Perform a physical collision with a circle bouncing off a line.

Parameters:
s : Sprite
line : LineSegment
Signatures by Language:
C/C++: void collide_circle_line(sprite s, const line_segment *line);
C/C++: void collide_circle_line_byval(sprite s, const line_segment line);
C++: void collide_circle_line(sprite s, const line_segment &line);
Pascal: procedure CollideCircleLine(s: Sprite; const line: LineSegment);

### Collide Circle Lines

Perform a physical collision with a sprite as a circle bouncing off the closest line in the array of lines.

• Collide Circle Lines (s, const lines) [show]

Perform a physical collision with a sprite as a circle bouncing off the closest line in the array of lines.

Parameters:
s : Sprite
lines : LinesArray
Signatures by Language:
C/C++: void collide_circle_lines(sprite s, const lines_array lines, int32_t lines_len);
Pascal: procedure CollideCircleLines(s: Sprite; const lines: LinesArray);

### Collide Circle Rectangle

Perform a physical collision with a sprite as a circle bouncing off a stationary rectangle.

• Collide Circle Rectangle (s, const rect) [show]

Perform a physical collision with a sprite as a circle bouncing off a stationary rectangle.

Parameters:
s : Sprite
rect : Rectangle
Signatures by Language:
C/C++: void collide_circle_rectangle(sprite s, const rectangle *rect);
C/C++: void collide_circle_rectangle_byval(sprite s, const rectangle rect);
C++: void collide_circle_rectangle(sprite s, const rectangle &rect);
Pascal: procedure CollideCircleRectangle(s: Sprite; const rect: Rectangle);

### Collide Circles

Perform a physical collision between two circular sprites.

• Collide Circles (s1, s2) [show]

Perform a physical collision between two circular sprites.

Parameters:
s1 : Sprite
s2 : Sprite
Signatures by Language:
C/C++: void collide_circles(sprite s1, sprite s2);
Pascal: procedure CollideCircles(s1: Sprite; s2: Sprite);

### Rect Line Collision

Returns True if the bounding rectangle of the Sprite s has collided with the line specified.

• Rect Line Collision (s, const line) : Boolean [show]

Returns True if the bounding rectangle of the Sprite s has collided with the line specified.

Parameters:
s : Sprite
line : LineSegment
Returns:
Boolean :
Signatures by Language:
C/C++: bool sprite_rect_line_collision(sprite s, const line_segment *line);
C/C++: bool sprite_rect_line_collision_byval(sprite s, const line_segment line);
C++: bool rect_line_collision(sprite s, const line_segment &line);
Pascal: function RectLineCollision(s: Sprite; const line: LineSegment): Boolean;
• Rect Line Collision (const rect, const line) : Boolean [show]

Returns True if the rectangle rect provided has collided with the line.

Parameters:
rect : Rectangle
line : LineSegment
Returns:
Boolean :
Signatures by Language:
C/C++: bool rect_line_collision(const rectangle *rect, const line_segment *line);
C/C++: bool rect_line_collision_byval(const rectangle rect, const line_segment line);
C++: bool rect_line_collision(const rectangle &rect, const line_segment &line);
Pascal: function RectLineCollision(const rect: Rectangle; const line: LineSegment): Boolean;

### Side For Collision Test

Returns the side of that needs to be checked for collisions given the movement velocity.

• Side For Collision Test (const velocity) : CollisionSide [show]

Returns the side of that needs to be checked for collisions given the movement velocity.

Parameters:
velocity : Vector
Returns:
CollisionSide :
Signatures by Language:
C/C++: collision_side side_for_collision_test(const vector *velocity);
C/C++: collision_side side_for_collision_test_byval(const vector velocity);
C++: collision_side side_for_collision_test(const vector &velocity);
Pascal: function SideForCollisionTest(const velocity: Vector): CollisionSide;

### Sprite Bitmap Collision

Determines if the Sprite s has collided with the bitmap bmp using pixel level testing if required. The pt (Point2D) value specifies the world location of the bitmap.

• Sprite Bitmap Collision (s, bmp, const pt) : Boolean [show]

Determines if the Sprite s has collided with the bitmap bmp using pixel level testing if required. The pt (Point2D) value specifies the world location of the bitmap.

Parameters:
s : Sprite
bmp : Bitmap
pt : Point2D
Returns:
Boolean :
Signatures by Language:
C/C++: bool sprite_bitmap_at_point_collision(sprite s, bitmap bmp, const point2d *pt);
C/C++: bool sprite_bitmap_at_point_collision_byval(sprite s, bitmap bmp, const point2d pt);
C++: bool sprite_bitmap_collision(sprite s, bitmap bmp, const point2d &pt);
Pascal: function SpriteBitmapCollision(s: Sprite; bmp: Bitmap; const pt: Point2D): Boolean;
• Sprite Bitmap Collision (s, bmp, x, y) : Boolean [show]

Determines if the Sprite s has collided with the bitmap bmp using pixel level testing if required. The x and y values specify the world location of the bitmap.

Parameters:
s : Sprite
bmp : Bitmap
x : Single
y : Single
Returns:
Boolean :
Signatures by Language:
C/C++: bool sprite_bitmap_collision(sprite s, bitmap bmp, float x, float y);
Pascal: function SpriteBitmapCollision(s: Sprite; bmp: Bitmap; x: Single; y: Single): Boolean;

### Sprite Collision

Returns true if the specifed sprites (s1 and s2) have collided. Will use simple bounding box tests first, and low-level pixel tests if needed.

• Sprite Collision (s1, s2) : Boolean [show]

Returns true if the specifed sprites (s1 and s2) have collided. Will use simple bounding box tests first, and low-level pixel tests if needed.

Parameters:
s1 : Sprite
s2 : Sprite
Returns:
Boolean :
Signatures by Language:
C/C++: bool sprite_collision(sprite s1, sprite s2);
Pascal: function SpriteCollision(s1: Sprite; s2: Sprite): Boolean;

### Sprite Rect Collision

Returns true if the sprite has collided with a rectangle.

• Sprite Rect Collision (s, const r) : Boolean [show]

Returns true if the sprite has collided with a rectangle.

Parameters:
s : Sprite
r : Rectangle
Returns:
Boolean :
Signatures by Language:
C/C++: bool sprite_rectangle_collision(sprite s, const rectangle *r);
C/C++: bool sprite_rectangle_collision_byval(sprite s, const rectangle r);
C++: bool sprite_rect_collision(sprite s, const rectangle &r);
Pascal: function SpriteRectCollision(s: Sprite; const r: Rectangle): Boolean;
• Sprite Rect Collision (s, x, y, width, height) : Boolean [show]

Determined if a sprite has collided with a given rectangle. The rectangles coordinates are expressed in "world" coordinates.

Parameters:
s : Sprite
x : Single
y : Single
width : Longint
height : Longint
Returns:
Boolean :
Signatures by Language:
C/C++: bool sprite_rect_collision(sprite s, float x, float y, int32_t width, int32_t height);
Pascal: function SpriteRectCollision(s: Sprite; x: Single; y: Single; width: Longint; height: Longint): Boolean;

### Triangle Line Collision

Returns true if the triangle and the line have collided.

• Triangle Line Collision (const tri, const ln) : Boolean [show]

Returns true if the triangle and the line have collided.

Parameters:
tri : Triangle
ln : LineSegment
Returns:
Boolean :
Signatures by Language:
C/C++: bool triangle_line_collision(const triangle *tri, const line_segment *ln);
C/C++: bool triangle_line_collision_byval(const triangle tri, const line_segment ln);
C++: bool triangle_line_collision(const triangle &tri, const line_segment &ln);
Pascal: function TriangleLineCollision(const tri: Triangle; const ln: LineSegment): Boolean;