ECScalaDSL
This trait provides a domain specific language (DSL) for expressing the ECScala framework operations using an english-like syntax. Here's the things you can do:
'''Create an entity in a world:'''
val world = World()
val entity1 = world hasAn entity
'''Remove entities from a world:'''
* world - entity1
* remove (entity1) from world
* remove (List(entity1, entity2, entity3)) from world
'''Create an entity in a world with a component:'''
val entity1 = world hasAn entity withComponent MyComponent()
'''Create an entity in a world with multiple components:'''
val entity1 = world hasAn entity withComponents {
MyComponent1() &: MyComponent2() &: MyComponent3()
}
'''Add components to an entity:'''
* entity1 + MyComponent()
* entity1 withComponent MyComponent()
* entity1 withComponents { MyComponent1() &: MyComponent2() }
'''Remove components from an entity:'''
* remove { MyComponent() } from entity1
* entity1 - MyComponent()
* remove { MyComponent1() &: MyComponent2() &: MyComponent3() } from entity1
'''Add a system to a world:'''
world hasA system[MyComponent &: CNil] { (_,_,_) => {}}
'''Get a view from a world:'''
val view = getView[MyComponent1 &: MyComponent2 &: CNil] from world
'''Remove all entities and their components from a world:'''
clearAll from world
Type members
Inherited classlikes
Value members
Concrete methods
Keyword that enables the use of the word "clearAll" in the dsl.
Keyword that enables the use of the word "clearAll" in the dsl.
Keyword that enables the use of the word "entity" in the dsl.
Keyword that enables the use of the word "entity" in the dsl.
Keyword that enables the use of the word "getView" in the dsl.
Keyword that enables the use of the word "getView" in the dsl.
Keyword that enables the use of the word "remove" in the dsl.
Keyword that enables the use of the word "remove" in the dsl.
Inherited fields
This conversion enable the removal of a single entity from the world with the following syntax:
This conversion enable the removal of a single entity from the world with the following syntax:
remove { entity1 } from world
- Inherited from
- Conversions
Givens
Inherited givens
This conversion enable the removal of a single component from an entity with the following syntax:
This conversion enable the removal of a single component from an entity with the following syntax:
remove { Component() } from entity1
- Inherited from
- Conversions
Extensions
Inherited extensions
This method enables the following syntax:
This method enables the following syntax:
entity + Component()
- Inherited from
- ExtensionMethods
This method enables the following syntax:
This method enables the following syntax:
entity - Component()
- Inherited from
- ExtensionMethods
This method enables the following syntax:
This method enables the following syntax:
entity withComponent Component()
- Inherited from
- ExtensionMethods
This method enables the following syntax:
This method enables the following syntax:
entity withComponents { Component1() &: Component2() }
- Inherited from
- ExtensionMethods
This method enables the following syntax:
This method enables the following syntax:
world - entity
- Inherited from
- ExtensionMethods
This method enables the following syntax:
This method enables the following syntax:
world hasA system[Component &: CNil]{ () => {} }
- Inherited from
- ExtensionMethods
This method enables the following syntax:
This method enables the following syntax:
world hasAn entity
- Inherited from
- ExtensionMethods