mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
cleanup debug canvas #36
This commit is contained in:
parent
8dacc83f7a
commit
f4c7d9edeb
4 changed files with 21 additions and 60 deletions
|
|
@ -11,21 +11,7 @@ function (Box2D, Debug) {
|
|||
|
||||
function DebugDraw() {
|
||||
Parent.call(this);
|
||||
|
||||
|
||||
this.m_drawScale = 1;
|
||||
|
||||
this.m_sprite = {
|
||||
graphics: {
|
||||
clear: function () {
|
||||
Debug.graphics.clear();
|
||||
Debug.graphics.lineStyle(1, 0x00ff00 , 0.8);
|
||||
|
||||
//__this.m_ctx.clearRect(0, 0, __this.m_ctx.canvas.width, __this.m_ctx.canvas.height)
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
DebugDraw.prototype = Object.create(Parent.prototype);
|
||||
|
|
@ -33,18 +19,27 @@ function (Box2D, Debug) {
|
|||
DebugDraw.prototype.setColor = function(color) {
|
||||
this.m_ctx.debugColor = color.color;
|
||||
this.m_ctx.debugFillAlpha = this.m_fillAlpha;
|
||||
Debug.graphics.lineStyle(1, this.m_ctx.debugColor, this.m_alpha);
|
||||
this.m_ctx.lineStyle(1, this.m_ctx.debugColor, this.m_alpha);
|
||||
};
|
||||
|
||||
DebugDraw.prototype.SetSprite = function(sprite) {
|
||||
this.m_ctx = Debug.graphics;
|
||||
this.m_ctx = sprite;
|
||||
|
||||
this.m_sprite = {
|
||||
graphics: {
|
||||
clear: function () {
|
||||
sprite.clear();
|
||||
sprite.lineStyle(1, 0xffffff, 0.8);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.m_ctx.beginPath = function() {
|
||||
Debug.graphics.beginFill(this.debugColor, this.debugFillAlpha);
|
||||
this.beginFill(this.debugColor, this.debugFillAlpha);
|
||||
};
|
||||
|
||||
this.m_ctx.closePath = function() {
|
||||
Debug.graphics.endFill();
|
||||
this.endFill();
|
||||
};
|
||||
|
||||
this.m_ctx.fill = function() {
|
||||
|
|
@ -52,11 +47,11 @@ function (Box2D, Debug) {
|
|||
};
|
||||
|
||||
this.m_ctx.stroke = function() {
|
||||
//console.log('customStroke');
|
||||
// do nothing
|
||||
};
|
||||
|
||||
this.m_ctx.arc = function(x, y, radius, startingAngle, endingAngle, counterClockwise) {
|
||||
Debug.graphics.drawCircle(x, y, radius);
|
||||
this.drawCircle(x, y, radius);
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue