mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
Added debug canvas and webgl render canvas, added viewcontroller
This commit is contained in:
parent
486cb4f312
commit
dd71bf79a9
9 changed files with 224 additions and 109 deletions
6
lib/Chuck/Physics/Engine.js
Normal file → Executable file
6
lib/Chuck/Physics/Engine.js
Normal file → Executable file
|
|
@ -1,4 +1,4 @@
|
|||
define(["Chuck/Settings", "Vendor/Box2D", "Chuck/Collision/Detector"], function(Settings, Box2D, CollisionDetector){
|
||||
define(["Chuck/Settings", "Client/Dom", "Vendor/Box2D", "Chuck/Collision/Detector"], function(Settings, Dom, Box2D, CollisionDetector){
|
||||
|
||||
function Engine () {
|
||||
this.world;
|
||||
|
|
@ -8,7 +8,7 @@ define(["Chuck/Settings", "Vendor/Box2D", "Chuck/Collision/Detector"], function(
|
|||
Engine.prototype.init = function() {
|
||||
this.world = new Box2D.Dynamics.b2World(new Box2D.Common.Math.b2Vec2(0, Settings.BOX2D_GRAVITY), Settings.BOX2D_ALLOW_SLEEP);
|
||||
|
||||
if(Settings.IS_BROWSER_ENVIRONMENT) {
|
||||
if(Settings.IS_BROWSER_ENVIRONMENT && Settings.DEBUG_MODE) {
|
||||
this.setupDebugDraw();
|
||||
}
|
||||
}
|
||||
|
|
@ -25,7 +25,7 @@ define(["Chuck/Settings", "Vendor/Box2D", "Chuck/Collision/Detector"], function(
|
|||
|
||||
Engine.prototype.setupDebugDraw = function() {
|
||||
//var debugSprite = Settings.DEBUG_DRAW_CANVAS_SPRITE;
|
||||
var debugSprite = document.getElementById("canvas").getContext("2d");
|
||||
var debugSprite = Dom.getDebugCanvas().getContext("2d");
|
||||
|
||||
// set debug draw
|
||||
var debugDraw = new Box2D.Dynamics.b2DebugDraw();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue