fledge_ecs 0.2.0 copy "fledge_ecs: ^0.2.0" to clipboard
fledge_ecs: ^0.2.0 copied to clipboard

A Bevy-inspired Entity Component System (ECS) for Dart and Flutter game development.

fledge_ecs #

A Bevy-inspired Entity Component System (ECS) for Dart and Flutter game development.

pub package

Installation #

dependencies:
  fledge_ecs: ^0.2.0

Quick Start #

import 'package:fledge_ecs/fledge_ecs.dart';

class Position {
  double x, y;
  Position(this.x, this.y);
}

class Velocity {
  double x, y;
  Velocity(this.x, this.y);
}

class MovementSystem extends System {
  @override
  SystemMeta get meta => SystemMeta(
    name: 'movement',
    reads: {ComponentId.of<Velocity>()},
    writes: {ComponentId.of<Position>()},
    resourceReads: {WallTime},
  );

  @override
  Future<void> run(World world) async {
    final time = world.getResource<WallTime>()!;
    for (final (_, pos, vel) in world.query2<Position, Velocity>().iter()) {
      pos.x += vel.x * time.delta;
      pos.y += vel.y * time.delta;
    }
  }
}

void main() async {
  final app = App()
    ..addPlugin(WallTimePlugin())
    ..addSystem(MovementSystem());

  app.world.spawn()
    ..insert(Position(0, 0))
    ..insert(Velocity(10, 5));

  await app.run();
}

Documentation #

See the Fledge documentation site for guides, API reference, and advanced usage.

License #

Apache 2.0 - See LICENSE for details.

0
likes
160
points
71
downloads

Documentation

API reference

Publisher

verified publisherfledge-framework.dev

Weekly Downloads

A Bevy-inspired Entity Component System (ECS) for Dart and Flutter game development.

Homepage
Repository (GitHub)
View/report issues
Contributing

Topics

#ecs #game-engine #game-development #entity-component-system #flutter-games

License

Apache-2.0 (license)

Dependencies

fledge_ecs_annotations, meta

More

Packages that depend on fledge_ecs