fledge_particles 0.3.1 copy "fledge_particles: ^0.3.1" to clipboard
fledge_particles: ^0.3.1 copied to clipboard

CPU-driven particle system for Fledge — emitters, particle pooling, presets, and DrawLayer.particles integration.

example/example.dart

import 'package:fledge_ecs/fledge_ecs.dart';
import 'package:fledge_particles/fledge_particles.dart';
import 'package:fledge_render_2d/fledge_render_2d.dart';

/// Minimal fledge_particles example.
///
/// [ParticlePlugin] installs the emit / update / reap systems and
/// registers the [ParticleExtractor] on top of [RenderPlugin]'s
/// pipeline (particles are drawn through the standard sprite path
/// via `ExtractedSprite`, in the reserved `DrawLayer.particles`
/// range).
///
/// Attach a [ParticleEmitter] alongside `Transform2D` +
/// `GlobalTransform2D`; here we use the [ParticleEmitterPresets.fire]
/// preset for a steady flame.
void main() async {
  final app = App()
    ..addPlugin(const WallTimePlugin())
    ..addPlugin(RenderPlugin())
    ..addPlugin(const ParticlePlugin());

  // Placeholder texture — in a real game this is a ready
  // `Handle<Texture>` lifted through `TextureHandle.fromAsset`.
  const spark = TextureHandle(id: 0, width: 8, height: 8);

  app.world.spawn()
    ..insert(Transform2D.from(0, 0))
    ..insert(GlobalTransform2D.identity())
    ..insert(ParticleEmitterPresets.fire(texture: spark, emitRate: 60));

  await app.tick();
}
0
likes
160
points
455
downloads

Documentation

API reference

Publisher

verified publisherfledge-framework.dev

Weekly Downloads

CPU-driven particle system for Fledge — emitters, particle pooling, presets, and DrawLayer.particles integration.

Homepage
Repository (GitHub)
View/report issues
Contributing

Topics

#ecs #game-engine #particles #flutter-games

License

Apache-2.0 (license)

Dependencies

fledge_assets, fledge_ecs, fledge_render_2d, flutter, meta, vector_math

More

Packages that depend on fledge_particles