Class: PointerSystem
PointerSystem handles Pointer (mouse, touch etc.) input events, converting them into JamJar ECS messages.
Hierarchy
-
↳ PointerSystem
Table of contents
Constructors
Properties
Methods
Constructors
constructor
+ new PointerSystem(messageBus
: IMessageBus, inputElement
: HTMLElement, scene?
: IScene, entities?
: Map<number, SystemEntity>, subscriberID?
: number, isFullscreen?
: boolean, lockedPointerPosition?
: Vector, lastWheelEvent?
: WheelEvent, lastMoveEvent?
: PointerEvent, pointersToPublish?
: PointerEvent[], lastPublishedPointers?
: Pointer[]): PointerSystem
Parameters:
Name | Type | Default value |
---|---|---|
messageBus |
IMessageBus | - |
inputElement |
HTMLElement | - |
scene? |
IScene | - |
entities? |
Map<number, SystemEntity> | - |
subscriberID? |
number | - |
isFullscreen |
boolean | false |
lockedPointerPosition? |
Vector | - |
lastWheelEvent? |
WheelEvent | - |
lastMoveEvent? |
PointerEvent | - |
pointersToPublish |
PointerEvent[] | - |
lastPublishedPointers |
Pointer[] | - |
Returns: PointerSystem
Inherited from: MapSystem
Properties
entities
• Protected
entities: Map<number, SystemEntity>
A map of entities, mapped by their entity ID. ID: Entity 0: PlayerEntity 1: ObstacleEntity etc.
Inherited from: MapSystem.entities
messageBus
• Protected
messageBus: IMessageBus
Reference to the message bus, the fundamental piece of JamJar for communicating with other parts of the engine.
Inherited from: MapSystem.messageBus
scene
• Protected
Optional
scene: undefined | IScene
Any scene this system is part of, will change the lifecycle of the system to be part of the scene's lifecycle - it will be destroyed when the scene is destroyed.
Inherited from: MapSystem.scene
subscriberID
• subscriberID: number
Inherited from: MapSystem.subscriberID
MESSAGE_DEREGISTER
▪ Readonly
Static
MESSAGE_DEREGISTER: stateful_system_deregister= "stateful_system_deregister"
Message to deregister an entity + components with a system so it is no longer tracked.
Inherited from: MapSystem.MESSAGE_DEREGISTER
MESSAGE_REGISTER
▪ Readonly
Static
MESSAGE_REGISTER: stateful_system_register= "stateful_system_register"
Message to register an entity + components with a system so it can be tracked.
Inherited from: MapSystem.MESSAGE_REGISTER
MESSAGE_UPDATE
▪ Readonly
Static
MESSAGE_UPDATE: system_update= "system_update"
Inherited from: MapSystem.MESSAGE_UPDATE
Methods
Destroy
▸ Destroy(): void
Destroy destroys the System and unsubscribes it from all messages. The System should be garbage collected after this, unless a direct reference to it exists somewhere. Therefore direct references to systems are discouraged; communication should all be through the message bus.
Returns: void
Inherited from: MapSystem
OnDestroy
▸ Protected
OnDestroy(): void
Custom Destroy logic should go here to facilitate garbage collection, for example removing listeners.
Returns: void
Inherited from: MapSystem
OnMessage
▸ OnMessage(message
: IMessage): void
Parameters:
Name | Type |
---|---|
message |
IMessage |
Returns: void
Overrides: MapSystem
Update
▸ Update(): void
Returns: void
Overrides: MapSystem
moveEvent
▸ Protected
moveEvent(event
: PointerEvent): void
Parameters:
Name | Type |
---|---|
event |
PointerEvent |
Returns: void
pointerEvent
▸ Protected
pointerEvent(event
: PointerEvent): void
Parameters:
Name | Type |
---|---|
event |
PointerEvent |
Returns: void
register
▸ Protected
register(entity
: IEntity, components
: Component[]): void
Parameters:
Name | Type |
---|---|
entity |
IEntity |
components |
Component[] |
Returns: void
Inherited from: MapSystem
remove
▸ Protected
remove(entity
: IEntity): void
Parameters:
Name | Type |
---|---|
entity |
IEntity |
Returns: void
Inherited from: MapSystem
wheelEvent
▸ Protected
wheelEvent(event
: WheelEvent): void
When a Wheel Event occurs; used to store the last wheel event to be dispatched at the next update. This is to throttle this event which can be fired many times.
Parameters:
Name | Type | Description |
---|---|---|
event |
WheelEvent | Fired wheel event |
Returns: void