mirror of
https://github.com/flame-engine/flame.git
synced 2025-11-03 20:36:31 +08:00
* wip o lifecycle * Component.add() is no longer async * fix a test * game.ready * fix analyze issues * FcsRoot * fix tests * fix game-in-game example * Merge _addImpl with add() * Move some of the functionality from prepare() into add() * Moved FcsRoot into component.dart and renamed * more doc-comments * dartdocs * Remove addLater in ComponentSet * format * temporarily switch to path dependency in flame_test * restore a test * format * get rid of prepare() in Collidable * eliminate prepare() in Draggable * eradicate prepare() in Hoverable * remove prepare() from Tappable * remove prepare() method and isPrepared flag * remove prepareComponent() from HasCollidables * remove prepareComponent * make flame_bloc depend on latest flame * try to solve flame_bloc dependency graph * fix game resize issue * fix gameresize for zoomed game * do not allow zero size in onGameResize * move onMount() call into add() * use loadingBuilder when size is 0 * ComponentTreeRoot is now in its own file * addToParent() * switch to mount queue * rename isReadyToMount -> isPrepared * make isMounted and isPrepared readonly * minor * print error stacktrace * Component.add() is now async * fix tests * unused import ; * undo irrelevant changes in Component * update tests * tests cleanup * format * expand doc for ComponentTreeRoot * fix analysis error * added tests * update docs * resolve version conflict in pubspec * Apply suggestions from code review Co-authored-by: Lukas Klingsbo <lukas.klingsbo@gmail.com> * late final * remount() function * remove mountQueue * simplify ready() * run mount during children queue processing * simplify mounting * rename childrenQueue->childreQueues * merge tryMounting() with remount() * avoid statics in components lifecycle * remove ComponentTreeRoot * remove dead code * added a todo * added docs for SingleGameInstance * Added tests for SingleGameInstance * added SingleGameInstance to the main doc site * Added test for multi-widget games * cleanup * use state variable in Component * remove test as dependency * upgrade mocktail version * upgrade dartdoc version * fix analyzer warnings * mark staticgameinstance as internal * remove ComponentSet.addChild * use log() from dart:developer * undo changes in flame_bloc/pubspec.yaml * redo changes in flame_bloc/pubspec.yaml * fix dependency in flame_test * remove test dependencies * update pubspec files * remove dart_code_metrics from pubspec * fix a test * Added GameTester.makeReady * omit type on class variable when it can be inferred Co-authored-by: Erick <erickzanardoo@gmail.com> Co-authored-by: Lukas Klingsbo <lukas.klingsbo@gmail.com> Co-authored-by: Erick <erickzanardoo@gmail.com>
21 lines
522 B
Dart
21 lines
522 B
Dart
import 'package:flame/components.dart';
|
|
import 'package:flame/game.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
class MyGameWidget extends StatelessWidget {
|
|
const MyGameWidget({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return GameWidget(game: MyGame());
|
|
}
|
|
}
|
|
|
|
class MyGame extends FlameGame {
|
|
@override
|
|
Future<void> onLoad() async {
|
|
final citySprite = await loadSprite('city.png');
|
|
await add(SpriteComponent(sprite: citySprite, size: Vector2.all(200)));
|
|
}
|
|
}
|