mirror of
https://github.com/flame-engine/flame.git
synced 2025-11-02 03:15:43 +08:00
PR suggestion
This commit is contained in:
@ -10,7 +10,7 @@ import 'package:flame/palette.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
final game = MyGame()..runOnCreation = false;
|
final game = MyGame();
|
||||||
|
|
||||||
runApp(game.widget);
|
runApp(game.widget);
|
||||||
}
|
}
|
||||||
@ -54,7 +54,7 @@ class Square extends PositionComponent with HasGameRef<MyGame> {
|
|||||||
|
|
||||||
class MyGame extends BaseGame with TapDetector {
|
class MyGame extends BaseGame with TapDetector {
|
||||||
final double squareSize = 128;
|
final double squareSize = 128;
|
||||||
bool running = false;
|
bool running = true;
|
||||||
|
|
||||||
MyGame() {
|
MyGame() {
|
||||||
add(Square());
|
add(Square());
|
||||||
|
|||||||
@ -397,8 +397,9 @@ class GameRenderBox extends RenderBox with WidgetsBindingObserver {
|
|||||||
|
|
||||||
void _unscheduleTick() {
|
void _unscheduleTick() {
|
||||||
_running = false;
|
_running = false;
|
||||||
if (_frameCallbackId != null)
|
if (_frameCallbackId != null) {
|
||||||
SchedulerBinding.instance.cancelFrameCallbackWithId(_frameCallbackId);
|
SchedulerBinding.instance.cancelFrameCallbackWithId(_frameCallbackId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _tick(Duration timestamp) {
|
void _tick(Duration timestamp) {
|
||||||
|
|||||||
Reference in New Issue
Block a user