ecs v0.0.2 ECS.Routine behaviour

Functions to setup and control routines.

A routine iterates over entities with certain components, and performs an action with them.

Examples

# Define a routine to display entities' names.
defmodule Routine.DisplayNames do
  # Accepts entities with a name component.
  def accepts?(entity) do
    ECS.Entity.has?(:name)
  end

  # Displays the entity's name
  def perform(entity) do
    IO.puts ECS.Entity.get(entity, :name)
  end
end

Summary

Functions

Run routines over entities

Functions

run(entities, list)

Run routines over entities.

Callbacks

accepts?(pid)

Specs

accepts?(pid) :: Bool
perform(pid)

Specs

perform(pid) :: any