mirror of https://github.com/flutter/pinball.git
feat(sandbox): adds sandbox for all `FlutterForest `components (#167)
* feat(sandbox): included sandbox for FlutterSignPost * feat(sandbox): included SmallDashNestBumperspull/171/head
parent
502babf38e
commit
31afa08fc1
@ -1,17 +0,0 @@
|
||||
import 'package:dashbook/dashbook.dart';
|
||||
import 'package:flame/game.dart';
|
||||
import 'package:sandbox/common/common.dart';
|
||||
import 'package:sandbox/stories/ball/basic_ball_game.dart';
|
||||
import 'package:sandbox/stories/dash_nest_bumper/big_dash_nest_bumper_game.dart';
|
||||
|
||||
void addDashNestBumperStories(Dashbook dashbook) {
|
||||
dashbook.storiesOf('Dash Nest Bumpers').add(
|
||||
'Big',
|
||||
(context) => GameWidget(
|
||||
game: BigDashNestBumperGame()
|
||||
..trace = context.boolProperty('Trace', true),
|
||||
),
|
||||
codeLink: buildSourceLink('dash_nest_bumper/big.dart'),
|
||||
info: BasicBallGame.info,
|
||||
);
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
import 'dart:async';
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:flame_forge2d/flame_forge2d.dart';
|
||||
import 'package:pinball_components/pinball_components.dart';
|
||||
import 'package:sandbox/common/common.dart';
|
||||
import 'package:sandbox/stories/ball/basic_ball_game.dart';
|
||||
|
||||
class FlutterSignPostGame extends BasicBallGame with Traceable {
|
||||
FlutterSignPostGame() : super(color: const Color(0xFF0000FF));
|
||||
|
||||
static const info = '''
|
||||
Shows how a FlutterSignPost is rendered.
|
||||
|
||||
- Activate the "trace" parameter to overlay the body.
|
||||
''';
|
||||
|
||||
@override
|
||||
Future<void> onLoad() async {
|
||||
await super.onLoad();
|
||||
camera.followVector2(Vector2.zero());
|
||||
await add(FlutterSignPost()..priority = 1);
|
||||
await traceAllBodies();
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
import 'dart:async';
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:flame_forge2d/flame_forge2d.dart';
|
||||
import 'package:pinball_components/pinball_components.dart';
|
||||
import 'package:sandbox/common/common.dart';
|
||||
import 'package:sandbox/stories/ball/basic_ball_game.dart';
|
||||
|
||||
class SmallDashNestBumperAGame extends BasicBallGame with Traceable {
|
||||
SmallDashNestBumperAGame() : super(color: const Color(0xFF0000FF));
|
||||
|
||||
static const info = '''
|
||||
Shows how a SmallDashNestBumper ("a") is rendered.
|
||||
|
||||
- Activate the "trace" parameter to overlay the body.
|
||||
''';
|
||||
|
||||
@override
|
||||
Future<void> onLoad() async {
|
||||
await super.onLoad();
|
||||
camera.followVector2(Vector2.zero());
|
||||
await add(SmallDashNestBumper.a()..priority = 1);
|
||||
await traceAllBodies();
|
||||
await traceAllBodies();
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
import 'dart:async';
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:flame_forge2d/flame_forge2d.dart';
|
||||
import 'package:pinball_components/pinball_components.dart';
|
||||
import 'package:sandbox/common/common.dart';
|
||||
import 'package:sandbox/stories/ball/basic_ball_game.dart';
|
||||
|
||||
class SmallDashNestBumperBGame extends BasicBallGame with Traceable {
|
||||
SmallDashNestBumperBGame() : super(color: const Color(0xFF0000FF));
|
||||
|
||||
static const info = '''
|
||||
Shows how a SmallDashNestBumper ("b") is rendered.
|
||||
|
||||
- Activate the "trace" parameter to overlay the body.
|
||||
''';
|
||||
|
||||
@override
|
||||
Future<void> onLoad() async {
|
||||
await super.onLoad();
|
||||
camera.followVector2(Vector2.zero());
|
||||
await add(SmallDashNestBumper.b()..priority = 1);
|
||||
await traceAllBodies();
|
||||
await traceAllBodies();
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
import 'package:dashbook/dashbook.dart';
|
||||
import 'package:flame/game.dart';
|
||||
import 'package:sandbox/common/common.dart';
|
||||
import 'package:sandbox/stories/flutter_forest/big_dash_nest_bumper_game.dart';
|
||||
import 'package:sandbox/stories/flutter_forest/flutter_sign_post_game.dart';
|
||||
import 'package:sandbox/stories/flutter_forest/small_dash_nest_bumper_a_game.dart';
|
||||
import 'package:sandbox/stories/flutter_forest/small_dash_nest_bumper_b_game.dart';
|
||||
|
||||
void addDashNestBumperStories(Dashbook dashbook) {
|
||||
dashbook.storiesOf('Flutter Forest')
|
||||
..add(
|
||||
'Flutter Sign Post',
|
||||
(context) => GameWidget(
|
||||
game: FlutterSignPostGame()
|
||||
..trace = context.boolProperty('Trace', true),
|
||||
),
|
||||
codeLink: buildSourceLink('flutter_forest/flutter_sign_post.dart'),
|
||||
info: FlutterSignPostGame.info,
|
||||
)
|
||||
..add(
|
||||
'Big Dash Nest Bumper',
|
||||
(context) => GameWidget(
|
||||
game: BigDashNestBumperGame()
|
||||
..trace = context.boolProperty('Trace', true),
|
||||
),
|
||||
codeLink: buildSourceLink('flutter_forest/big_dash_nest_bumper.dart'),
|
||||
info: BigDashNestBumperGame.info,
|
||||
)
|
||||
..add(
|
||||
'Small Dash Nest Bumper A',
|
||||
(context) => GameWidget(
|
||||
game: SmallDashNestBumperAGame()
|
||||
..trace = context.boolProperty('Trace', true),
|
||||
),
|
||||
codeLink: buildSourceLink('flutter_forest/small_dash_nest_bumper_a.dart'),
|
||||
info: SmallDashNestBumperAGame.info,
|
||||
)
|
||||
..add(
|
||||
'Small Dash Nest Bumper B',
|
||||
(context) => GameWidget(
|
||||
game: SmallDashNestBumperBGame()
|
||||
..trace = context.boolProperty('Trace', true),
|
||||
),
|
||||
codeLink: buildSourceLink('flutter_forest/small_dash_nest_bumper_b.dart'),
|
||||
info: SmallDashNestBumperBGame.info,
|
||||
);
|
||||
}
|
Loading…
Reference in new issue