Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

pub version

fast ecs

simple and fast entity-component-system (ecs) library written in dart.

cpu flame chart

  • device nexus 5 (2014) android 6.0.1
  • fast_ecs version 0.0.0
  • all time 10500(ms)
  • 1024 entities

all
rotationsystem

void update(double deltatime, setentity entities) {
    for (var i = 0; i < entities.size; i++) {
      entity entity = entities[i];
      transformcomponent transform = transformcomponents[entity] as transformcomponent;
      velocitycomponent rotation = velocitycomponents[entity] as velocitycomponent;
      transform.rotation += rotation.velocity * deltatime;
      transform.dirty = true;
    }
  }

update rotationsystem

spritesystem

void updatesprite(transformcomponent transform, spritecomponent sprite) {
    var textureregion = sprite.textureregion;
    if (transform.dirty && textureregion != null) {
      var scos = cos(transform.rotation) * transform.scale;
      var ssin = sin(transform.rotation) * transform.scale;
      var tx = -scos * textureregion.anchorx + ssin * textureregion.anchory;
      var ty = -ssin * textureregion.anchorx - scos * textureregion.anchory;
      sprite.transformdata.set(scos, ssin, tx, ty);
      transform.dirty = false;
    }
  }

updatesprite

history of creation

the source of inspiration was the resource a simple entity component system (ecs) [c++]


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

Comments are closed.