flame_3d_extras 0.1.0-dev.3 copy "flame_3d_extras: ^0.1.0-dev.3" to clipboard
flame_3d_extras: ^0.1.0-dev.3 copied to clipboard

An experimental playground with extra features yet to be fully ported into flame_3d. Anything in this package is subject to change. Features will probably be slowly incorporated into the main library.

example/lib/main.dart

import 'package:example/playground_game.dart';
import 'package:flame/game.dart' show GameWidget;
import 'package:flutter/widgets.dart';

void main() async {
  runApp(const PlaygroundApp());
}

class PlaygroundApp extends StatefulWidget {
  const PlaygroundApp({super.key});

  @override
  State<PlaygroundApp> createState() => _PlaygroundAppState();
}

class _PlaygroundAppState extends State<PlaygroundApp>
    with WidgetsBindingObserver {
  final game = PlaygroundGame();

  @override
  void initState() {
    super.initState();
    WidgetsBinding.instance.addObserver(this);
  }

  @override
  void dispose() {
    WidgetsBinding.instance.removeObserver(this);
    super.dispose();
  }

  @override
  void didChangeAppLifecycleState(AppLifecycleState state) {
    if (state == AppLifecycleState.resumed) {
      return;
    }

    if (!game.isPaused) {
      game.pause();
    }
  }

  @override
  Widget build(BuildContext context) {
    return GameWidget(game: game);
  }
}
0
likes
110
points
29
downloads

Publisher

unverified uploader

Weekly Downloads

An experimental playground with extra features yet to be fully ported into flame_3d. Anything in this package is subject to change. Features will probably be slowly incorporated into the main library.

Repository (GitHub)

Topics

#flame #game-engine #flame-3d #opengl

Documentation

API reference

Funding

Consider supporting this project:

opencollective.com
github.com
patreon.com

License

MIT (license)

Dependencies

flame, flame_3d, ordered_set

More

Packages that depend on flame_3d_extras