dracone 0.1.3 copy "dracone: ^0.1.3" to clipboard
dracone: ^0.1.3 copied to clipboard

Flutter game engine based on fluttershy library and dartex ECS. Currently you can render sprites, rive files (currently without animations) and rectangles.

example/lib/main.dart

import 'package:dracone/dracone.dart';
import 'package:dracone/assets.dart';
import 'package:dracone/components.dart';
import 'package:dracone/math.dart' hide Colors;
import 'package:example/test_system.dart';
import 'package:flutter/material.dart' hide Transform;

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Dracone(
      systems: [
        TestSystem(),
      ],
      init: (context, world) {
        world
            .createEntity()
            .withComponent(Transform(
              translation: Vector3(0.0, 0.0, 0.0),
            ))
            .withComponent(
              Rectangle(
                size: Size(180.0, 180.0),
                paint: Paint()..color = Colors.red,
              ),
            )
            .build();

        world
            .createEntity()
            .withComponent(Transform(
              translation: Vector3(-100.0, -400.0, 0.0),
              rotation: Quaternion.axisAngle(Vector3(0.0, 0.0, 1.0), 0.7),
            ))
            .withComponent(
              Camera(
                size: Size(double.infinity, 900.0),
              ),
            )
            .build();
      },
      renderConfig: RenderConfig(
        backgroundColor: Colors.green,
        renderOrderCompareFunction: Comparing.join([
          (command) => command.transform.getTranslation().z,
          (command) => command.transform.getTranslation().y,
          (command) => command.transform.getTranslation().x,
        ]),
      ),
    );
  }
}
1
likes
40
pub points
0%
popularity

Publisher

verified publisherdraconic.dev

Flutter game engine based on fluttershy library and dartex ECS. Currently you can render sprites, rive files (currently without animations) and rectangles.

Repository (GitHub)
View/report issues

License

MIT (LICENSE)

Dependencies

dartex, flare_flutter, flutter, fluttershy, ordered_set

More

Packages that depend on dracone