ECScalaDSL

trait ECScalaDSL extends ExtensionMethods with Conversions with FromSyntax

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
trait FromSyntax
class Object
trait Matchable
class Any

Type members

Inherited classlikes

class FromEntity[L <: CList](componentList: L)(using clt: CListTag[L])
Inherited from
FromSyntax
class FromWorld(left: Seq[Entity] | ClearWord)
Inherited from
FromSyntax
class ViewFromWorld[L <: CList](using clt: CListTag[L])
Inherited from
FromSyntax

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.

def getView[L <: CList](using clt: CListTag[L]): ViewFromWorld[L]

Keyword that enables the use of the word "getView" in the dsl.

Keyword that enables the use of the word "getView" in the dsl.

def remove(entities: Seq[Entity]): FromWorld

Keyword that enables the use of the word "remove" in the dsl.

Keyword that enables the use of the word "remove" in the dsl.

def remove[L <: CList](componentsList: L)(implicit evidence$1: CListTag[L]): FromEntity[L]

Keyword that enables the use of the word "remove" in the dsl.

Keyword that enables the use of the word "remove" in the dsl.

def system[L <: CList](system: (Entity, L, DeltaTime, World, View[L]) => Deletable[L])(using clt: CListTag[L])(using world: World): Unit

Keyword that enables the use of the word "system" in the dsl.

Keyword that enables the use of the word "system" in the dsl.

Inherited fields

final lazy val Conversion_Entity_Seq: Conversion[Entity, Seq[Entity]]

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

given componentToClist[C <: Component]: Conversion[C, C &: CNil]

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

extension (entity: Entity)
def +(component: C)(implicit evidence$2: ComponentTag[C]): Entity

This method enables the following syntax:

This method enables the following syntax:

entity + Component()
Inherited from
ExtensionMethods
def -(component: C)(implicit evidence$3: ComponentTag[C]): Entity

This method enables the following syntax:

This method enables the following syntax:

entity - Component()
Inherited from
ExtensionMethods
def withComponent(component: C)(implicit evidence$1: ComponentTag[C]): Entity

This method enables the following syntax:

This method enables the following syntax:

entity withComponent Component()
Inherited from
ExtensionMethods
def withComponents(componentList: L)(using clt: CListTag[L]): Entity

This method enables the following syntax:

This method enables the following syntax:

entity withComponents { Component1() &: Component2() }
Inherited from
ExtensionMethods
extension (world: World)
def -(entity: Entity): Unit

This method enables the following syntax:

This method enables the following syntax:

world - entity
Inherited from
ExtensionMethods
def hasA(init: World => Unit): Unit

This method enables the following syntax:

This method enables the following syntax:

world hasA system[Component &: CNil]{ () => {} }
Inherited from
ExtensionMethods
def hasAn(entityWord: EntityWord): Entity

This method enables the following syntax:

This method enables the following syntax:

world hasAn entity
Inherited from
ExtensionMethods