Skip to content

Commit 7ccd06a

Browse files
committed
fix: Source debug text colors from config
1 parent b19b28e commit 7ccd06a

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

src/engine/Graphics/Context/debug-text.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import type { Vector } from '../../Math/vector';
66
// import debugFont from './debug-font.png';
77
import debugFont2 from './monogram-bitmap.png';
88
import { Debug } from '../Debug';
9-
import type { Color } from '../../Color';
9+
import { Color } from '../../Color';
1010

1111
/**
1212
* Internal debug text helper
@@ -23,9 +23,15 @@ export class DebugText {
2323
*/
2424
public readonly fontSheet = debugFont2;
2525
public size: number = 16;
26-
public foregroundColor: Color = Debug.config.settings.text.foreground;
27-
public backgroundColor: Color = Debug.config.settings.text.background;
28-
public borderColor: Color = Debug.config.settings.text.border;
26+
public get foregroundColor(): Color {
27+
return Debug.config.settings.text.foreground;
28+
}
29+
public get backgroundColor(): Color {
30+
return Debug.config.settings.text.background;
31+
}
32+
public get borderColor(): Color {
33+
return Debug.config.settings.text.border;
34+
}
2935
private _imageSource!: ImageSource;
3036
private _spriteSheet!: SpriteSheet;
3137
private _spriteFont!: SpriteFont;
@@ -70,11 +76,11 @@ export class DebugText {
7076
ctx.z = Debug.config.settings.z.text;
7177
ctx.translate(pos1.x, pos1.y);
7278
const bounds = this._spriteFont.measureText(text);
73-
const color = foreground ?? this.foregroundColor;
74-
const bg = background ?? this.backgroundColor;
79+
const color = foreground ?? this.foregroundColor ?? Color.Black;
80+
const bg = background ?? this.backgroundColor ?? Color.Transparent;
7581
ctx.save();
7682
ctx.z = Debug.config.settings.z.solid;
77-
ctx.drawRectangle(pos, bounds.width, bounds.height, bg, this.borderColor, 1);
83+
ctx.drawRectangle(pos, bounds.width, bounds.height, bg, this.borderColor ?? Color.Transparent, 1);
7884
ctx.restore();
7985
ctx.tint = color;
8086
this._spriteFont.render(ctx, text, null, pos.x, pos.y);

0 commit comments

Comments
 (0)