MainWindow

View source

Marks the entity that represents the primary window.

MainWindow is an empty component marker. With the default WindowPlugin configuration, the primary-window entity contains both Window and MainWindow. The primaryWindowOptions passed to the plugin configure that entity’s Window component; MainWindow has no dimensions, canvas reference, or other state of its own.

Query this marker with the entity handle to find the primary-window entity. A query such as [EntityHandle, Window, MainWindow] provides the handle for looking up the canvas in the Windows resource and the associated Window component. If initPrimaryWindow is false, WindowPlugin does not create this entity; callers can create their own entity with new MainWindow() or use createMainWindow for the default [Window, MainWindow] pair.

Examples

import { EntityHandle, Query } from '@wimaengine/ecs'
import { MainWindow } from '@wimaengine/window'

const match = new Query(world, [EntityHandle, MainWindow]).single()
const primaryEntity = match?.[0]

if (primaryEntity) {
  console.log('primary window entity', primaryEntity)
}

Constructor


constructor()

Methods


staticcopy(source: MainWindow, target?: MainWindow): MainWindow

View source

Copies an empty marker into the target component.

MainWindow has no fields, so source is not read. When target is omitted, a new marker is returned; otherwise the same target is returned unchanged.

Parameters

NameDescriptionDefault
source

Marker to copy.

—
target?

Component to return.

...

Returns

The target marker.

staticclone(target: MainWindow): MainWindow

View source

Creates a new empty marker.

This delegates to MainWindow.copy without a target, so the result is a new MainWindow instance.

Parameters

NameDescriptionDefault
target

Marker to clone.

—

Returns

A new empty marker.

staticserialize(_value: MainWindow): object

View source

Serializes the marker as an empty object.

There is no marker state to persist.

Parameters

NameDescriptionDefault
_value

Marker to serialize.

—

Returns

The marker’s empty serialized representation.

staticdeserialize(_value: unknown, out?: MainWindow): MainWindow

View source

Deserializes the marker without reading serialized data.

Since the serialized representation is empty, this returns the supplied output marker or creates a new one when out is omitted.

Parameters

NameDescriptionDefault
_value

Empty serialized marker data.

—
out?

Component to return.

...

Returns

The output marker.