mirror of
https://github.com/flame-engine/flame.git
synced 2025-11-02 03:15:43 +08:00
Remove FPSCounter from BaseGame (#913)
This commit is contained in:
@ -21,9 +21,6 @@ class MyGame extends Game with FPSCounter {
|
|||||||
|
|
||||||
## BaseGame features
|
## BaseGame features
|
||||||
|
|
||||||
If you are using `BaseGame`, you don't have to apply the `FPSCounter` mixin to get access to the
|
|
||||||
current FPS, because it is already applied by default (so you can use the `fps` method directly).
|
|
||||||
|
|
||||||
Flame provides some debugging features for the `BaseGame` class. These features are enabled when
|
Flame provides some debugging features for the `BaseGame` class. These features are enabled when
|
||||||
the `debugMode` property is set to `true` (or overridden to be `true`).
|
the `debugMode` property is set to `true` (or overridden to be `true`).
|
||||||
When `debugMode` is enabled, each `PositionComponent` will be rendered with their bounding size, and
|
When `debugMode` is enabled, each `PositionComponent` will be rendered with their bounding size, and
|
||||||
|
|||||||
@ -203,7 +203,7 @@ class CollidableSnowman extends MyCollidable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class MultipleShapes extends BaseGame
|
class MultipleShapes extends BaseGame
|
||||||
with HasCollidables, HasDraggableComponents {
|
with HasCollidables, HasDraggableComponents, FPSCounter {
|
||||||
final TextPaint fpsTextPaint = TextPaint(
|
final TextPaint fpsTextPaint = TextPaint(
|
||||||
config: TextPaintConfig(
|
config: TextPaintConfig(
|
||||||
color: BasicPalette.white.color,
|
color: BasicPalette.white.color,
|
||||||
|
|||||||
@ -33,7 +33,7 @@ class LogoCompomnent extends SpriteComponent with HasGameRef<DebugGame> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class DebugGame extends BaseGame {
|
class DebugGame extends BaseGame with FPSCounter {
|
||||||
static final fpsTextPaint = TextPaint(
|
static final fpsTextPaint = TextPaint(
|
||||||
config: const TextPaintConfig(
|
config: const TextPaintConfig(
|
||||||
color: Color(0xFFFFFFFF),
|
color: Color(0xFFFFFFFF),
|
||||||
|
|||||||
@ -3,13 +3,13 @@ import 'dart:math';
|
|||||||
import 'dart:ui';
|
import 'dart:ui';
|
||||||
|
|
||||||
import 'package:flame/components.dart' hide Timer;
|
import 'package:flame/components.dart' hide Timer;
|
||||||
import 'package:flame/timer.dart' as flame_timer;
|
|
||||||
import 'package:flame/game.dart';
|
import 'package:flame/game.dart';
|
||||||
import 'package:flame/particles.dart';
|
import 'package:flame/particles.dart';
|
||||||
import 'package:flame/sprite.dart';
|
import 'package:flame/sprite.dart';
|
||||||
|
import 'package:flame/timer.dart' as flame_timer;
|
||||||
import 'package:flutter/material.dart' hide Image;
|
import 'package:flutter/material.dart' hide Image;
|
||||||
|
|
||||||
class ParticlesGame extends BaseGame {
|
class ParticlesGame extends BaseGame with FPSCounter {
|
||||||
/// Defines dimensions of the sample
|
/// Defines dimensions of the sample
|
||||||
/// grid to be displayed on the screen,
|
/// grid to be displayed on the screen,
|
||||||
/// 5x5 in this particular case
|
/// 5x5 in this particular case
|
||||||
|
|||||||
@ -29,6 +29,7 @@
|
|||||||
- Introduce `scale` on `PositionComponent`
|
- Introduce `scale` on `PositionComponent`
|
||||||
- Add `ScaleEffect` that works on `scale` instead of `size`
|
- Add `ScaleEffect` that works on `scale` instead of `size`
|
||||||
- Add class `NotifyingVector2`
|
- Add class `NotifyingVector2`
|
||||||
|
- Remove `FPSCounter` from `BaseGame`
|
||||||
|
|
||||||
## [1.0.0-releasecandidate.13]
|
## [1.0.0-releasecandidate.13]
|
||||||
- Fix camera not ending up in the correct position on long jumps
|
- Fix camera not ending up in the correct position on long jumps
|
||||||
|
|||||||
@ -12,7 +12,6 @@ import '../components/mixins/has_collidables.dart';
|
|||||||
import '../components/mixins/has_game_ref.dart';
|
import '../components/mixins/has_game_ref.dart';
|
||||||
import '../components/mixins/hoverable.dart';
|
import '../components/mixins/hoverable.dart';
|
||||||
import '../components/mixins/tappable.dart';
|
import '../components/mixins/tappable.dart';
|
||||||
import '../fps_counter.dart';
|
|
||||||
import 'camera.dart';
|
import 'camera.dart';
|
||||||
import 'game.dart';
|
import 'game.dart';
|
||||||
import 'projector.dart';
|
import 'projector.dart';
|
||||||
@ -24,7 +23,7 @@ import 'viewport.dart';
|
|||||||
/// [update], [render] and [onResize] methods have default implementations.
|
/// [update], [render] and [onResize] methods have default implementations.
|
||||||
/// This is the recommended structure to use for most games.
|
/// This is the recommended structure to use for most games.
|
||||||
/// It is based on the Component system.
|
/// It is based on the Component system.
|
||||||
class BaseGame extends Game with FPSCounter {
|
class BaseGame extends Game {
|
||||||
/// The list of components to be updated and rendered by the base game.
|
/// The list of components to be updated and rendered by the base game.
|
||||||
late final ComponentSet components = createComponentSet();
|
late final ComponentSet components = createComponentSet();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user