import * as PIXI from 'pixi.js'; import { Hit } from './CollisionsUtils'; import { Vector2 } from './Vector2'; export interface IRectangle { height?: number; width?: number; x?: number; y?: number; } export declare class Rectangle extends PIXI.Rectangle { constructor(options?: IRectangle); constructor(x?: number, y?: number, width?: number, height?: number); /** * Returns a rectangle from the Window. */ static get WINDOW(): Rectangle; /** * Returns the center of this Rectangle on the X axis. * @returns - Half of the width. */ get halfX(): number; /** * Returns the center of this Rectangle on the Y axis. * @returns - Half of the height. */ get halfY(): number; /** * Returns a rectangle from your Application. * @param app - The Application * @returns - The resulting rectangle. */ static appRectangle(app: PIXI.Application): Rectangle; /** * Create a rectangle from a Sprite or a Container. * @param object - The object to create a Rectangle from. * @returns - The resulting Rectangle. */ static fromSprite(object: PIXI.Container | PIXI.Sprite | Required): Rectangle; /** * Create a rectangle from a set of 4 points. * @param x1 * @param y1 * @param x2 * @param y2 * @returns - The resulting rectangle. */ static fromCoords(x1: number, y1: number, x2: number, y2: number): Rectangle; /** * Create a rectangle from two sets of points. * @param point1 - First set of points, x1 & y1. * @param point2 - Second set of points, x2 & y2. * @returns - The resulting Rectangle. */ static fromPoints(point1: PIXI.IPointData, point2: PIXI.IPointData): Rectangle; /** * Test if this Rectangle has a collision with another Rectangle. * * @remarks Expensive function, use {@link Rectangle#collidesWith} to just see if they collide or not. * @param other - The other rectangle. * @returns The Hit result or null if not intersecting. */ collisionWith(other: Rectangle): Hit | null; /** * Test if this Rectangle collides with another Rectangle. * @param other - The other rectangle. * @returns - If the rectangles collides. */ collidesWith(other: Required): boolean; /** * Test if a segment intersect with this Rectangle. * @param position - Start of the segment. * @param delta - End of the segment. * @param paddingX - Padding X to add to this Rectangle. * @param paddingY - Padding Y to add to this Rectangle. * @returns - The Hit result or null if not intersecting. */ intersectSegment(position: Vector2, delta: Vector2, paddingX?: number, paddingY?: number): Hit | null; }