import { System, ComponentChanged, Component } from '@combos-fun/engine'; import Matter$1 from 'matter-js'; type DeepPartial = { [P in keyof T]?: T[P] extends Object ? DeepPartial : T[P]; }; interface PhysicsSystemParams { resolution?: number; fps?: number; isTest?: boolean; element?: HTMLElement; canvas?: HTMLCanvasElement; deltaSampleSize?: number; mouse?: { open: boolean; constraint?: Matter.Constraint; }; world: DeepPartial; } declare class PhysicsSystem extends System { static systemName: string; private engine; /** * System init: configure params before the game starts. * @param param init params */ init(param?: PhysicsSystemParams): void; /** * Called when the System is installed; if the game has not started, it runs when the * game starts. Use it for setup work such as initializing data. */ awake(): void; /** * Called after the System is installed and all systems' `awake` have run. */ start(): void; /** * Called on every game loop; can perform operations and change component properties. */ update(e: any): void; componentChanged(changed: ComponentChanged): void; /** * Like `update`, but called after every System's and component's `update` has run. */ lateUpdate(): void; /** * Called when the game starts or resumes playing after a pause. */ onResume(): void; /** * Called when the game is paused. */ onPause(): void; /** * Called when the system is destroyed. */ onDestroy(): void; } declare enum PhysicsType { RECTANGLE = "rectangle", CIRCLE = "circle", POLYGON = "polygon", TRAPEZOID = "trapezoid", FROM_VERTICES = "fromVertices", CAPSULE = "capsule", COMPOUND = "compound", EDGE = "edge", CHAIN = "chain" } interface PhysicsVertex { x: number; y: number; } interface PhysicsBodyOptions { isStatic?: boolean; restitution?: number; density?: number; [propName: string]: any; } /** One piece of a `COMPOUND` body. Nested `COMPOUND` is not allowed. */ interface PhysicsPartParams { type: PhysicsType; bodyOptions?: PhysicsBodyOptions; position?: { x?: number; y?: number; }; sides?: number; radius?: number; width?: number; height?: number; slope?: number; vertices?: PhysicsVertex[]; vertexSets?: PhysicsVertex[][]; length?: number; from?: PhysicsVertex; to?: PhysicsVertex; thickness?: number; } interface PhysicsParams { type?: PhysicsType; bodyOptions?: PhysicsBodyOptions; position?: { x?: number; y?: number; }; sides?: number; radius?: number; stopRotation?: boolean; width?: number; height?: number; slope?: number; vertices?: PhysicsVertex[]; vertexSets?: PhysicsVertex[][]; length?: number; from?: PhysicsVertex; to?: PhysicsVertex; thickness?: number; parts?: PhysicsPartParams[]; } declare class Physics extends Component { static componentName: string; bodyParams: PhysicsParams; body: Matter$1.Body; private PhysicsEngine; init(params: PhysicsParams): void; update(): void; onDestroy(): void; } export { Physics, PhysicsSystem, PhysicsType }; export type { PhysicsBodyOptions, PhysicsParams, PhysicsPartParams, PhysicsSystemParams, PhysicsVertex };