Rectangle Functions

class csdl2.SDL_Point(x: int =0, y: int =0)

A 2d point.

x

The x location of the point.

y

The y location of the point.

class csdl2.SDL_Rect(x: int =0, y: int =0, w: int =0, h: int =0)

A 2d rectangle with its origin at the upper left.

x

The x location of the rectangle’s upper left corner.

y

The y location of the rectangle’s upper left corner.

w

The width of the rectangle.

h

The height of the rectangle.

csdl2.SDL_HasIntersection(A: SDL_Rect, B: SDL_Rect) → bool

Determines if two rectangles intersect.

Parameters:
  • A (SDL_Rect or None) – First rectangle.
  • B (SDL_Rect or None) – Second rectangle.
Returns:

True if there is an intersection, False otherwise. If A and/or B are None, the function will return False.