mirror of
https://github.com/flame-engine/flame.git
synced 2025-11-03 20:36:31 +08:00
Properly propagate onMount and onRemove to children (#579)
* Fix rendering of children * Game loop handles other restore * Properly propagate onMount and onRemove to children * Use BaseGame on gestures to minimize confusion * Fix linting * All children don't need preparation * Add composability example * gameRef might not be defined * Add mustCallSuper * isMounted on game * Remove unused gameRef argument * Made isMounted only modifiable by the component * Move dartdoc to public isMounted * Fix formatting
This commit is contained in:
@ -12,7 +12,8 @@ void main() {
|
||||
}
|
||||
|
||||
/// Includes an example mixing two advanced detectors
|
||||
class MyGame extends Game with MultiTouchTapDetector, MultiTouchDragDetector {
|
||||
class MyGame extends BaseGame
|
||||
with MultiTouchTapDetector, MultiTouchDragDetector {
|
||||
final _whitePaint = BasicPalette.white.paint;
|
||||
|
||||
Paint _paint;
|
||||
@ -81,11 +82,9 @@ class MyGame extends Game with MultiTouchTapDetector, MultiTouchDragDetector {
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void update(double dt) {}
|
||||
|
||||
@override
|
||||
void render(Canvas canvas) {
|
||||
super.render(canvas);
|
||||
_taps.values.forEach((rect) {
|
||||
canvas.drawRect(rect, _paint);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user