Pebble.Game.Collision

Small collision helpers for simple 2D watch games.

Shapes

Rect

type alias Rect =
    { x : Int
    , y : Int
    , w : Int
    , h : Int
    }

Axis-aligned rectangle bounds.

Circle

type alias Circle =
    { x : Int
    , y : Int
    , r : Int
    }

Circle bounds with integer center and radius.

Tests

rectRect

rectRect : Rect -> Rect -> Bool

Check whether two axis-aligned rectangles overlap.

pointInRect

pointInRect : { x : Int, y : Int } -> Rect -> Bool

Check whether a point is inside a rectangle.

circleCircle

circleCircle : Circle -> Circle -> Bool

Check whether two circles overlap.