flame_svg 0.0.1 copy "flame_svg: ^0.0.1" to clipboard
flame_svg: ^0.0.1 copied to clipboard

outdated

Package to add SVG rendering support for the Flame game engine

example/lib/main.dart

import 'package:flame/game.dart';
import 'package:flame_svg/flame_svg.dart';
import 'package:flame/position.dart';

import 'package:flutter/material.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();

  final game = MyGame();
  runApp(game.widget);
}

class MyGame extends BaseGame {
  Svg svgInstance;
  SvgComponent android;

  MyGame() {
    _start();
  }

  void _start() {
    svgInstance = Svg('android.svg');
    android = SvgComponent.fromSvg(100, 100, svgInstance);
    android.x = 100;
    android.y = 100;

    add(android);
  }

  @override
  void render(Canvas canvas) {
    super.render(canvas);

    svgInstance.renderPosition(canvas, Position(100, 200), 300, 300);
  }
}
22
likes
40
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

MIT (license)

Dependencies

flame, flutter, flutter_svg

More

Packages that depend on flame_svg