Skip to content

Commit

Permalink
hide matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
renancaraujo committed Dec 14, 2024
1 parent 298a781 commit b4ef4ba
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import 'package:flame/game.dart';
import 'package:flame/geometry.dart';
import 'package:flame/input.dart';
import 'package:flutter/painting.dart';

Check notice on line 11 in examples/lib/stories/camera_and_viewport/camera_component_example.dart

View workflow job for this annotation

GitHub Actions / analyze

The import of 'package:flutter/painting.dart' is unnecessary because all of the used elements are also provided by the import of 'package:flutter/widgets.dart'.

Try removing the import directive. See https://dart.dev/diagnostics/unnecessary_import to learn more about this problem.

Check notice on line 11 in examples/lib/stories/camera_and_viewport/camera_component_example.dart

View workflow job for this annotation

GitHub Actions / analyze-latest

The import of 'package:flutter/painting.dart' is unnecessary because all of the used elements are also provided by the import of 'package:flutter/widgets.dart'.

Try removing the import directive. See https://dart.dev/diagnostics/unnecessary_import to learn more about this problem.
import 'package:flutter/widgets.dart';

class CameraComponentExample extends FlameGame with PanDetector {
static const description = '''
Expand Down Expand Up @@ -117,25 +118,13 @@ class Bezel extends PositionComponent {
const Radius.circular(5.0),
),
))
.transform(
Float64List.fromList(
(Matrix4.identity()..rotateZ(pi / 4)).storage,
),
);
.transform((Matrix4.identity()..rotateZ(pi / 4)).storage);
connector = (Path()
..addArc(Rect.fromLTRB(-outer, -outer, outer, outer), -0.22, 0.44))
.transform(
Float64List.fromList(
(Matrix4.identity()..rotateZ(pi / 4)).storage,
),
);
.transform((Matrix4.identity()..rotateZ(pi / 4)).storage);
specularHighlight = (Path()
..addOval(Rect.fromLTWH(-radius * 0.8, -8, 16, radius * 0.3)))
.transform(
Float64List.fromList(
(Matrix4.identity()..rotateZ(pi / 4)).storage,
),
);
.transform((Matrix4.identity()..rotateZ(pi / 4)).storage);

glassPaint = Paint()..color = const Color(0x1400ffae);
rimBorderPaint = Paint()
Expand Down
1 change: 1 addition & 0 deletions packages/flame/lib/src/components/mixins/snapshot.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'dart:typed_data';
import 'dart:ui';

import 'package:flame/components.dart';
import 'package:vector_math/vector_math.dart';

/// A mixin that enables caching a component and all its children. If
/// [renderSnapshot] is set to `true`, the component and its children will be
Expand Down
1 change: 1 addition & 0 deletions packages/flame/lib/src/components/position_component.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import 'package:flame/src/game/notifying_vector2.dart';
import 'package:flame/src/game/transform2d.dart';
import 'package:flame/src/rendering/decorator.dart';
import 'package:flame/src/rendering/transform2d_decorator.dart';
import 'package:vector_math/vector_math.dart';

/// A [Component] implementation that represents an object that can be
/// freely moved around the screen, rotated, and scaled.
Expand Down
5 changes: 2 additions & 3 deletions packages/flame/lib/src/extensions/vector2.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import 'dart:math';
import 'dart:ui';

import 'package:vector_math/vector_math.dart';

export 'package:vector_math/vector_math.dart' hide Colors;
import 'package:vector_math/vector_math.dart' hide Colors, Matrix4;
export 'package:vector_math/vector_math.dart' hide Colors, Matrix4;

extension Vector2Extension on Vector2 {
/// This is a reusable vector that can be used within the [Vector2Extension]
Expand Down
1 change: 1 addition & 0 deletions packages/flame/lib/src/sprite_batch.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:flame/extensions.dart';
import 'package:flame/flame.dart';
import 'package:flame/game.dart';
import 'package:meta/meta.dart';
import 'package:vector_math/vector_math.dart';

extension SpriteBatchExtension on Game {
/// Utility method to load and cache the image for a [SpriteBatch] based on
Expand Down
1 change: 1 addition & 0 deletions packages/flame/test/components/mixins/snapshot_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:flame/extensions.dart';
import 'package:flame/game.dart';
import 'package:flame_test/flame_test.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:vector_math/vector_math.dart';

void main() {
group(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:flame/game.dart';
import 'package:flame/geometry.dart';
import 'package:flame_test/flame_test.dart';
import 'package:test/test.dart';
import 'package:vector_math/vector_math.dart';

void main() {
group('PositionComponent', () {
Expand Down
1 change: 1 addition & 0 deletions packages/flame/test/extensions/rect_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:flame/geometry.dart';
import 'package:flame_test/flame_test.dart';
import 'package:mocktail/mocktail.dart';
import 'package:test/test.dart';
import 'package:vector_math/vector_math.dart';

void main() {
group('RectExtension', () {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:flame/components.dart' show Component;
import 'package:flame/components.dart';
import 'package:flame_studio/src/core/component_tree.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
Expand Down

0 comments on commit b4ef4ba

Please sign in to comment.