module CEnt:sig
..end
typeid =
Ent.id
typeentity =
Comp.entity
entity / component
conceptval new_entity : unit -> entity
val get_id : entity -> id
val get_id_opt : entity -> id option
get_id
but returns None instead of raising an exception
An entity may have as many components as needed, but only
one component of each type.
val has_component : entity -> Comp.component_type -> bool
val has_components : entity -> Comp.component_type list -> bool
(this function does not tell if the entity contains other components
or not)
val has_any_component : entity -> Comp.component_type list -> bool
val iter_components : entity -> (Comp.component_type -> Comp.component -> unit) -> unit
val get_components : entity -> Comp.component_type list
val cmp_components : entity -> Comp.component_type list -> int
val components_match : entity -> Comp.component_type list -> bool
Comp
,
which have been generated (from the type definition of component
)
with the gen_comp
command line tool.typeworld =
Comp.world
'delta
type parameter see the doc of the function world_step
and see world_step_fold
about the 'fld
type
val new_world : unit -> world
val add_entity : world -> entity -> world
val add_entities : world -> entity list -> world
val add_entity_id : world -> entity -> world * id
add_entity
but also return the id that was given to this entityval add_entities_id : world -> entity list -> world * id list
val add_entities_init : w:world -> n:int -> f:(int -> entity) -> world
val has_entity : world -> id -> bool
id
val replace_entity : world -> id -> entity -> world
val remove_entity : world -> entity -> world
val remove_entity_id : world -> id -> world
val get_entity : world -> id -> entity
val get_entity_opt : world -> id -> entity option
val get_entities : world -> id list -> entity list
val do_get_entities : world -> id list -> entity list
Not_found
if an id is not foundval get_entities_with_components : world -> Comp.component_type list -> entity list
val iter_entities : (entity -> unit) -> world -> unit
val fold_entities : (entity -> 'p -> 'p) -> world -> 'p -> 'p
val num_entities : world -> int
val num_entities_with_components : world -> Comp.component_type list -> int
typemapper =
Comp.component_type Ent.mapper
val add_mapper : world -> Comp.component_type list -> world * mapper
system
may update or remove entities, or create new ones, each time
world_step
is called.type'a
update ='a Ent.update
type'delta
system =(Comp.component_type, Comp.component, 'delta) Ent.system
type('delta, 'fld)
foldable_system =(Comp.component_type, Comp.component, 'delta, 'fld) Ent.foldable_system
system
but a foldable_system
has an additional folded
parameter that can be given with world_step_fold
type'fld
born_feedback_func =(Comp.component_type, Comp.component, 'fld) Ent.born_feedback_func
val world_step : world -> 'delta system -> mapper -> 'delta -> world
'delta
is the input parameter that is given to the systemsval world_step_fold : world ->
('delta, 'fld) foldable_system ->
mapper ->
?fb:'fld born_feedback_func -> 'delta -> 'fld -> world * 'fld
world_step
but with an additional folded parameter 'fld
,
see foldable_system
s