From 1da729097f87b7cf9a8fafd5b312dc7b4ca3ced1 Mon Sep 17 00:00:00 2001 From: Erik Onarheim Date: Mon, 1 Jan 2024 12:12:34 -0600 Subject: [PATCH] change: Consolidate debug geometry settings --- CHANGELOG.md | 1 + src/engine/Debug/Debug.ts | 6 +----- src/engine/TileMap/IsometricMap.ts | 15 +++++++++------ src/engine/TileMap/TileMap.ts | 8 ++++++-- 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aea52ec80..b2070eff3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). ### Changed +- All debug geometry settings are controlled from debug.collider now - Removed dunder prefixed parameters from overrideable methods - Tweaked debug draw to be less noisy by default - Removed dependency on `ex.IsometricMap` in the `ex.IsometricEntityComponent`, this allows for greater flexibility when using the component when a map may not be known or constructed. diff --git a/src/engine/Debug/Debug.ts b/src/engine/Debug/Debug.ts index 09460943c..b1e5466da 100644 --- a/src/engine/Debug/Debug.ts +++ b/src/engine/Debug/Debug.ts @@ -359,7 +359,6 @@ export class Debug implements DebugFlags { showSolidBounds: false, solidBoundsColor: Color.fromHex('#8080807F'), // grayish showColliderGeometry: true, - colliderGeometryColor: Color.Green, showQuadTree: false }; @@ -371,10 +370,7 @@ export class Debug implements DebugFlags { showGrid: false, gridColor: Color.Red, gridWidth: 1, - showColliders: true, - colliderColor: Color.Green, - colliderLineWidth: 1, - colliderPointSize: .5 + showColliderGeometry: true }; } diff --git a/src/engine/TileMap/IsometricMap.ts b/src/engine/TileMap/IsometricMap.ts index 112e44c60..abe8b42a3 100644 --- a/src/engine/TileMap/IsometricMap.ts +++ b/src/engine/TileMap/IsometricMap.ts @@ -443,11 +443,14 @@ export class IsometricMap extends Entity { showGrid, gridColor, gridWidth, - showColliders, - colliderColor, - colliderLineWidth, - colliderPointSize + showColliderGeometry } = debugFlags.isometric; + + const { + geometryColor, + geometryLineWidth, + geometryPointSize + } = debugFlags.collider; gfx.save(); gfx.z = this._getMaxZIndex() + 0.5; if (showAll || showGrid) { @@ -469,10 +472,10 @@ export class IsometricMap extends Entity { gfx.drawCircle(this.tileToWorld(vec(tile.x, tile.y)), positionSize, positionColor); } } - if (showAll || showColliders) { + if (showAll || showColliderGeometry) { for (const tile of this.tiles) { for (const collider of tile.getColliders()) { - collider.debug(gfx, colliderColor, { lineWidth: colliderLineWidth, pointSize: colliderPointSize }); + collider.debug(gfx, geometryColor, { lineWidth: geometryLineWidth, pointSize: geometryPointSize }); } } } diff --git a/src/engine/TileMap/TileMap.ts b/src/engine/TileMap/TileMap.ts index 9acf18982..043157696 100644 --- a/src/engine/TileMap/TileMap.ts +++ b/src/engine/TileMap/TileMap.ts @@ -535,9 +535,13 @@ export class TileMap extends Entity { showSolidBounds: showColliderBounds, solidBoundsColor: colliderBoundsColor, showColliderGeometry, - colliderGeometryColor, showQuadTree } = debugFlags.tilemap; + const { + geometryColor, + geometryLineWidth, + geometryPointSize + } = debugFlags.collider; const width = this.tileWidth * this.columns * this.scale.x; const height = this.tileHeight * this.rows * this.scale.y; const pos = this.pos; @@ -568,7 +572,7 @@ export class TileMap extends Entity { gfx.restore(); if (showColliderGeometry) { for (const collider of colliders) { - collider.debug(gfx, colliderGeometryColor); + collider.debug(gfx, geometryColor, { lineWidth: geometryLineWidth, pointSize: geometryPointSize }); } } }