mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
- Removed separate canvas overlay system - Integrated PlanckDebugDraw with PIXI.Graphics - Debug draw now renders directly to debugLayer.graphics - Simplified Engine.js by removing camera position methods - All physics debug visualization now uses the layer system - Cleaner, more integrated architecture - Debug checkbox controls single PIXI layer visibility
62 lines
No EOL
1.5 KiB
JavaScript
Executable file
62 lines
No EOL
1.5 KiB
JavaScript
Executable file
define([
|
|
"Game/Core/Physics/Engine",
|
|
"Game/Config/Settings",
|
|
"Game/Client/View/DomController",
|
|
"Lib/Vendor/Planck",
|
|
"Lib/Utilities/NotificationCenter",
|
|
"Game/Client/View/Pixi/PlanckDebugDraw",
|
|
"Game/Client/View/Pixi/Layers/Debug"
|
|
],
|
|
|
|
function (Parent, Settings, domController, Box2D, nc, PlanckDebugDraw, debugLayer) {
|
|
|
|
"use strict";
|
|
|
|
function Engine () {
|
|
Parent.call(this);
|
|
|
|
this.debugMode = false;
|
|
|
|
nc.on(nc.ns.client.view.debugMode.toggle, this.onToggleDebugMode, this);
|
|
}
|
|
|
|
Engine.prototype = Object.create(Parent.prototype);
|
|
|
|
Engine.prototype.onToggleDebugMode = function(debugMode) {
|
|
this.debugMode = debugMode;
|
|
|
|
if(!this.debugDraw) {
|
|
this.setupDebugDraw();
|
|
}
|
|
|
|
debugLayer.container.visible = this.debugMode;
|
|
};
|
|
|
|
Engine.prototype.setupDebugDraw = function () {
|
|
// Use the PIXI debug layer instead of creating a canvas overlay
|
|
this.debugDraw = new PlanckDebugDraw(debugLayer.graphics);
|
|
};
|
|
|
|
Engine.prototype.renderDebug = function () {
|
|
if (this.debugDraw && this.debugMode) {
|
|
this.debugDraw.clear();
|
|
this.debugDraw.drawWorld(this.world);
|
|
}
|
|
};
|
|
|
|
|
|
|
|
Engine.prototype.setGameController = function(gameController) {
|
|
this.gameController = gameController;
|
|
};
|
|
|
|
Engine.prototype.update = function () {
|
|
Parent.prototype.update.call(this);
|
|
|
|
if(this.debugMode && this.debugDraw) {
|
|
this.debugDraw.drawWorld(this.world);
|
|
}
|
|
};
|
|
|
|
return Engine;
|
|
}); |