Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eccy

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eccy

Yet Another ECS Library

  • 0.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Eccy

npm

Yet Another ECS Library

Status

Very experimental, early development. You probably shouldn't use this for any real stuff just yet.

How to use

1. Define a component

A component can be any class.

// Define a component
@component()
class Position {
  public constructor(
    public x: number,
    public y: number,
  ) {}
}
2. Define some systems
class RenderSystem extends System {
  // Create your queries
  private positions = Query.entities()
    .select(Position)
    .query();

  public override run() {
    // Iterate over the query results
    for (let [position] of this.positions) {
      position.x++;
    }
  }
}

@system({ runOnce: true })
class StartupSystem extends System {
  public override run(cmd: Commands) {
    // Spawn a new entity with a component
    cmd.spawn(new Position(10, 12));
  }
}
3. Configure the engine
let engine = new Engine()
  .system(StartupSystem, RenderSystem)
  .finalise();
4. Ready, set, go!
await engine.run(60); // Try to run at 60 fps

Keywords

FAQs

Package last updated on 02 Sep 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc