nicolasfara / ecscala   1.0.0

MIT License GitHub

An ECS Scala framework

Scala versions: 3.x

ECScala

An Entity Component System Scala framework

License: MIT Maven Central GitHub release example workflow codecov javadoc

Getting Started

libraryDependencies += "dev.atedeg" %% "ecscala" % "0.2.1"

Usage

ECScala allows you to use the ECS architechtural pattern with ease:

import dev.atedeg.ecscala.given

case class Position(x: Float, y: Float) extends Component
case class Velocity(vx: Float, vy: Float) extends Component

object Example extends ECScalaDSL {
  val world = World()
  world hasAn entity withComponents { Position(1, 1) &: Velocity(2, 2) }
  val movementSystem = System[Position &: Velocity &: CNil]
    .withUpdate { (_, components, deltaTime) =>
      val Position(x, y) &: Velocity(vx, vy) &: CNil = components
      Position(x + vx*deltaTime, y + vy*deltaTime) &: Velocity(vx, vy) &: CNil
    }
  world hasA system(movementSystem)
  world.update(10)
}

To learn how to use ECScala you can start by reading its wiki!

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Authors

License

Distributed under the MIT license. See LICESE for more information.