API Docs for:
Show:

ComponentMapper Class

High performance component retrieval from entities. Use this wherever you need to retrieve components from entities often and fast.

Item Index

Methods

Methods

get

(
  • entity
)
ArtemiJS.Component

Fast but unsafe retrieval of a component for this entity. No bounding checks, so this could return null, however in most scenarios you already know the entity possesses this component.

Parameters:

  • entity ArtemiJS.Entity

Returns:

ArtemiJS.Component: |null

getFor

(
  • type
  • the
)
ArtemiJS.ComponentMapper static

Returns a component mapper for this type of components.

Parameters:

  • type Object

    the type of components this mapper uses

  • the ArtemiJS.World

    world that this component mapper should use

Returns:

ArtemiJS.ComponentMapper:

getSafe

(
  • entity
)
ArtemiJS.Component

Fast and safe retrieval of a component for this entity. If the entity does not have this component then null is returned.

Parameters:

  • entity ArtemiJS.Entity

Returns:

ArtemiJS.Component: |null

has

(
  • entity
)

Checks if the entity has this type of component.

Parameters:

  • entity ArtemiJS.Entity

Returns:

boolean true if the entity has this component type, false if it doesn't.

Properties

type Type of component

ArtemiJS.ComponentType private