clecs.component

component

macro

(component name params)

Create a component definition.

Parameters:

cname
A keyword to be used to refer to this component later.
cdef
A map of component parameter names to their types.

Examples:

;; A marker component.
(component Renderable nil)

;; Components can have any number of parameters.
(component HitPoints {hp Integer})
(component Point {x Int y Integer})
(component Player {name String
                   team Integer
                   alive Boolean})

See also clecs.world/world.

validate

(validate c cdata)

Validate component data against a component definition.

Throws RuntimeException if validation fails.

Parameters:

c
Component definition to validate against.
cdata
A map containing component data.

validate-param

multimethod

Validates a parameter.

Parameters:

parameter-type
Parameter type to validate against.
parameter-value
Parameter value to validate.