excalibur 0.32.0-alpha.1570 → 0.32.0-alpha.1571

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -12,9 +12,33 @@ This project adheres to [Semantic Versioning](http://semver.org/).
12
12
  ### Deprecated
13
13
 
14
14
  - Legacy `EasingFunctions.*` are deprecated in favor of the simpler forms
15
+ - Legacy `ex.BoundingBox.draw(..)` is deprecated, use `ex.BoundBox.debug(...)`
15
16
 
16
17
  ### Added
17
18
 
19
+
20
+ - Added a way to configure general debug settings on text
21
+ ```typescript
22
+ class DebugConfig {
23
+ ...
24
+ public settings = {
25
+ text: {
26
+ foreground: Color.Black,
27
+ background: Color.Transparent,
28
+ border: Color.Transparent
29
+ },
30
+ z: {
31
+ text: Number.POSITIVE_INFINITY,
32
+ point: Number.MAX_SAFE_INTEGER - 1,
33
+ ray: Number.MAX_SAFE_INTEGER - 1,
34
+ dashed:Number.MAX_SAFE_INTEGER - 2,
35
+ solid: Number.MAX_SAFE_INTEGER - 3
36
+ }
37
+ }
38
+ ...
39
+ }
40
+ ```
41
+ - Added foreground and background color to `ex.DebugText`
18
42
  - Added a convenience parameter to set the initial graphics or material in an Actor
19
43
  ```typescript
20
44
  const cloudSprite = cloud.toSprite();
@@ -62,6 +86,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
62
86
 
63
87
  ### Updates
64
88
 
89
+ - Perf improvement in debug draw mode
65
90
  - When overriding a built-in uniform/graphic there is now a warning in dev excalibur builds
66
91
  - Camera zoom and move now support new easing functions form
67
92
  - MoveTo/MoveBy actions now support new easing function form
@@ -71,7 +96,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
71
96
 
72
97
  ### Changed
73
98
 
74
- -
99
+ - Debug Text Font is switched to the more legible [monogram](https://datagoblin.itch.io/monogram)
75
100
 
76
101
  <!--------------------------------- DO NOT EDIT BELOW THIS LINE --------------------------------->
77
102
  <!--------------------------------- DO NOT EDIT BELOW THIS LINE --------------------------------->
@@ -1,8 +1,7 @@
1
1
  import { Vector } from '../Math/vector';
2
2
  import type { Ray } from '../Math/ray';
3
- import { Color } from '../Color';
4
3
  import { Side } from './Side';
5
- import type { ExcaliburGraphicsContext } from '../Graphics/Context/ExcaliburGraphicsContext';
4
+ import type { ExcaliburGraphicsContext, RectGraphicsOptions } from '../Graphics/Context/ExcaliburGraphicsContext';
6
5
  import type { AffineMatrix } from '../Math/affine-matrix';
7
6
  export interface BoundingBoxOptions {
8
7
  left: number;
@@ -149,6 +148,13 @@ export declare class BoundingBox {
149
148
  * Draw a debug bounding box
150
149
  * @param ex
151
150
  * @param color
151
+ * @deprecated
152
152
  */
153
- draw(ex: ExcaliburGraphicsContext, color?: Color): void;
153
+ draw(ex: ExcaliburGraphicsContext, options?: RectGraphicsOptions): void;
154
+ /**
155
+ * Draw a debug bounding box
156
+ * @param ex
157
+ * @param color
158
+ */
159
+ debug(ex: ExcaliburGraphicsContext, options?: RectGraphicsOptions): void;
154
160
  }
@@ -151,6 +151,20 @@ export declare class DebugConfig {
151
151
  * Performance statistics
152
152
  */
153
153
  stats: DebugStats;
154
+ settings: {
155
+ text: {
156
+ foreground: Color;
157
+ background: Color;
158
+ border: Color;
159
+ };
160
+ z: {
161
+ text: number;
162
+ point: number;
163
+ ray: number;
164
+ dashed: number;
165
+ solid: number;
166
+ };
167
+ };
154
168
  /**
155
169
  * Correct or simulate color blindness using {@apilink ColorBlindnessPostProcessor}.
156
170
  * @warning Will reduce FPS.
@@ -177,7 +191,6 @@ export declare class DebugConfig {
177
191
  */
178
192
  transform: {
179
193
  showAll: boolean;
180
- debugZIndex: number;
181
194
  showPosition: boolean;
182
195
  showPositionLabel: boolean;
183
196
  positionColor: Color;
@@ -113,9 +113,13 @@ export interface ExcaliburGraphicsContextState {
113
113
  }
114
114
  export interface LineGraphicsOptions {
115
115
  color?: Color;
116
+ dashed?: boolean;
117
+ lineWidth?: number;
116
118
  }
117
119
  export interface RectGraphicsOptions {
118
120
  color?: Color;
121
+ dashed?: boolean;
122
+ lineWidth?: number;
119
123
  }
120
124
  export interface PointGraphicsOptions {
121
125
  color: Color;
@@ -144,6 +148,15 @@ export interface DebugDraw {
144
148
  * @param pointOptions
145
149
  */
146
150
  drawPoint(point: Vector, pointOptions?: PointGraphicsOptions): void;
151
+ /**
152
+ * Draw a circle to the Excalibur Graphics context
153
+ * @param pos
154
+ * @param radius
155
+ * @param color
156
+ * @param stroke Optionally specify the stroke color
157
+ * @param thickness
158
+ */
159
+ drawCircle(pos: Vector, radius: number, color: Color, stroke?: Color, thickness?: number): void;
147
160
  /**
148
161
  * Draw debug text
149
162
  * @param text
@@ -3,7 +3,7 @@ import type { Vector } from '../../Math/vector';
3
3
  import { Color } from '../../Color';
4
4
  import type { Resolution } from '../../Screen';
5
5
  import type { PostProcessor } from '../PostProcessor/PostProcessor';
6
- import type { AffineMatrix } from '../../Math/affine-matrix';
6
+ import { AffineMatrix } from '../../Math/affine-matrix';
7
7
  import type { Material, MaterialOptions } from './material';
8
8
  declare class ExcaliburGraphicsContext2DCanvasDebug implements DebugDraw {
9
9
  private _ex;
@@ -19,6 +19,7 @@ declare class ExcaliburGraphicsContext2DCanvasDebug implements DebugDraw {
19
19
  drawRect(x: number, y: number, width: number, height: number): void;
20
20
  drawLine(start: Vector, end: Vector, lineOptions?: LineGraphicsOptions): void;
21
21
  drawPoint(point: Vector, pointOptions?: PointGraphicsOptions): void;
22
+ drawCircle(pos: Vector, radius: number, color: Color, stroke?: Color, thickness?: number): void;
22
23
  drawText(text: string, pos: Vector): void;
23
24
  }
24
25
  export interface ExcaliburGraphicsContext2DOptions extends ExcaliburGraphicsContextOptions {
@@ -20,7 +20,9 @@ declare class ExcaliburGraphicsContextWebGLDebug implements DebugDraw {
20
20
  private _debugText;
21
21
  constructor(_webglCtx: ExcaliburGraphicsContextWebGL);
22
22
  /**
23
- * Draw a debugging rectangle to the context
23
+ * Draw a debugging rectangle to the graphics context
24
+ *
25
+ * Debugging draws are independent of scale/zoom
24
26
  * @param x
25
27
  * @param y
26
28
  * @param width
@@ -28,18 +30,33 @@ declare class ExcaliburGraphicsContextWebGLDebug implements DebugDraw {
28
30
  */
29
31
  drawRect(x: number, y: number, width: number, height: number, rectOptions?: RectGraphicsOptions): void;
30
32
  /**
31
- * Draw a debugging line to the context
33
+ * Draw a debugging line to the graphics context
34
+ *
35
+ * Debugging draws are independent of scale/zoom
32
36
  * @param start
33
37
  * @param end
34
38
  * @param lineOptions
35
39
  */
36
40
  drawLine(start: Vector, end: Vector, lineOptions?: LineGraphicsOptions): void;
37
41
  /**
38
- * Draw a debugging point to the context
42
+ * Draw a debugging point to the graphics context
43
+ *
44
+ * Debugging draws are independent of scale/zoom
39
45
  * @param point
40
46
  * @param pointOptions
41
47
  */
42
48
  drawPoint(point: Vector, pointOptions?: PointGraphicsOptions): void;
49
+ /**
50
+ * Draw a debugging circle to the graphics context
51
+ *
52
+ * Debugging draws are independent of scale/zoom
53
+ */
54
+ drawCircle(pos: Vector, radius: number, color: Color, stroke?: Color, thickness?: number): void;
55
+ /**
56
+ * Draw some debugging text to the graphics context
57
+ *
58
+ * Debugging draws are independent of scale/zoom
59
+ */
43
60
  drawText(text: string, pos: Vector): void;
44
61
  }
45
62
  export interface WebGLGraphicsContextInfo {
@@ -0,0 +1,23 @@
1
+ import { Color } from '../../../Color';
2
+ import type { Vector } from '../../../Math/vector';
3
+ import type { ExcaliburGraphicsContextWebGL } from '../ExcaliburGraphicsContextWebGL';
4
+ import type { RendererPlugin } from '../renderer';
5
+ export declare class DebugCircleRenderer implements RendererPlugin {
6
+ readonly type = "ex.debug-circle";
7
+ priority: number;
8
+ private _maxCircles;
9
+ private _shader;
10
+ private _context;
11
+ private _gl;
12
+ private _buffer;
13
+ private _layout;
14
+ private _quads;
15
+ private _circleCount;
16
+ private _vertexIndex;
17
+ initialize(gl: WebGL2RenderingContext, context: ExcaliburGraphicsContextWebGL): void;
18
+ dispose(): void;
19
+ private _isFull;
20
+ draw(pos: Vector, radius: number, color: Color, stroke?: Color, strokeThickness?: number): void;
21
+ hasPendingDraws(): boolean;
22
+ flush(): void;
23
+ }
@@ -2,12 +2,8 @@ import type { Vector } from '../../../Math/vector';
2
2
  import type { Color } from '../../../Color';
3
3
  import type { ExcaliburGraphicsContextWebGL } from '../ExcaliburGraphicsContextWebGL';
4
4
  import type { RendererPlugin } from '../renderer';
5
- export interface LineOptions {
6
- color?: Color;
7
- width?: number;
8
- }
9
- export declare class LineRenderer implements RendererPlugin {
10
- readonly type = "ex.line";
5
+ export declare class DebugLineRenderer implements RendererPlugin {
6
+ readonly type = "ex.debug-line";
11
7
  priority: number;
12
8
  private _context;
13
9
  private _gl;
@@ -21,7 +17,9 @@ export declare class LineRenderer implements RendererPlugin {
21
17
  dispose(): void;
22
18
  private _startScratch;
23
19
  private _endScratch;
24
- draw(start: Vector, end: Vector, color: Color): void;
20
+ private _lengthSoFar;
21
+ private _currentlyDashed;
22
+ draw(start: Vector, end: Vector, color: Color, width?: number, dashed?: boolean): void;
25
23
  private _isFull;
26
24
  hasPendingDraws(): boolean;
27
25
  flush(): void;
@@ -2,8 +2,8 @@ import type { Vector } from '../../../Math/vector';
2
2
  import type { Color } from '../../../Color';
3
3
  import type { ExcaliburGraphicsContextWebGL } from '../ExcaliburGraphicsContextWebGL';
4
4
  import type { RendererPlugin } from '../renderer';
5
- export declare class PointRenderer implements RendererPlugin {
6
- readonly type = "ex.point";
5
+ export declare class DebugPointRenderer implements RendererPlugin {
6
+ readonly type = "ex.debug-point";
7
7
  priority: number;
8
8
  private _shader;
9
9
  private _maxPoints;
@@ -1,5 +1,6 @@
1
1
  import type { ExcaliburGraphicsContext } from '../Context/ExcaliburGraphicsContext';
2
2
  import type { Vector } from '../../Math/vector';
3
+ import type { Color } from '../../Color';
3
4
  /**
4
5
  * Internal debug text helper
5
6
  */
@@ -10,6 +11,9 @@ export declare class DebugText {
10
11
  */
11
12
  readonly fontSheet: string;
12
13
  size: number;
14
+ foregroundColor: Color;
15
+ backgroundColor: Color;
16
+ borderColor: Color;
13
17
  private _imageSource;
14
18
  private _spriteSheet;
15
19
  private _spriteFont;
@@ -20,5 +24,5 @@ export declare class DebugText {
20
24
  * @param text
21
25
  * @param pos
22
26
  */
23
- write(ctx: ExcaliburGraphicsContext, text: string, pos: Vector): void;
27
+ write(ctx: ExcaliburGraphicsContext, text: string, pos: Vector, foreground?: Color, background?: Color): void;
24
28
  }
@@ -1,13 +1,15 @@
1
1
  import type { Vector } from '../Math/vector';
2
- import type { ExcaliburGraphicsContext, LineGraphicsOptions, PointGraphicsOptions } from './Context/ExcaliburGraphicsContext';
2
+ import type { ExcaliburGraphicsContext, LineGraphicsOptions, PointGraphicsOptions, RectGraphicsOptions } from './Context/ExcaliburGraphicsContext';
3
3
  import { Color } from '../Color';
4
4
  import type { Ray } from '../Math/ray';
5
5
  import type { BoundingBox } from '../Collision/BoundingBox';
6
+ import type { DebugConfig } from '../Debug';
6
7
  export declare class Debug {
7
8
  static _drawCalls: ((ctx: ExcaliburGraphicsContext) => void)[];
8
9
  static _ctx: ExcaliburGraphicsContext;
9
10
  static z: number;
10
- static registerGraphicsContext(ctx: ExcaliburGraphicsContext): void;
11
+ static config: DebugConfig;
12
+ static registerDebugConfig(config: DebugConfig): void;
11
13
  static draw(debugDrawCall: (ctx: ExcaliburGraphicsContext) => void): void;
12
14
  static drawPoint(point: Vector, options?: PointGraphicsOptions): void;
13
15
  static drawLine(start: Vector, end: Vector, options?: LineGraphicsOptions): void;
@@ -21,9 +23,7 @@ export declare class Debug {
21
23
  strokeColor?: Color;
22
24
  width?: number;
23
25
  }): void;
24
- static drawBounds(boundingBox: BoundingBox, options?: {
25
- color?: Color;
26
- }): void;
26
+ static drawBounds(boundingBox: BoundingBox, options?: RectGraphicsOptions): void;
27
27
  static drawRay(ray: Ray, options?: {
28
28
  distance?: number;
29
29
  color?: Color;