Skip to content

factories overview


Table of contents


utils

DisplayObject2dOpts (type alias)

Signature

export type DisplayObject2dOpts<Tex> = {
  color?: number
  texture?: Tex
}

IDisplayObject2dComponentFactory (class)

Signature

export declare class IDisplayObject2dComponentFactory<TypeDoc>

createPrimitive (method)

Signature

abstract createPrimitive(
    descriptor: Shape2DDescriptor,
    material?: DisplayObject2dOpts<TypeDoc['texture']>,
  ): TypeDoc['displayObject'];

randomColor (method)

Signature

randomColor(): number

createSquare (method)

Signature

createSquare(dimensions: Point2, material: DisplayObject2dOpts<TypeDoc['texture']> = {}): TypeDoc['displayObject']

createCircle (method)

Signature

createCircle(radius: number, material: DisplayObject2dOpts<TypeDoc['texture']> = {}): TypeDoc['displayObject']

IPhysicsBody2dComponentFactory (interface)

Signature

export interface IPhysicsBody2dComponentFactory<TypeDoc extends PhysicsTypeDocRepo2D = PhysicsTypeDocRepo2D> {
  createRigidBody(
    descriptor: BodyShape2DDescriptor,
    transform?: {
      position?: Point2
      rotation?: number
    }
  ): TypeDoc['rigidBody']

  createTrigger(
    descriptor: Shape2DDescriptor,
    transform?: {
      position?: Point2
      rotation?: number
    }
  ): TypeDoc['trigger']
}