Top Level Namespace

Defined in:

Macro Summary

Macro Detail

macro accept_event(name) #

Will generate event hook stubs for accepting the provided event. Will create {{name.id.underscore.id}}_event_hooks array and {{name.id.underscore.id}}(&block) method which will append the block to the event hooks array.

The clear_{{name.id.underscore.id}}_event_hooks method will clear all the hooks on the object

class Test
  accept_event OnEntityCreated

  def initialize
    on_entity_created_event_hooks.size # => 0

    on_entity_created do |event|
      # do something with event
    end

    on_entity_created_event_hooks.size # => 1

    clear_on_entity_created_event_hooks

    on_entity_created_event_hooks.size # => 0
  end
end

obj = Test.new
obj.on_entity_created(event) # => does something with event

[View source]
macro accept_events(*names) #

Wrapper for multiple accept_event calls


[View source]
macro call_post_constructors #

[View source]
macro component_event(contexts, comp, target, _type = EventType::Added, priority = 1) #

[View source]
macro component_event_system(context, comp, target, _type = EventType::Added, priority = 1) #

[View source]
macro create_controller(name, features) #

[View source]
macro create_feature(name, systems) #

[View source]
macro emit_event(event, *args) #

[View source]
macro emits_event(name) #

Will generate event hook stubs for the provided event. Will create {{name.id.underscore.id}}_event_cache getter/setter as well as {{name.id.underscore.id}}(event) method.

class Test
  emits_event OnEntityCreated

  # override event methods
  def on_entity_created(event : Entitas::Events::OnEntityCreated)
    # do something with event
  end
end

obj = Test.new
obj.on_entity_created(event) # => does something with event

[View source]
macro emits_events(*names) #

Will generate event hook stubs for the provided events

class Test
  emits_events OnEntityCreated, OnEntityDestroyed

  # override event methods
  def on_entity_created(event : Entitas::Events::OnEntityCreated)
    # do something with event
  end
end

obj = Test.new
obj.on_entity_created(event)   # => does something with event
obj.on_entity_destroyed(event) # => raises Entitas::Error::MethodNotImplemented

[View source]
macro generate_event_systems #

Process EventSystem annotations :nodoc:


[View source]
macro prop(var, kype, **kwargs) #

Will create getter/setter for the provided var, ensuring its type


[View source]
macro property_alias(var, kype, **kwargs) #

[View source]