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
4b3b5eb4
Commit
4b3b5eb4
authored
Jul 29, 2015
by
Viktor Lidholt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes analyzer warnings in SpriteBox
parent
122add43
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
9 deletions
+3
-9
sprite_box.dart
packages/flutter/example/game/lib/sprite_box.dart
+3
-9
No files found.
packages/flutter/example/game/lib/sprite_box.dart
View file @
4b3b5eb4
...
@@ -48,9 +48,10 @@ class SpriteBox extends RenderBox {
...
@@ -48,9 +48,10 @@ class SpriteBox extends RenderBox {
// Tracking of frame rate and updates
// Tracking of frame rate and updates
double
_lastTimeStamp
;
double
_lastTimeStamp
;
int
_numFrames
=
0
;
double
_frameRate
=
0.0
;
double
_frameRate
=
0.0
;
double
get
frameRate
=>
_frameRate
;
// Transformation mode
// Transformation mode
SpriteBoxTransformMode
_transformMode
;
SpriteBoxTransformMode
_transformMode
;
...
@@ -342,20 +343,13 @@ class SpriteBox extends RenderBox {
...
@@ -342,20 +343,13 @@ class SpriteBox extends RenderBox {
if
(!
attached
)
if
(!
attached
)
return
;
return
;
// Calculate the time between frames in seconds
// Calculate delta and frame rate
if
(
_lastTimeStamp
==
null
)
_lastTimeStamp
=
timeStamp
;
if
(
_lastTimeStamp
==
null
)
_lastTimeStamp
=
timeStamp
;
double
delta
=
(
timeStamp
-
_lastTimeStamp
)
/
1000
;
double
delta
=
(
timeStamp
-
_lastTimeStamp
)
/
1000
;
_lastTimeStamp
=
timeStamp
;
_lastTimeStamp
=
timeStamp
;
// Count the number of frames we've been running
_numFrames
+=
1
;
_frameRate
=
1.0
/
delta
;
_frameRate
=
1.0
/
delta
;
// // Print frame rate
// if (_numFrames % 60 == 0)
// print("delta: $delta fps: $_frameRate");
_runActions
(
delta
);
_runActions
(
delta
);
_callUpdate
(
_rootNode
,
delta
);
_callUpdate
(
_rootNode
,
delta
);
...
...
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