Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
d9c743e1
Commit
d9c743e1
authored
Aug 18, 2015
by
Viktor Lidholt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes loading of assets in demo game
parent
66c2cc2a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
9 deletions
+14
-9
main.dart
examples/game/lib/main.dart
+14
-9
No files found.
examples/game/lib/main.dart
View file @
d9c743e1
...
...
@@ -45,6 +45,17 @@ main() async {
'assets/game_ui.png'
,
]));
// TODO(eseidel): SoundEffect doesn't really do anything except hold a future.
_sounds
[
'explosion'
]
=
new
SoundEffect
(
_bundle
.
load
(
'assets/explosion.wav'
));
_sounds
[
'laser'
]
=
new
SoundEffect
(
_bundle
.
load
(
'assets/laser.wav'
));
loads
.
addAll
([
_sounds
[
'explosion'
].
load
(),
_sounds
[
'laser'
].
load
(),
]);
await
Future
.
wait
(
loads
);
// TODO(eseidel): These load in serial which is bad for startup!
String
json
=
await
_bundle
.
loadString
(
'assets/sprites.json'
);
_spriteSheet
=
new
SpriteSheet
(
_imageMap
[
'assets/sprites.png'
],
json
);
...
...
@@ -54,20 +65,12 @@ main() async {
_app
=
new
GameDemoApp
();
// TODO(eseidel): SoundEffect doesn't really do anything except hold a future.
_sounds
[
'explosion'
]
=
new
SoundEffect
(
_bundle
.
load
(
'assets/explosion.wav'
));
_sounds
[
'laser'
]
=
new
SoundEffect
(
_bundle
.
load
(
'assets/laser.wav'
));
loads
.
addAll
([
_sounds
[
'explosion'
].
load
(),
_sounds
[
'laser'
].
load
(),
]);
assert
(
_spriteSheet
.
image
!=
null
);
SoundTrackPlayer
stPlayer
=
SoundTrackPlayer
.
sharedInstance
();
SoundTrack
music
=
await
stPlayer
.
load
(
_bundle
.
load
(
'assets/temp_music.aac'
));
stPlayer
.
play
(
music
);
await
Future
.
wait
(
loads
);
runApp
(
_app
);
}
...
...
@@ -245,6 +248,8 @@ class MainScreenBackground extends NodeWithSize {
sprtBackground
.
position
=
new
Point
(
512.0
,
512.0
);
addChild
(
sprtBackground
);
assert
(
_spriteSheet
.
image
!=
null
);
StarField
starField
=
new
StarField
(
_spriteSheet
,
200
,
true
);
addChild
(
starField
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment