@vaguevoid/fiasco / ecs/module / EcsModule
Class: EcsModule
Defined in: src/ecs/module.ts:52
An equivalent to the Game
object, but without support for any codegen.
Extended by
Implements
EcsModule
Constructors
Constructor
new EcsModule(
options
):EcsModule
Defined in: src/ecs/module.ts:66
Parameters
options
EcsModuleOptions
= {}
Returns
EcsModule
Properties
afterSystem
afterSystem:
Signal
<[number
]>
Defined in: src/ecs/module.ts:64
beforeSystem
beforeSystem:
Signal
<[number
]>
Defined in: src/ecs/module.ts:63
componentKeys
protected
componentKeys:string
[]
Defined in: src/ecs/module.ts:56
components
protected
components:Record
<string
>
Defined in: src/ecs/module.ts:57
name
protected
name:string
="JS_ECS_Module"
Defined in: src/ecs/module.ts:61
onComponentIdSet
protected
onComponentIdSet:undefined
| (stringId
,componentId
) =>void
Defined in: src/ecs/module.ts:59
onEngineSet
protected
onEngineSet:undefined
| (engine
) =>void
Defined in: src/ecs/module.ts:58
resourceIds
protected
resourceIds:Set
<string
>
Defined in: src/ecs/module.ts:55
systemDefinitions
protected
systemDefinitions:SystemDef
[]
Defined in: src/ecs/module.ts:53
systemFunctions
protected
systemFunctions:SystemFunc
[]
Defined in: src/ecs/module.ts:54
voidTargetVersionOverride
protected
voidTargetVersionOverride:undefined
|number
Defined in: src/ecs/module.ts:60
Methods
componentAlign()
componentAlign(
stringId
):number
Defined in: src/ecs/module.ts:176
Returns the component alignment in bytes, for each component returned by componentStringId
. Called for both components and resources.
Parameters
stringId
string
Returns
number
Implementation of
IEcsModule.componentAlign
componentDeserializeJson()
componentDeserializeJson(
stringId
,ptr
,json
):number
Defined in: src/ecs/module.ts:103
When deserializing scene json, the engine will pass a pointer for the module to deserialize the component from the jsonString parameter
Parameters
stringId
string
ptr
[___brand]
typeof FiascoPointerBrand
json
string
Returns
number
Implementation of
IEcsModule.componentDeserializeJson
componentSize()
componentSize(
stringId
):number
Defined in: src/ecs/module.ts:170
Returns the component size in bytes, for each component returned by componentStringId
. Called for both components and resources.
Parameters
stringId
string
Returns
number
Implementation of
IEcsModule.componentSize
componentStringId()
componentStringId(
index
):undefined
|string
Defined in: src/ecs/module.ts:151
Called infinitly until undefined
is returned. For every index provided, return an associated string id.
Parameters
index
number
The component index
Returns
undefined
| string
Implementation of
IEcsModule.componentStringId
componentType()
componentType(
stringId
):EcsType
Defined in: src/ecs/module.ts:181
Returns the EcsType
for this string id, for each component returned by componentStringId
.
Parameters
stringId
string
Returns
EcsType
Implementation of
IEcsModule.componentType
deinit()
deinit():
void
Defined in: src/ecs/module.ts:98
Called once right before this module is unloaded
Returns
void
Implementation of
IEcsModule.deinit
init()
init():
void
Defined in: src/ecs/module.ts:96
Called once during module startup.
Returns
void
Implementation of
IEcsModule.init
moduleName()
moduleName():
string
Defined in: src/ecs/module.ts:92
The name of this ecs module.
Returns
string
Implementation of
IEcsModule.moduleName
resourceDeserialize()
resourceDeserialize(
stringId
,_ptr
,serialized
):number
Defined in: src/ecs/module.ts:127
When restoring a state snapshot, for each resource which this module defines, the engine will pass a pointer to the resource for the module to deserialize the resource state into, from a previously serialized buffer.
The binary buffer will typically be a JSON representation of the resource.
Parameters
stringId
string
_ptr
[___brand]
typeof FiascoPointerBrand
serialized
ArrayBuffer
Returns
number
Implementation of
IEcsModule.resourceDeserialize
resourceInit()
resourceInit(
stringId
,ptr
):number
Defined in: src/ecs/module.ts:163
For each resource which this module defines, the engine will allocate the requested size and pass a pointer to that memory, for the module to initialize the resource at startup.
Parameters
stringId
string
ptr
[___brand]
typeof FiascoPointerBrand
Returns
number
Implementation of
IEcsModule.resourceInit
resourceSerialize()
resourceSerialize(
stringId
,_ptr
):ArrayBuffer
Defined in: src/ecs/module.ts:133
When taking a state snapshot, for each resource which this module defines, the engine will pass a pointer to the resource for the module to serialize the resource state from, into a binary buffer.
The binary buffer will typically be a JSON representation of the resource, but not limited to that.
Parameters
stringId
string
_ptr
[___brand]
typeof FiascoPointerBrand
Returns
ArrayBuffer
Implementation of
IEcsModule.resourceSerialize
setComponentId()
setComponentId(
stringId
,componentId
):void
Defined in: src/ecs/module.ts:156
Tells the module which numerical component id has been assigned to each component.
Parameters
stringId
string
componentId
number
Returns
void
Implementation of
IEcsModule.setComponentId
setEngine()
setEngine(
engine
):void
Defined in: src/ecs/module.ts:139
Called with the internal engine instance.
Parameters
engine
Engine
Returns
void
Implementation of
IEcsModule.setEngine
systemArgComponent()
systemArgComponent(
systemIndex
,argIndex
):string
Defined in: src/ecs/module.ts:225
Returns the resource string id for any resource system inputs.
Parameters
systemIndex
number
argIndex
number
Returns
string
Implementation of
IEcsModule.systemArgComponent
systemArgEvent()
systemArgEvent(
systemIndex
,argIndex
):string
Defined in: src/ecs/module.ts:251
Returns the event string id for any ArgType.EventReader
/ArgType.EventWriter
system inputs.
Parameters
systemIndex
number
argIndex
number
Returns
string
Implementation of
IEcsModule.systemArgEvent
systemArgsLen()
systemArgsLen(
systemIndex
):number
Defined in: src/ecs/module.ts:215
Returns the number of inputs for each system.
Parameters
systemIndex
number
Returns
number
Implementation of
IEcsModule.systemArgsLen
systemArgType()
systemArgType(
systemIndex
,argIndex
):number
Defined in: src/ecs/module.ts:220
Returns the type of input of a given system argument.
Parameters
systemIndex
number
argIndex
number
Returns
number
Implementation of
IEcsModule.systemArgType
systemFunction()
systemFunction(
systemIndex
): (ptr
) =>number
Defined in: src/ecs/module.ts:205
Returns the function for each system.
System functions take a ptr
parameter, which is a double pointer to system inputs. System functions return zero on success, non-zero on error.
Parameters
systemIndex
number
Returns
(
ptr
):number
Parameters
ptr
[___brand]
typeof FiascoPointerBrand
Returns
number
Implementation of
IEcsModule.systemFunction
systemIsOnce()
systemIsOnce(
systemIndex
):boolean
Defined in: src/ecs/module.ts:197
Returns whether a system is a "once" system, i.e. it runs only once at startup. Most systems are not, and should run once per frame.
Parameters
systemIndex
number
Returns
boolean
Implementation of
IEcsModule.systemIsOnce
systemName()
systemName(
systemIndex
):string
Defined in: src/ecs/module.ts:191
Returns the name of a system.
Parameters
systemIndex
number
Returns
string
Implementation of
IEcsModule.systemName
systemQueryArgComponent()
systemQueryArgComponent(
systemIndex
,argIndex
,queryArgIndex
):string
Defined in: src/ecs/module.ts:246
Returns the component string id each Query
input.
Parameters
systemIndex
number
argIndex
number
queryArgIndex
number
Returns
string
Implementation of
IEcsModule.systemQueryArgComponent
systemQueryArgsLen()
systemQueryArgsLen(
systemIndex
,argIndex
):number
Defined in: src/ecs/module.ts:230
Returns the number of inputs to each Query
.
Parameters
systemIndex
number
argIndex
number
Returns
number
Implementation of
IEcsModule.systemQueryArgsLen
systemQueryArgType()
systemQueryArgType(
systemIndex
,argIndex
,queryArgIndex
):number
Defined in: src/ecs/module.ts:235
Returns the type of input for each Query
input.
Parameters
systemIndex
number
argIndex
number
queryArgIndex
number
Returns
number
Implementation of
IEcsModule.systemQueryArgType
systemsLen()
systemsLen():
number
Defined in: src/ecs/module.ts:186
Returns the number of systems in this module.
Returns
number
Implementation of
IEcsModule.systemsLen
voidTargetVersion()
voidTargetVersion():
number
Defined in: src/ecs/module.ts:88
The version of the engine that this module is compatible with.
Returns
number
Implementation of
IEcsModule.voidTargetVersion