flame_forge2d 0.0.1-rc1 copy "flame_forge2d: ^0.0.1-rc1" to clipboard
flame_forge2d: ^0.0.1-rc1 copied to clipboard

outdated

Forge2D (Box2D) support for the Flame game engine. This uses the forge2d package and provides wrappers and components to be used inside Flame.

example/lib/main.dart

import 'package:dashbook/dashbook.dart';
import 'package:flame/extensions/size.dart';
import 'package:flame/extensions/vector2.dart';
import 'package:flutter/material.dart';
import 'package:forge2d_samples/circle_stress_sample.dart';

import './sprite_body_sample.dart';
import './contact_callbacks_sample.dart';
import './domino_sample.dart';
import 'blob_sample.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  final dashbook = Dashbook();

  Vector2 ctxSize(DashbookContext ctx) => ctx.constraints.biggest.toVector2();

  dashbook.storiesOf('Flame with Forge2D').decorator(TopDecorator())
    ..add(
      'Blob sample',
      (DashbookContext ctx) => BlobSample(ctxSize(ctx)).widget,
    )
    ..add(
      'Domino sample',
      (DashbookContext ctx) => DominoSample(ctxSize(ctx)).widget,
    )
    ..add(
      'Contact Callbacks',
      (DashbookContext ctx) => ContactCallbacksSample(ctxSize(ctx)).widget,
    )
    ..add(
      'Circle stress sample',
      (DashbookContext ctx) => CircleStressSample(ctxSize(ctx)).widget,
    )
    ..add(
      'Sprite Bodies',
      (DashbookContext ctx) => SpriteBodySample(ctxSize(ctx)).widget,
    );

  runApp(dashbook);
}

class TopDecorator extends Decorator {
  @override
  Widget decorate(Widget child) {
    return Align(
      child: child,
      alignment: Alignment.topCenter,
    );
  }
}
65
likes
0
pub points
94%
popularity

Publisher

verified publisherflame-engine.org

Forge2D (Box2D) support for the Flame game engine. This uses the forge2d package and provides wrappers and components to be used inside Flame.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flame, flutter, forge2d

More

Packages that depend on flame_forge2d