Skip to content

Commit

Permalink
Update changelog + docs
Browse files Browse the repository at this point in the history
  • Loading branch information
eonarheim committed Sep 11, 2021
1 parent c7ead3a commit 9bd6073
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 1 deletion.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Expand Up @@ -7,6 +7,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).

### Breaking Changes

- `ex.Physics.debug` properties for Debug drawing are now moved to `engine.debug.physics`, `engine.debug.collider`, and `engine.debug.body`.
- Old `debugDraw(ctx: CanvasRenderingContext2D)` methods are removed.
- Collision `Pair`'s are now between Collider's and not bodies
- `PerlinNoise` has been removed from the core repo will now be offered as a [plugin](https://github.com/excaliburjs/excalibur-perlin)
- Legacy drawing implementations are moved behind `ex.LegacyDrawing` new Graphics implemenations of `Sprite`, `SpriteSheet`, `Animation` are now the default import.
Expand Down Expand Up @@ -36,7 +38,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- Removes `Entity.components` as a way to access, add, and remove components
- Camera.z has been renamed to property `zoom` which is the zoom factor
- Camera.zoom(...) has been renamed to function `zoomOverTime()`
- TileMap no longer needs registered SpriteSheets, `Sprite`'s can be added directly to `Cell`'s with `addSprite`
- TileMap no longer needs registered SpriteSheets, `Sprite`'s can be added directly to `Cell`'s with `addGraphic`
- The confusing `TileSprite` type is removed (Related to TileMap plugin updates https://github.com/excaliburjs/excalibur-tiled/issues/4, https://github.com/excaliburjs/excalibur-tiled/issues/23, https://github.com/excaliburjs/excalibur-tiled/issues/108)
- Directly changing debug drawing by `engine.isDebug = value` has been replaced by `engine.showDebug(value)` and `engine.toggleDebug()` ([#1655](https://github.com/excaliburjs/Excalibur/issues/1655))
- `UIActor` Class instances need to be replaced to `ScreenElement` (This Class it's marked as Obsolete) ([#1656](https://github.com/excaliburjs/Excalibur/issues/1656))
Expand All @@ -55,6 +57,10 @@ This project adheres to [Semantic Versioning](http://semver.org/).

### Added

- The `ExcaliburGraphicsContext` now supports drawing debug text
- `Entity` may also now optionally have a `name`, this is useful for finding entities by name or when displaying in debug mode.
- New `DebugSystem` ECS system will show debug drawing output for things toggled on/off in the `engine.debug` section, this allows for a less cluttered debug experience.
- Each debug section now has a configurable color.
- Turn on WebGL support with `ex.Flags.useWebGL()`
- Added new helpers to `CollisionGroup` to define groups that collide with specified groups `CollisionGroup.collidesWith([groupA, groupB])`
- Combine groups with `const groupAandB = CollisionGroup.combine([groupA, groupB])`
Expand Down
36 changes: 36 additions & 0 deletions src/engine/Debug/Debug.ts
Expand Up @@ -183,18 +183,36 @@ export class Debug implements DebugFlags {
*/
public colorBlindMode: ColorBlindFlags;

/**
* Filter debug context to named entities or entity ids
*/
public filter: { useFilter: boolean; nameQuery: string; ids: number[] } = {
/**
* Toggle filter on or off (default off) must be on for DebugDraw to use filters
*/
useFilter: false,
/**
* Query for entities by name, if the entity name contains `nameQuery` it will be included
*/
nameQuery: '',
/**
* Query for Entity ids, if the id matches it will be included
*/
ids: []
};

/**
* Entity debug settings
*/
public entity = {
showAll: false,
showId: true,
showName: false
};

/**
* Transform component debug settings
*/
public transform = {
showAll: false,

Expand All @@ -208,13 +226,19 @@ export class Debug implements DebugFlags {
rotationColor: Color.Blue
};

/**
* Graphics component debug settings
*/
public graphics = {
showAll: false,

showBounds: true,
boundsColor: Color.Yellow
};

/**
* Collider component debug settings
*/
public collider = {
showAll: false,

Expand All @@ -227,6 +251,9 @@ export class Debug implements DebugFlags {
geometryColor: Color.Green
};

/**
* Physics simulation debug settings
*/
public physics = {
showAll: false,

Expand All @@ -239,6 +266,9 @@ export class Debug implements DebugFlags {
collisionContactColor: Color.Red
};

/**
* Motion component debug settings
*/
public motion = {
showAll: false,

Expand All @@ -249,6 +279,9 @@ export class Debug implements DebugFlags {
accelerationColor: Color.Red
};

/**
* Body component debug settings
*/
public body = {
showAll: false,

Expand All @@ -259,6 +292,9 @@ export class Debug implements DebugFlags {
showMass: false
};

/**
* Camera debug settings
*/
public camera = {
showAll: false,

Expand Down
9 changes: 9 additions & 0 deletions src/engine/Graphics/Context/debug-text.ts
Expand Up @@ -2,6 +2,9 @@ import { ExcaliburGraphicsContext, ImageSource, SpriteFont, SpriteSheet } from '
import { Vector } from '../..';
import debugFont from './debug-font.png';

/**
* Internal debugtext helper
*/
export class DebugText {
constructor() {
this.load();
Expand Down Expand Up @@ -36,6 +39,12 @@ export class DebugText {
});
}

/**
* Writes debug text using the built in sprint font
* @param ctx
* @param text
* @param pos
*/
public write(ctx: ExcaliburGraphicsContext, text: string, pos: Vector) {
if (this._imageSource.isLoaded()) {
this._spriteFont.render(ctx, text, pos.x, pos.y);
Expand Down

0 comments on commit 9bd6073

Please sign in to comment.