Skip to content

Commit

Permalink
Move files to src and comply with the dart package layout convention (#…
Browse files Browse the repository at this point in the history
…621)

* 👌 Use `Offset` type directly in `JoystickAction.update` calculations (#631)

* Move files to src and comply with the dart package layout convention

* Fixing widgets example

Co-authored-by: Serge Matveenko <lig@countzero.co>
Co-authored-by: Erick Zanardo <erickzanardoo@gmail.com>
  • Loading branch information
3 people authored Jan 20, 2021
1 parent 4e63c31 commit 00ad86e
Show file tree
Hide file tree
Showing 146 changed files with 1,232 additions and 1,275 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
- Updated the `widgets.md` documentation
- Removing methods `initialDimensions` and `removeGestureRecognizer` to avoid confusion
- Adding standard for `SpriteComponent` and `SpriteAnimationComponent` constructors
- Move files to comply with the dart package layout convention

## 1.0.0-rc5
- Option for overlays to be already visible on the GameWidget
Expand Down
4 changes: 1 addition & 3 deletions doc/examples/animations/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import 'package:flame/components.dart';
import 'package:flame/game.dart';
import 'package:flame/gestures.dart';
import 'package:flutter/gestures.dart';
import 'package:flame/extensions/vector2.dart';
import 'package:flame/sprite_animation.dart';
import 'package:flame/components/sprite_animation_component.dart';
import 'package:flutter/material.dart' hide Image;
import 'dart:ui';

Expand Down
4 changes: 1 addition & 3 deletions doc/examples/aseprite/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import 'package:flame/components.dart';
import 'package:flame/game.dart';
import 'package:flame/sprite_animation.dart';
import 'package:flame/extensions/vector2.dart';
import 'package:flame/components/sprite_animation_component.dart';
import 'package:flutter/material.dart';

void main() async {
Expand Down
5 changes: 1 addition & 4 deletions doc/examples/composability/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import 'package:flame/anchor.dart';
import 'package:flame/components/mixins/has_game_ref.dart';
import 'package:flame/components/position_component.dart';
import 'package:flame/components.dart';
import 'package:flame/game.dart';
import 'package:flame/extensions/vector2.dart';
import 'package:flutter/material.dart';

void main() async {
Expand Down
4 changes: 1 addition & 3 deletions doc/examples/debug/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import 'package:flame/components.dart';
import 'package:flame/game.dart';
import 'package:flame/flame.dart';
import 'package:flame/extensions/vector2.dart';
import 'package:flame/components/sprite_component.dart';
import 'package:flame/text_config.dart';

import 'package:flutter/material.dart' hide Image;

Expand Down
10 changes: 3 additions & 7 deletions doc/examples/effects/combined_effects/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import 'package:flame/effects/combined_effect.dart';
import 'package:flame/effects/move_effect.dart';
import 'package:flame/effects/scale_effect.dart';
import 'package:flame/effects/rotate_effect.dart';
import 'package:flame/effects.dart';
import 'package:flame/game.dart';
import 'package:flame/gestures.dart';
import 'package:flame/extensions/offset.dart';
import 'package:flame/extensions/vector2.dart';
import 'package:flame/flame.dart';
import 'package:flutter/material.dart';
import 'package:flame/extensions.dart';
import 'package:flutter/widgets.dart';

import './square.dart';

Expand Down
5 changes: 1 addition & 4 deletions doc/examples/effects/combined_effects/lib/square.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import 'package:flame/anchor.dart';
import 'package:flame/components/position_component.dart';

import 'dart:ui';

import 'package:flame/extensions/vector2.dart';
import 'package:flame/components.dart';

class Square extends PositionComponent {
final Paint _paint;
Expand Down
5 changes: 1 addition & 4 deletions doc/examples/effects/infinite_effects/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import 'package:flame/effects/move_effect.dart';
import 'package:flame/effects/scale_effect.dart';
import 'package:flame/effects/rotate_effect.dart';
import 'package:flame/effects.dart';
import 'package:flame/gestures.dart';
import 'package:flame/extensions/vector2.dart';
import 'package:flame/flame.dart';
import 'package:flame/game.dart';
import 'package:flutter/material.dart';
Expand Down
5 changes: 1 addition & 4 deletions doc/examples/effects/infinite_effects/lib/square.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import 'package:flame/anchor.dart';
import 'package:flame/components/position_component.dart';

import 'dart:ui';

import 'package:flame/extensions/vector2.dart';
import 'package:flame/components.dart';

class Square extends PositionComponent {
final Paint _paint;
Expand Down
11 changes: 3 additions & 8 deletions doc/examples/effects/sequence_effect/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import 'package:flame/effects/combined_effect.dart';
import 'package:flame/effects/move_effect.dart';
import 'package:flame/effects/scale_effect.dart';
import 'package:flame/effects/rotate_effect.dart';
import 'package:flame/effects/sequence_effect.dart';
import 'package:flame/gestures.dart';
import 'package:flame/extensions/offset.dart';
import 'package:flame/extensions/vector2.dart';
import 'package:flame/effects.dart';
import 'package:flame/flame.dart';
import 'package:flame/game.dart';
import 'package:flame/gestures.dart';
import 'package:flame/extensions.dart';
import 'package:flutter/material.dart';

import './square.dart';
Expand Down
5 changes: 1 addition & 4 deletions doc/examples/effects/sequence_effect/lib/square.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import 'package:flame/anchor.dart';
import 'package:flame/components/position_component.dart';

import 'dart:ui';

import 'package:flame/extensions/vector2.dart';
import 'package:flame/components.dart';

class Square extends PositionComponent {
final Paint _paint;
Expand Down
8 changes: 4 additions & 4 deletions doc/examples/effects/simple/lib/main_move.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import 'package:flame/effects.dart';
import 'package:flame/game.dart';
import 'package:flutter/material.dart';
import 'package:flame/extensions/vector2.dart';
import 'package:flame/gestures.dart';
import 'package:flame/effects/effects.dart';
import 'package:flame/extensions/offset.dart';
import 'package:flame/extensions.dart';
import 'package:flutter/animation.dart';
import 'package:flutter/widgets.dart';

import './square.dart';

Expand Down
4 changes: 2 additions & 2 deletions doc/examples/effects/simple/lib/main_rotate.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import 'dart:math';

import 'package:flame/components.dart';
import 'package:flame/effects.dart';
import 'package:flame/game.dart';
import 'package:flutter/material.dart';
import 'package:flame/gestures.dart';
import 'package:flame/anchor.dart';
import 'package:flame/effects/effects.dart';

import './square.dart';

Expand Down
5 changes: 2 additions & 3 deletions doc/examples/effects/simple/lib/main_scale.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import 'package:flame/components.dart';
import 'package:flame/effects.dart';
import 'package:flutter/material.dart';
import 'package:flame/game.dart';
import 'package:flame/gestures.dart';
import 'package:flame/anchor.dart';
import 'package:flame/extensions/vector2.dart';
import 'package:flame/effects/effects.dart';

import './square.dart';

Expand Down
5 changes: 1 addition & 4 deletions doc/examples/effects/simple/lib/square.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import 'package:flame/anchor.dart';
import 'package:flame/components/position_component.dart';
import 'package:flame/components.dart';

import 'dart:ui';

import 'package:flame/extensions/vector2.dart';

class Square extends PositionComponent {
static final _paint = Paint()..color = const Color(0xFFFFFFFF);

Expand Down
7 changes: 2 additions & 5 deletions doc/examples/gestures/lib/main_draggables.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import 'package:flame/anchor.dart';
import 'package:flame/components/mixins/draggable.dart';
import 'package:flame/extensions/offset.dart';
import 'package:flame/extensions/vector2.dart';
import 'package:flame/components.dart';
import 'package:flame/extensions.dart';
import 'package:flame/gestures.dart';
import 'package:flutter/material.dart' hide Draggable;
import 'package:flame/game.dart';
import 'package:flame/components/position_component.dart';

void main() {
final widget = Container(
Expand Down
3 changes: 1 addition & 2 deletions doc/examples/gestures/lib/main_mouse_movement.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import 'package:flame/game.dart';
import 'package:flutter/material.dart';
import 'package:flame/gestures.dart';
import 'package:flame/palette.dart';
import 'package:flame/extensions/vector2.dart';
import 'package:flame/extensions/offset.dart';
import 'package:flame/extensions.dart';

void main() {
runApp(
Expand Down
4 changes: 1 addition & 3 deletions doc/examples/gestures/lib/main_overlapping_tapables.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import 'dart:math' as math;

import 'package:flame/extensions/vector2.dart';
import 'package:flame/components.dart';
import 'package:flame/palette.dart';
import 'package:flutter/material.dart';
import 'package:flame/game.dart';
import 'package:flame/components/position_component.dart';
import 'package:flame/components/mixins/tapable.dart';

void main() {
final game = MyGame();
Expand Down
3 changes: 1 addition & 2 deletions doc/examples/gestures/lib/main_scroll.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flame/game.dart';
import 'package:flame/gestures.dart';
import 'package:flame/palette.dart';
import 'package:flame/extensions/vector2.dart';
import 'package:flame/extensions/offset.dart';
import 'package:flame/extensions.dart';

void main() {
final game = MyGame();
Expand Down
6 changes: 2 additions & 4 deletions doc/examples/gestures/lib/main_tapables.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import 'package:flame/anchor.dart';
import 'package:flame/extensions/vector2.dart';
import 'package:flame/components.dart';
import 'package:flutter/material.dart';
import 'package:flame/game.dart';
import 'package:flame/components/position_component.dart';
import 'package:flame/components/mixins/tapable.dart';
import 'package:flame/extensions.dart';

void main() {
runApp(
Expand Down
5 changes: 1 addition & 4 deletions doc/examples/isometric/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import 'package:flame/components/sprite_component.dart';
import 'package:flame/extensions/vector2.dart';
import 'package:flame/components.dart';
import 'package:flame/game.dart';
import 'package:flame/components/isometric_tile_map_component.dart';
import 'package:flame/gestures.dart';
import 'package:flame/sprite.dart';
import 'package:flame/spritesheet.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart' hide Image;
Expand Down
4 changes: 1 addition & 3 deletions doc/examples/joystick/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import 'package:flame/components/joystick/joystick_action.dart';
import 'package:flame/components/joystick/joystick_component.dart';
import 'package:flame/components/joystick/joystick_directional.dart';
import 'package:flame/game.dart';
import 'package:flame/gestures.dart';
import 'package:flame/joystick.dart';
import 'package:flutter/material.dart';

import 'player.dart';
Expand Down
6 changes: 2 additions & 4 deletions doc/examples/joystick/lib/player.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import 'dart:math';
import 'dart:ui';

import 'package:flame/components/component.dart';
import 'package:flame/components/joystick/joystick_component.dart';
import 'package:flame/components/joystick/joystick_events.dart';
import 'package:flame/components.dart';
import 'package:flame/joystick.dart';
import 'package:flame/palette.dart';
import 'package:flame/extensions/vector2.dart';

class Player extends Component implements JoystickListener {
final _whitePaint = BasicPalette.white.paint;
Expand Down
8 changes: 4 additions & 4 deletions doc/examples/layers/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import 'package:flame/extensions/vector2.dart';
import 'package:flame/components.dart';
import 'package:flame/game.dart';
import 'package:flutter/material.dart' hide Animation;
import 'package:flame/sprite.dart';
import 'package:flame/layers/layer.dart';
import 'package:flame/flame.dart';
import 'package:flame/layers.dart';

import 'dart:ui';

import 'package:flutter/widgets.dart';

void main() async {
Flame.initializeWidget();

Expand Down
5 changes: 1 addition & 4 deletions doc/examples/nine_tile_box/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import 'package:flame/components.dart';
import 'package:flame/game.dart';
import 'package:flame/nine_tile_box.dart';
import 'package:flame/sprite.dart';
import 'package:flame/extensions/vector2.dart';

import 'package:flutter/material.dart';

void main() async {
Expand Down
3 changes: 1 addition & 2 deletions doc/examples/parallax/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:flame/components.dart';
import 'package:flame/flame.dart';
import 'package:flame/components/parallax_component.dart';
import 'package:flame/extensions/vector2.dart';
import 'package:flame/game.dart';
import 'package:flutter/material.dart';

Expand Down
3 changes: 1 addition & 2 deletions doc/examples/parallax/lib/main_advanced.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'package:flame/components.dart';
import 'package:flame/flame.dart';
import 'package:flame/parallax.dart';
import 'package:flame/components/parallax_component.dart';
import 'package:flame/extensions/vector2.dart';
import 'package:flame/game.dart';
import 'package:flutter/material.dart';

Expand Down
25 changes: 4 additions & 21 deletions doc/examples/particles/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,12 @@ import 'dart:async';
import 'dart:math';
import 'dart:ui';

import 'package:flame/sprite_animation.dart';
import 'package:flame/components/component.dart';
import 'package:flame/particles/circle_particle.dart';
import 'package:flame/particles/composed_particle.dart';
import 'package:flame/particles/curved_particle.dart';
import 'package:flame/particles/moving_particle.dart';
import 'package:flame/particles/sprite_particle.dart';
import 'package:flame/particles/translated_particle.dart';
import 'package:flame/particles/computed_particle.dart';
import 'package:flame/particles/image_particle.dart';
import 'package:flame/particles/rotating_particle.dart';
import 'package:flame/particles/accelerated_particle.dart';
import 'package:flame/particles/paint_particle.dart';
import 'package:flame/particles/animation_particle.dart';
import 'package:flame/particles/component_particle.dart';
import 'package:flame/components.dart' hide Timer;
import 'package:flame/flame.dart';
import 'package:flame/timer.dart' as flame_timer;
import 'package:flame/game.dart';
import 'package:flame/timer.dart' as flame_time;
import 'package:flame/particle.dart';
import 'package:flame/extensions/vector2.dart';
import 'package:flame/sprite.dart';
import 'package:flame/particles.dart';
import 'package:flame/spritesheet.dart';
import 'package:flame/text_config.dart';
import 'package:flutter/material.dart' hide Image;

void main() async {
Expand Down Expand Up @@ -570,7 +553,7 @@ class SineCurve extends Curve {
/// each 2s of registered lifetime.
class TrafficLightComponent extends Component {
final Rect rect = Rect.fromCenter(center: Offset.zero, height: 32, width: 32);
final flame_time.Timer colorChangeTimer = flame_time.Timer(2, repeat: true);
final flame_timer.Timer colorChangeTimer = flame_timer.Timer(2, repeat: true);
final colors = <Color>[
Colors.green,
Colors.orange,
Expand Down
4 changes: 1 addition & 3 deletions doc/examples/render_flip/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import 'package:flame/sprite_animation.dart';
import 'package:flame/components/sprite_animation_component.dart';
import 'package:flame/components.dart';
import 'package:flame/game.dart';
import 'package:flame/extensions/vector2.dart';
import 'package:flutter/material.dart' hide Image;
import 'dart:ui';

Expand Down
3 changes: 1 addition & 2 deletions doc/examples/sprite_batch/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import 'dart:math';

import 'package:flame/extensions/vector2.dart';
import 'package:flame/components.dart';
import 'package:flutter/material.dart';
import 'package:flame/game.dart';
import 'package:flame/sprite_batch.dart';
import 'package:flame/components/sprite_batch_component.dart';

void main() async {
WidgetsFlutterBinding.ensureInitialized();
Expand Down
5 changes: 2 additions & 3 deletions doc/examples/sprites/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import 'dart:math';

import 'package:flame/components/sprite_component.dart';
import 'package:flame/components.dart';
import 'package:flame/game.dart';
import 'package:flame/extensions/vector2.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';

void main() async {
WidgetsFlutterBinding.ensureInitialized();
Expand Down
Loading

0 comments on commit 00ad86e

Please sign in to comment.