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

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 each(& : Entity -> ) #

iterates over all entities containing component #typ Note that for Multiple 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 size #

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


[View source]
def typ : ComponentType #

type of components that this filter iterate


[View source]
def world : World #

world that owns this filtetr


[View source]