Skip to content

Commit

Permalink
Update ignite to newest version of dependencies (#13)
Browse files Browse the repository at this point in the history
* Update ignite to newest version of dependencies

* Update bricks/basics/__brick__/lib/main.dart

---------

Co-authored-by: Lukas Klingsbo <[email protected]>
  • Loading branch information
luanpotter and spydon authored Dec 8, 2023
1 parent fb5f1fa commit 8117a51
Show file tree
Hide file tree
Showing 14 changed files with 199 additions and 192 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ cd test

To run all tests. Always make sure the build is green.

You will need to install the bash testing framework [bats](https://bats-core.readthedocs.io/en/stable/installation.html).

In order to run the application locally, run

```bash
Expand Down
43 changes: 21 additions & 22 deletions bricks/basics/__brick__/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import 'dart:math';

import 'package:flame/components.dart';
import 'package:flame/events.dart';
import 'package:flame/game.dart';
import 'package:flame/input.dart';
import 'package:flame/palette.dart';
import 'package:flutter/material.dart';

Expand All @@ -12,40 +12,39 @@ void main() {
runApp(GameWidget(game: MyGame()));
}

class MyComponent extends PositionComponent with HasGameRef<MyGame> {
static final _paint = BasicPalette.white.paint();
final Vector2 speed = Vector2.zero();
class MyGame extends FlameGame with TapCallbacks {
late final MyComponent myComponent;

@override
@override
Future<void> onLoad() async {
anchor = Anchor.center;
position = gameRef.size / 2;
}

@override
void render(Canvas c) {
c.drawRect(size.toRect(), _paint);
await world.add(myComponent = MyComponent());
return super.onLoad();
}

@override
void update(double dt) {
position += speed * dt;
void onTapUp(TapUpEvent event) {
myComponent.speed.x = -1 + 2 * _rng.nextDouble();
myComponent.speed.y = -1 + 2 * _rng.nextDouble();
}
}

class MyGame extends FlameGame with TapDetector {
late final MyComponent myComponent;
class MyComponent extends PositionComponent with HasGameReference<MyGame> {
static final _paint = BasicPalette.white.paint();
final Vector2 speed = Vector2.zero();

MyComponent()
: super(
anchor: Anchor.center,
size: Vector2.all(32),
);

@override
Future<void> onLoad() async {
await add(myComponent = MyComponent());
return super.onLoad();
void render(Canvas c) {
c.drawRect(size.toRect(), _paint);
}

@override
void onTap() {
myComponent.speed.x = -5 + 10 * _rng.nextDouble();
myComponent.speed.y = -5 + 10 * _rng.nextDouble();
void update(double dt) {
position += speed * 32.0 * dt;
}
}
8 changes: 4 additions & 4 deletions bricks/basics/__brick__/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ version: {{version}}
publish_to: 'none'

environment:
sdk: ">=2.17.0 <3.0.0"
sdk: ">=3.0.0 <4.0.0"

dependencies:
flutter:
sdk: flutter{{#extra-dependencies}}
dependencies:{{#extra-dependencies}}
{{name}}: {{version}}{{/extra-dependencies}}
flutter:
sdk: flutter

dev_dependencies:{{#extra-dev-dependencies}}
{{name}}: {{version}}{{/extra-dev-dependencies}}
Expand Down
43 changes: 21 additions & 22 deletions bricks/example/__brick__/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import 'dart:math';

import 'package:flame/components.dart';
import 'package:flame/events.dart';
import 'package:flame/game.dart';
import 'package:flame/input.dart';
import 'package:flame/palette.dart';
import 'package:flutter/material.dart';

Expand All @@ -12,40 +12,39 @@ void main() {
runApp(GameWidget(game: MyGame()));
}

class MyComponent extends PositionComponent with HasGameRef<MyGame> {
static final _paint = BasicPalette.white.paint();
final Vector2 speed = Vector2.zero();
class MyGame extends FlameGame with TapCallbacks {
late final MyComponent myComponent;

@override
@override
Future<void> onLoad() async {
anchor = Anchor.center;
position = gameRef.size / 2;
}

@override
void render(Canvas c) {
c.drawRect(size.toRect(), _paint);
await world.add(myComponent = MyComponent());
return super.onLoad();
}

@override
void update(double dt) {
position += speed * dt;
void onTapUp(TapUpEvent event) {
myComponent.speed.x = -1 + 2 * _rng.nextDouble();
myComponent.speed.y = -1 + 2 * _rng.nextDouble();
}
}

class MyGame extends FlameGame with TapDetector {
late final MyComponent myComponent;
class MyComponent extends PositionComponent with HasGameRef<MyGame> {
static final _paint = BasicPalette.white.paint();
final Vector2 speed = Vector2.zero();

MyComponent()
: super(
anchor: Anchor.center,
size: Vector2.all(32),
);

@override
Future<void> onLoad() async {
await add(myComponent = MyComponent());
return super.onLoad();
void render(Canvas c) {
c.drawRect(size.toRect(), _paint);
}

@override
void onTap() {
myComponent.speed.x = -5 + 10 * _rng.nextDouble();
myComponent.speed.y = -5 + 10 * _rng.nextDouble();
void update(double dt) {
position += speed * 32.0 * dt;
}
}
8 changes: 4 additions & 4 deletions bricks/example/__brick__/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ version: {{version}}
publish_to: 'none'

environment:
sdk: ">=2.17.0 <3.0.0"
sdk: ">=3.0.0 <4.0.0"

dependencies:
flutter:
sdk: flutter{{#extra-dependencies}}
dependencies:{{#extra-dependencies}}
{{name}}: {{version}}{{/extra-dependencies}}
flutter:
sdk: flutter

dev_dependencies:{{#extra-dev-dependencies}}
{{name}}: {{version}}{{/extra-dev-dependencies}}
Expand Down
8 changes: 4 additions & 4 deletions bricks/simple/__brick__/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ version: {{version}}
publish_to: 'none'

environment:
sdk: ">=2.17.0 <3.0.0"
sdk: ">=3.0.0 <4.0.0"

dependencies:
flutter:
sdk: flutter{{#extra-dependencies}}
dependencies:{{#extra-dependencies}}
{{name}}: {{version}}{{/extra-dependencies}}
flutter:
sdk: flutter

dev_dependencies:{{#extra-dev-dependencies}}
{{name}}: {{version}}{{/extra-dev-dependencies}}
Expand Down
2 changes: 2 additions & 0 deletions lib/commands/create_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,11 @@ Future<void> createCommand(ArgResults command) async {
'description': 'A simple Flame game.',
'version': '0.1.0',
'extra-dependencies': dependencies
.sortedBy((e) => e.name)
.map((package) => package.toMustache(versions, flameVersion))
.toList(),
'extra-dev-dependencies': devDependencies
.sortedBy((e) => e.name)
.map((package) => package.toMustache(versions, flameVersion))
.toList(),
};
Expand Down
2 changes: 1 addition & 1 deletion lib/templates/bricks/basics_bundle.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/templates/bricks/example_bundle.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 8117a51

Please sign in to comment.