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
6dc4bc32
Commit
6dc4bc32
authored
Jul 29, 2015
by
Viktor Lidholt
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #345 from vlidholt/master
Fixes analyzer warnings in sprites
parents
947d505c
fbb645bb
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
7 deletions
+14
-7
game_demo_world.dart
packages/flutter/example/game/lib/game_demo_world.dart
+10
-3
node.dart
packages/flutter/example/game/lib/node.dart
+2
-2
sprite.dart
packages/flutter/example/game/lib/sprite.dart
+2
-2
No files found.
packages/flutter/example/game/lib/game_demo_world.dart
View file @
6dc4bc32
...
...
@@ -561,9 +561,10 @@ class Laser extends Sprite {
// Background starfield
class
StarField
extends
Node
{
Image
_image
;
class
StarField
extends
Node
WithSize
{
sky
.
Image
_image
;
int
_numStars
;
bool
_autoScroll
;
List
<
Point
>
_starPositions
;
List
<
double
>
_starScales
;
List
<
Rect
>
_rects
;
...
...
@@ -573,7 +574,7 @@ class StarField extends Node {
..
isAntiAlias
=
false
..
setTransferMode
(
sky
.
TransferMode
.
plus
);
StarField
(
SpriteSheet
spriteSheet
,
this
.
_numStars
)
{
StarField
(
SpriteSheet
spriteSheet
,
this
.
_numStars
,
[
this
.
_autoScroll
=
false
])
:
super
(
new
Size
(
1024.0
,
1024.0
)
)
{
_starPositions
=
[];
_starScales
=
[];
_colors
=
[];
...
...
@@ -618,6 +619,12 @@ class StarField extends Node {
_starPositions
[
i
]
=
new
Point
(
xPos
,
yPos
);
}
}
void
update
(
double
dt
)
{
if
(
_autoScroll
)
{
move
(
dt
*
100.0
,
0.0
);
}
}
}
class
Hud
extends
NodeWithSize
{
...
...
packages/flutter/example/game/lib/node.dart
View file @
6dc4bc32
...
...
@@ -416,7 +416,7 @@ class Node {
}
void
_prePaint
(
PaintingCanvas
canvas
)
{
_savedTotalMatrix
=
canvas
.
getTotalMatrix
()
;
_savedTotalMatrix
=
new
Matrix4
.
fromFloat32List
(
canvas
.
getTotalMatrix
());
;
// Get the transformation matrix and apply transform
canvas
.
concat
(
transformMatrix
.
storage
);
...
...
@@ -467,7 +467,7 @@ class Node {
}
void
_postPaint
(
PaintingCanvas
canvas
)
{
canvas
.
setMatrix
(
_savedTotalMatrix
);
canvas
.
setMatrix
(
_savedTotalMatrix
.
storage
);
}
// Receiving update calls
...
...
packages/flutter/example/game/lib/sprite.dart
View file @
6dc4bc32
...
...
@@ -68,7 +68,7 @@ class Sprite extends NodeWithSize {
void
paint
(
PaintingCanvas
canvas
)
{
// Store old matrix
Matrix4
savedMatrix
=
canvas
.
getTotalMatrix
(
);
Matrix4
savedMatrix
=
new
Matrix4
.
fromFloat32List
(
canvas
.
getTotalMatrix
()
);
// Account for pivot point
applyTransformForPivot
(
canvas
);
...
...
@@ -113,6 +113,6 @@ class Sprite extends NodeWithSize {
}
// Restore matrix
canvas
.
setMatrix
(
savedMatrix
);
canvas
.
setMatrix
(
savedMatrix
.
storage
);
}
}
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