From 9d74a01f045545627ebc9f2e3491369d27cc76dd Mon Sep 17 00:00:00 2001 From: Karl Pannek Date: Sat, 19 Jul 2025 00:01:48 +0200 Subject: [PATCH] Enable pointer lock filters and disable them when debug draw is on - Enable ENABLE_POINTER_LOCK_FILTER in Settings.js - Add debug mode check in onPointerLockChange to disable filters when debug is on - Add onToggleDebugMode override to remove active filters when debug is enabled - Reduce debug draw line thickness to 0.25 for cleaner visualization --- app/Game/Client/View/Pixi/PlanckDebugDraw.js | 4 ++-- app/Game/Client/View/Pixi/View.js | 16 ++++++++++++++++ app/Game/Config/Settings.js | 2 +- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/app/Game/Client/View/Pixi/PlanckDebugDraw.js b/app/Game/Client/View/Pixi/PlanckDebugDraw.js index 430f793..cb66d39 100644 --- a/app/Game/Client/View/Pixi/PlanckDebugDraw.js +++ b/app/Game/Client/View/Pixi/PlanckDebugDraw.js @@ -65,7 +65,7 @@ function (Settings, PIXI) { fillColor = 0x0000FF; // Blue for kinematic bodies lineColor = 0x0000FF; // Blue stroke } - lineWidth = 1; + lineWidth = 0.25; } this.drawShape(shape, transform, isSensor, fillColor, lineColor, lineWidth); @@ -190,7 +190,7 @@ function (Settings, PIXI) { var size = 0.05; // Made much smaller (was 0.2) // Draw a cross at the center of mass - this.graphics.lineStyle(1, 0xFFFF00); // Yellow color for center of mass + this.graphics.lineStyle(0.25, 0xFFFF00); // Yellow color for center of mass // Horizontal line this.graphics.moveTo((centerX - size) * this.scale, centerY * this.scale); diff --git a/app/Game/Client/View/Pixi/View.js b/app/Game/Client/View/Pixi/View.js index d7c7f11..e4b906a 100755 --- a/app/Game/Client/View/Pixi/View.js +++ b/app/Game/Client/View/Pixi/View.js @@ -142,6 +142,9 @@ function (Parent, domController, PIXI, Settings, nc, Exception, GameStats, Layer PixiView.prototype.onPointerLockChange = function(isLocked, options) { if (!Settings.ENABLE_POINTER_LOCK_FILTER) return; + // Disable pointer lock filters when debug mode is on + if (this.debugMode) return; + if(isLocked) { this.removeFilters(this.pointerLockFilters); @@ -297,6 +300,19 @@ function (Parent, domController, PIXI, Settings, nc, Exception, GameStats, Layer return textures; }; + PixiView.prototype.onToggleDebugMode = function(debugMode) { + // Call parent method first + Parent.prototype.onToggleDebugMode.call(this, debugMode); + + // Remove pointer lock filters when debug mode is enabled + if (debugMode && this.pointerLockFilters) { + this.removeFilters(this.pointerLockFilters); + if (this.clickToEnable) { + this.clickToEnable.visible = false; + } + } + }; + PixiView.prototype.destroy = function() { this.layerManager.destroy(); // also calls all layers destroy diff --git a/app/Game/Config/Settings.js b/app/Game/Config/Settings.js index eaed122..697562b 100755 --- a/app/Game/Config/Settings.js +++ b/app/Game/Config/Settings.js @@ -39,7 +39,7 @@ function () { VIEW_CONTROLLER: 0 ? "Three" : "Pixi", ARROW_GLIDE: 20, // % of the way per frame SHOW_LAYER_INFO: false, - ENABLE_POINTER_LOCK_FILTER: false, + ENABLE_POINTER_LOCK_FILTER: true, DEBUG_DRAW_SENSORS: true, // GAME PLAY