Class AppBase

事件派发管理

Hierarchy (view full)

Indexable

[key: string]: any

Constructors

Properties

_modules: ModuleBase[] = []
containerSize: {
    height: number;
    width: number;
} = ...

Type declaration

  • height: number
  • width: number
data: ShallowReactive<{
    camera?: Camera;
    container?: HTMLElement;
    domElement?: HTMLElement;
    scene?: Scene;
    [key: string]: any;
}> = ...

Type declaration

  • [key: string]: any
  • Optional camera?: Camera
  • Optional container?: HTMLElement
  • Optional domElement?: HTMLElement
  • Optional scene?: Scene
moduleManager: ModuleManager = ...
needRenderUpdate: boolean = true
tweenManager: TweenManager = ...

Accessors

  • get camera(): Camera
  • Returns Camera

  • set camera(value): void
  • Parameters

    • value: Camera

    Returns void

  • get container(): HTMLElement
  • Returns HTMLElement

  • set container(value): void
  • Parameters

    • value: HTMLElement

    Returns void

  • get destroyed(): boolean
  • Indicates whether the engine is destroyed.

    Returns boolean

  • get domElement(): HTMLElement
  • Returns HTMLElement

  • set domElement(value): void
  • Parameters

    • value: HTMLElement

    Returns void

  • get isPaused(): boolean
  • Whether the engine is paused.

    Returns boolean

  • get scene(): Scene
  • Returns Scene

  • set scene(value): void
  • Parameters

    • value: Scene

    Returns void

  • get targetFrameRate(): number
  • Set the target frame rate you want to achieve.

    Returns number

    Remarks

    It only takes effect when vSyncCount = 0 (ie, vertical synchronization is turned off). The larger the value, the higher the target frame rate, Number.POSITIVE_INFINITY represents the infinite target frame rate.

  • set targetFrameRate(value): void
  • Parameters

    • value: number

    Returns void

  • get time(): Time
  • The time information of the engine.

    Returns Time

  • get vSyncCount(): number
  • 在vSyncCount被设置为0时才能生效,而当其设置为大于0时,则不生效。 当vSyncCount为1时,游戏帧率会与设备的刷新帧率保持一致,例如一台设备刷新频率是60Hz则,此时其游戏帧率为60FPS 当vSyncCount为2时,游戏帧率会设置为刷新帧率的一半,例如一台设备刷新帧率是60Hz时,则游戏帧率为30FPS

    Returns number

    Remarks

    0 means that the vertical synchronization is turned off.

  • set vSyncCount(value): void
  • Parameters

    • value: number

    Returns void

Methods

  • 增加模块,等同于this.addModule(xxx)

    Type Parameters

    Parameters

    • type: (new (app?, obj?) => T)
        • new (app?, obj?): T
        • Parameters

          • Optional app: any
          • Optional obj: U

          Returns T

    • Optional params: U

    Returns T

  • 增加模块,等同于this.add(xxx)

    Type Parameters

    Parameters

    • type: (new (app?, obj?) => T)
        • new (app?, obj?): T
        • Parameters

          • Optional app: any
          • Optional obj: U

          Returns T

    • Optional params: U

    Returns T

  • Parameters

    • methodName: string
    • Rest ...args: any

    Returns void

  • Destroy engine.

    Returns void

    Remarks

    If call during frame execution will delay until the end of the frame

  • 触发指定事件名称.

    Parameters

    • event: string

      Event name

    • Rest ...data: any

      Data

    Returns boolean

    • Whether the dispatching is successful
  • 返回注册的所有事件名.

    Returns string[]

    所有事件名

  • Type Parameters

    Parameters

    • type: (new (app?, obj?) => T)
        • new (app?, obj?): T
        • Parameters

          • Optional app: any
          • Optional obj: U

          Returns T

    Returns T

  • 确定是否存在事件侦听

    Parameters

    • event: string

      事件名

    Returns boolean

    返回是否存在相应的事件

  • 返回具有指定事件名称的侦听总数.

    Parameters

    • event: string

      Event name

    Returns number

    The count of listeners

  • 下帧回调

    Parameters

    • callback: ((app) => void)
        • (app): void
        • Parameters

          Returns void

    Returns void

  • Pause the engine.

    Returns void

  • 通过事件名移除所有监听.

    Parameters

    • Optional event: string

      Event name, delete all events if not passed

    Returns void

  • Returns void

  • Type Parameters

    Parameters

    • type: (new (app?, obj?) => T)
        • new (app?, obj?): T
        • Parameters

          • Optional app: any
          • Optional obj: U

          Returns T

    Returns void

  • Resume the engine.

    Returns void

  • Execution engine loop.

    Returns void

  • Update the engine loop manually. If you call engine.run(), you generally don't need to call this function.

    Returns void