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
fde92a69
Commit
fde92a69
authored
Oct 27, 2015
by
Viktor Lidholt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improves physics debug drawing
parent
96689dec
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
1 deletion
+15
-1
physics_world.dart
packages/flutter_sprites/lib/src/physics_world.dart
+7
-1
sprite_box.dart
packages/flutter_sprites/lib/src/sprite_box.dart
+8
-0
No files found.
packages/flutter_sprites/lib/src/physics_world.dart
View file @
fde92a69
...
...
@@ -47,6 +47,10 @@ class PhysicsWorld extends Node {
List
<
PhysicsBody
>
_bodiesScheduledForUpdate
=
<
PhysicsBody
>[];
bool
drawDebug
=
false
;
Matrix4
_debugDrawTransform
;
_PhysicsDebugDraw
_debugDraw
;
double
b2WorldToNodeConversionFactor
=
10.0
;
...
...
@@ -228,8 +232,10 @@ class PhysicsWorld extends Node {
}
void
paint
(
PaintingCanvas
canvas
)
{
if
(
drawDebug
)
{
_debugDrawTransform
=
new
Matrix4
.
fromFloat64List
(
canvas
.
getTotalMatrix
());
}
super
.
paint
(
canvas
);
paintDebug
(
canvas
);
}
void
paintDebug
(
PaintingCanvas
canvas
)
{
...
...
packages/flutter_sprites/lib/src/sprite_box.dart
View file @
fde92a69
...
...
@@ -347,6 +347,14 @@ class SpriteBox extends RenderBox {
Matrix4
totalMatrix
=
new
Matrix4
.
fromFloat64List
(
canvas
.
getTotalMatrix
());
_rootNode
.
_visit
(
canvas
,
totalMatrix
);
// Draw physics debug
for
(
PhysicsWorld
world
in
_physicsNodes
)
{
if
(
world
.
drawDebug
)
{
canvas
.
setMatrix
(
world
.
_debugDrawTransform
.
storage
);
world
.
paintDebug
(
canvas
);
}
}
canvas
.
restore
();
}
...
...
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