flame_svg 1.0.0-rc1 copy "flame_svg: ^1.0.0-rc1" to clipboard
flame_svg: ^1.0.0-rc1 copied to clipboard

outdated

Package to add SVG rendering support for the Flame game engine

example/lib/main.dart

import 'package:flame/extensions/vector2.dart';
import 'package:flame/game.dart';
import 'package:flame_svg/flame_svg.dart';

import 'package:flutter/material.dart';

void main() {
  runApp(GameWidget(game: MyGame()));
}

class MyGame extends BaseGame {
  Svg svgInstance;
  SvgComponent android;

  @override
  void render(Canvas canvas) {
    super.render(canvas);
    svgInstance?.renderPosition(
      canvas,
      Vector2(100, 200),
      Vector2.all(300),
    );
  }

  @override
  Future<void> onLoad() async {
    final size = Vector2.all(100);
    svgInstance = await loadSvg('android.svg');
    android = SvgComponent.fromSvg(size, svgInstance);
    android.x = 100;
    android.y = 100;
    add(android);
  }
}
22
likes
0
pub points
91%
popularity

Publisher

verified publisherflame-engine.org

Package to add SVG rendering support for the Flame game engine

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flame, flutter, flutter_svg

More

Packages that depend on flame_svg