struct ECS::SimpleFilter

Overview

Stack allocated filter - can iterate over one component type.

Included Modules

Defined in:

myecs.cr

Constructors

Instance Method Summary

Instance methods inherited from module ECS::AbstractFilter

count_entities count_entities, each_entity(& : Entity -> ) each_entity, find_entity? find_entity?, satisfy(entity : Entity) : Bool satisfy

Constructor Detail

def self.new(world : ECS::World, typ : ::ECS::Component.class) #

Creates SimpleFilter. An easier way is to do world.query(typ)


[View source]

Instance Method Detail

def count_entities #

Returns number of entities that match the filter. (in fact - number of components #typ in a world)


[View source]
def each_entity(& : Entity -> ) #

iterates over all entities containing component #typ Note that for MultipleComponents same entity can be yielded multiple times, once for each component present on entity


[View source]
def satisfy(entity : Entity) : Bool #

returns true if entity satisfy filter (contain a component #typ)


[View source]
def typ : ComponentType #

type of components that this filter iterate


[View source]
def world : World #

world that owns this filtetr


[View source]