From 00ab347c57b151c9232c85150e36a8a7781511a3 Mon Sep 17 00:00:00 2001 From: Pasha Stetsenko Date: Fri, 26 Aug 2022 03:08:53 -0700 Subject: [PATCH] chore!: Remove functions/classes that were scheduled for removal in v1.3.0 (#1867) This functionality should have been deleted before releasing version 1.3.0, but I guess we forgot ;), so better late than never. --- CONTRIBUTING.md | 8 ++-- packages/flame/lib/assets.dart | 4 -- packages/flame/lib/game.dart | 1 - packages/flame/lib/src/anchor.dart | 5 --- .../lib/src/components/component_set.dart | 3 -- packages/flame/lib/src/effects/effect.dart | 8 ---- .../lib/src/game/mixins/fps_counter.dart | 38 ------------------- packages/flame_test/lib/src/flame_test.dart | 24 ------------ 8 files changed, 4 insertions(+), 87 deletions(-) delete mode 100644 packages/flame/lib/assets.dart delete mode 100644 packages/flame/lib/src/game/mixins/fps_counter.dart diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0a26f75320d..c80b4b16e5a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -108,10 +108,10 @@ two versions after the current one, such that there will be at least one stable users get to see the deprecation warning and in the version after that (or a later version) the deprecated entity should be removed. -Example (if the current version is v1.1.0): +Example (if the current version is v1.3.0): ```dart -@Deprecated('Will be removed in v1.3.0, use nonDeprecatedFeature() instead') +@Deprecated('Will be removed in v1.5.0, use nonDeprecatedFeature() instead') void deprecatedFeature() {} ``` @@ -161,7 +161,7 @@ commit message. ## Creating a release There are a few things to think about when doing a release: - + - Search through the codebase for `@Deprecated` methods/fields and remove the ones that are marked for removal in the version that you are intending to release. - Create a PR containing the changes for removing the deprecated entities. @@ -173,7 +173,7 @@ There are a few things to think about when doing a release: sure that all the versions are correct. - Once you are satisfied with the result of the dry run, run `melos publish --no-dry-run` - Create a PR containing the updated changelog and `pubspec.yaml` files. - + [GitHub issue]: https://github.com/flame-engine/flame/issues/new [GitHub issues]: https://github.com/flame-engine/flame/issues/new diff --git a/packages/flame/lib/assets.dart b/packages/flame/lib/assets.dart deleted file mode 100644 index 3fb4f7dc257..00000000000 --- a/packages/flame/lib/assets.dart +++ /dev/null @@ -1,4 +0,0 @@ -@Deprecated('Use the cache.dart file instead, will be removed in v1.3.0') -export 'src/cache/assets_cache.dart'; -@Deprecated('Use the cache.dart file instead, will be removed in v1.3.0') -export 'src/cache/images.dart'; diff --git a/packages/flame/lib/game.dart b/packages/flame/lib/game.dart index d85a2a1e928..0f1cdb47cc0 100644 --- a/packages/flame/lib/game.dart +++ b/packages/flame/lib/game.dart @@ -11,7 +11,6 @@ export 'src/game/camera/viewport.dart'; export 'src/game/flame_game.dart'; export 'src/game/game.dart'; export 'src/game/game_widget/game_widget.dart'; -export 'src/game/mixins/fps_counter.dart'; export 'src/game/mixins/has_draggables.dart'; export 'src/game/mixins/has_hoverables.dart'; export 'src/game/mixins/has_tappables.dart'; diff --git a/packages/flame/lib/src/anchor.dart b/packages/flame/lib/src/anchor.dart index ea7f6b234e1..276c12e128c 100644 --- a/packages/flame/lib/src/anchor.dart +++ b/packages/flame/lib/src/anchor.dart @@ -43,11 +43,6 @@ class Anchor { const Anchor(this.x, this.y); - @Deprecated('Do not use; will be removed in 1.3.0') - Vector2 translate(Vector2 p, Vector2 size) { - return p - (toVector2()..multiply(size)); - } - /// Take your position [position] that is on this anchor and give back what /// that position it would be on in anchor [otherAnchor] with a size of /// [size]. diff --git a/packages/flame/lib/src/components/component_set.dart b/packages/flame/lib/src/components/component_set.dart index c6207ced943..74f32927696 100644 --- a/packages/flame/lib/src/components/component_set.dart +++ b/packages/flame/lib/src/components/component_set.dart @@ -22,9 +22,6 @@ class ComponentSet extends QueryableOrderedSet { strictMode: strictMode ?? defaultStrictMode, ); - @Deprecated('Use ComponentSet.new instead; will be removed in 1.3.0') - ComponentSet.createDefault() : this(); - /// Components whose priority changed since the last update. /// /// When priorities change we need to re-balance the component set, but diff --git a/packages/flame/lib/src/effects/effect.dart b/packages/flame/lib/src/effects/effect.dart index f2cadcc3b52..39d13ac7979 100644 --- a/packages/flame/lib/src/effects/effect.dart +++ b/packages/flame/lib/src/effects/effect.dart @@ -47,14 +47,6 @@ abstract class Effect extends Component { /// Optional callback function to be invoked once the effect completes. void Function()? onComplete; - @Deprecated('It will be removed in v1.3.0. Use Effect.onComplete instead') - void Function()? get onFinishCallback => onComplete; - - @Deprecated('It will be removed in v1.3.0. Use Effect.onComplete instead') - set onFinishCallback(void Function()? callback) { - onComplete = callback; - } - /// Boolean indicators of the effect's state, their purpose is to ensure that /// the `onStart()` and `onFinish()` callbacks are called exactly once. bool _started; diff --git a/packages/flame/lib/src/game/mixins/fps_counter.dart b/packages/flame/lib/src/game/mixins/fps_counter.dart deleted file mode 100644 index 7f41ebce84a..00000000000 --- a/packages/flame/lib/src/game/mixins/fps_counter.dart +++ /dev/null @@ -1,38 +0,0 @@ -import 'dart:collection'; - -import 'package:flame/game.dart'; - -const _maxFrames = 60; -const frameInterval = - Duration(microseconds: Duration.microsecondsPerSecond ~/ _maxFrames); - -@Deprecated( - 'Use FPSComponent or FPSTextComponent instead. ' - 'FPSCounter will be removed in v1.3.0', -) -mixin FPSCounter on Game { - /// The sliding window size, i.e. the number of game ticks over which the fps - /// measure will be averaged. - final int windowSize = 60; - - /// The queue of the recent game tick durations. - /// The length of this queue will not exceed [windowSize]. - final Queue window = Queue(); - - /// The sum of all values in the [window] queue. - double _sum = 0; - - @override - void update(double dt) { - window.addLast(dt); - _sum += dt; - if (window.length > windowSize) { - _sum -= window.removeFirst(); - } - } - - /// Get the current average FPS over the last [windowSize] frames. - double fps([int average = 1]) { - return window.isEmpty ? 0 : window.length / _sum; - } -} diff --git a/packages/flame_test/lib/src/flame_test.dart b/packages/flame_test/lib/src/flame_test.dart index 5ed48ce761a..32de8246ca7 100644 --- a/packages/flame_test/lib/src/flame_test.dart +++ b/packages/flame_test/lib/src/flame_test.dart @@ -125,30 +125,6 @@ class GameTester { ); } - /// Creates a [Game] specific test case with given [description] - /// which runs inside the Flutter test environment. - /// - /// Use [verify] closure to make verifications/assertions. - @isTest - @Deprecated('Use testGameWidget instead, will be removed in v1.3.0') - void widgetTest( - String description, - WidgetVerifyFunction? verify, { - bool? skip, - Timeout? timeout, - bool? semanticsEnabled, - dynamic tags, - }) { - testGameWidget( - description, - verify: verify, - skip: skip, - timeout: timeout, - semanticsEnabled: semanticsEnabled, - tags: tags, - ); - } - /// Creates a [Game] specific test case with given [description] /// which runs inside the Flutter test environment. ///