mirror of
https://github.com/photonstorm/phaser
synced 2024-11-26 14:40:38 +00:00
Added showSensor debug option
This commit is contained in:
parent
c8b2ff5042
commit
76d2c971f7
1 changed files with 28 additions and 6 deletions
|
@ -248,6 +248,7 @@ var World = new Class({
|
|||
showJoint: GetFastValue(debugConfig, 'showJoint', true),
|
||||
showInternalEdges: GetFastValue(debugConfig, 'showInternalEdges', false),
|
||||
showConvexHulls: GetFastValue(debugConfig, 'showConvexHulls', false),
|
||||
showSensors: GetFastValue(debugConfig, 'showSensors', true),
|
||||
|
||||
renderFill: GetFastValue(debugConfig, 'renderFill', false),
|
||||
renderLine: GetFastValue(debugConfig, 'renderLine', true),
|
||||
|
@ -265,6 +266,9 @@ var World = new Class({
|
|||
sleepFillColor: GetFastValue(debugConfig, 'sleepFillColor', 0x464646),
|
||||
sleepLineColor: GetFastValue(debugConfig, 'sleepLineColor', 0x999a99),
|
||||
|
||||
sensorFillColor: GetFastValue(debugConfig, 'sensorFillColor', 0x0d177b),
|
||||
sensorLineColor: GetFastValue(debugConfig, 'sensorLineColor', 0x1327e4),
|
||||
|
||||
positionSize: GetFastValue(debugConfig, 'positionSize', 4),
|
||||
positionColor: GetFastValue(debugConfig, 'positionColor', 0xe042da),
|
||||
|
||||
|
@ -1417,6 +1421,9 @@ var World = new Class({
|
|||
|
||||
var config = this.debugConfig;
|
||||
|
||||
var sensorFillColor = config.sensorFillColor;
|
||||
var sensorLineColor = config.sensorLineColor;
|
||||
|
||||
// Handle compound parts
|
||||
var parts = body.parts;
|
||||
var partsLength = parts.length;
|
||||
|
@ -1427,7 +1434,7 @@ var World = new Class({
|
|||
var render = part.render;
|
||||
var opacity = render.opacity;
|
||||
|
||||
if (!render.visible || opacity === 0)
|
||||
if (!render.visible || opacity === 0 || (part.isSensor && !config.showSensors))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -1437,6 +1444,20 @@ var World = new Class({
|
|||
|
||||
graphics.beginPath();
|
||||
|
||||
if (part.isSensor)
|
||||
{
|
||||
if (fillColor !== null)
|
||||
{
|
||||
graphics.fillStyle(sensorFillColor, fillOpacity * opacity);
|
||||
}
|
||||
|
||||
if (lineColor !== null)
|
||||
{
|
||||
graphics.lineStyle(lineThickness, sensorLineColor, lineOpacity * opacity);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (fillColor !== null)
|
||||
{
|
||||
graphics.fillStyle(fillColor, fillOpacity * opacity);
|
||||
|
@ -1446,6 +1467,7 @@ var World = new Class({
|
|||
{
|
||||
graphics.lineStyle(lineThickness, lineColor, lineOpacity * opacity);
|
||||
}
|
||||
}
|
||||
|
||||
if (circleRadius)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue