Skip to main content

Class: Space

Defined in: common/space/space.ts:7

Class to represent a 2D space with width, height, and center point.

Constructors

Constructor

new Space(width, height): Space

Defined in: common/space/space.ts:27

Creates an instance of Space.

Parameters

width

number

The width of the space.

height

number

The height of the space.

Returns

Space

Example

const space = new Space(800, 600);
console.log(space.width); // 800
console.log(space.height); // 600
console.log(space.center); // Vector2 { x: 400, y: 300 }

Properties

onSpaceChange

onSpaceChange: ForgeEvent

Defined in: common/space/space.ts:11

Event that is raised when the space changes.

Accessors

center

Get Signature

get center(): Vector2

Defined in: common/space/space.ts:40

Gets the center point of the space.

Returns

Vector2

The center point of the space.


height

Get Signature

get height(): number

Defined in: common/space/space.ts:56

Gets the height of the space.

Returns

number

The height of the space.


width

Get Signature

get width(): number

Defined in: common/space/space.ts:48

Gets the width of the space.

Returns

number

The width of the space.

Methods

setValue()

setValue(width, height): this

Defined in: common/space/space.ts:66

Sets the dimensions of the space.

Parameters

width

number

The new width of the space.

height

number

The new height of the space.

Returns

this

The updated Space instance.