fledge_ecs_generator

Code generator for the Fledge ECS framework. Generates component registration and system wrappers from annotations.

pub package

Installation

dev_dependencies:
  fledge_ecs_generator: ^0.2.1
  build_runner: ^2.4.0

dependencies:
  fledge_ecs: ^0.2.1
  fledge_ecs_annotations: ^0.2.1

Quick Start

import 'package:fledge_ecs_annotations/fledge_ecs_annotations.dart';

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

@system
void moveEntities(Query<(Position, Velocity)> query, Res<WallTime> time) {
  for (final (pos, vel) in query.iter()) {
    pos.x += vel.x * time.value.delta;
    pos.y += vel.y * time.value.delta;
  }
}

Run the generator:

dart run build_runner build

Then import the generated code:

import 'my_game.g.dart';

void main() {
  final app = App()..addPlugin(GeneratedPlugin());
}

Documentation

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

License

Apache 2.0 - See LICENSE for details.

Libraries

builder
fledge_ecs_generator
Code generator for the Fledge ECS framework.