ECS::World
Inherits Reference / Object
Root level container for all entities / components, is iterated with ECS::Systems
Constructors
new(ctx : YAML::ParseContext, node : YAML::Nodes::Node)
SourceClass methods
from_yaml
SourceInstance methods
add_yaml(io_or_string)
Sourceadd_yaml
Sourcedecode(io)
Sourceencode(io)
Sourceinspect(io)
Sourcenew_entity
Creates new entity in a world context. Basically doesn't cost anything as it just increase entities counter. Entity don't take up space without components.
new_filter
Creates new Filter.
This call can be skipped:
Instead of world.new_filter.of(Comp1) you can do world.of(Comp1)
stats
Non-allocating version of stats. Yields component names and count of corresponding components
world = init_benchmark_world(1000000)
world.stats do |comp_name, value|
puts "#{comp_name}: #{value}"
end
stats
Returns Hash containing count of components
world = init_benchmark_world(1000000)
puts world.stats # prints {"Comp1" => 500000, "Comp2" => 333334, "Comp3" => 200000, "Comp4" => 142858, "Config" => 1}
to_yaml(yaml : YAML::Nodes::Builder) : Nil
Source