fledge_ecs_generator 0.1.10 copy "fledge_ecs_generator: ^0.1.10" to clipboard
fledge_ecs_generator: ^0.1.10 copied to clipboard

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

fledge_ecs_generator #

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

Installation #

Add to your dev_dependencies:

dev_dependencies:
  fledge_ecs_generator: ^0.1.0
  build_runner: ^2.4.0

And add fledge_ecs_annotations to your regular dependencies:

dependencies:
  fledge_ecs: ^0.1.0
  fledge_ecs_annotations: ^0.1.0

Usage #

1. Annotate Your Code #

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<Time> time) {
  for (final (pos, vel) in query.iter()) {
    pos.x += vel.x * time.value.delta;
    pos.y += vel.y * time.value.delta;
  }
}

2. Run the Generator #

dart run build_runner build

3. Use Generated Code #

The generator creates registration code that you can use to set up your app:

import 'my_game.g.dart';

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

License #

Apache 2.0 - See LICENSE for details.

0
likes
160
points
383
downloads

Publisher

verified publisherfledge-framework.dev

Weekly Downloads

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

Homepage
Repository (GitHub)
View/report issues
Contributing

Topics

#ecs #code-generation #build-runner #game-development

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

analyzer, build, fledge_ecs_annotations, source_gen

More

Packages that depend on fledge_ecs_generator