• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

excaliburjs / Excalibur / 14804036802

02 May 2025 09:58PM UTC coverage: 5.927% (-83.4%) from 89.28%
14804036802

Pull #3404

github

web-flow
Merge 5c103d7f8 into 0f2ccaeb2
Pull Request #3404: feat: added Graph module to Math

234 of 8383 branches covered (2.79%)

229 of 246 new or added lines in 1 file covered. (93.09%)

13145 existing lines in 208 files now uncovered.

934 of 15759 relevant lines covered (5.93%)

4.72 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/engine/Graphics/Context/debug-text.ts
1
import { ExcaliburGraphicsContext } from '../Context/ExcaliburGraphicsContext';
2
import { ImageSource } from '../ImageSource';
3
import { SpriteFont } from '../SpriteFont';
4
import { SpriteSheet } from '../SpriteSheet';
5
import { Vector } from '../../Math/vector';
6
import debugFont from './debug-font.png';
7

8
/**
9
 * Internal debug text helper
10
 */
11
export class DebugText {
12
  constructor() {
13
    // We fire and forget, we don't care if it's loaded or not
14
    // eslint-disable-next-line @typescript-eslint/no-floating-promises
UNCOV
15
    this.load();
×
16
  }
17

18
  /**
19
   * base64 font
20
   */
UNCOV
21
  public readonly fontSheet = debugFont;
×
UNCOV
22
  public size: number = 16;
×
23
  private _imageSource!: ImageSource;
24
  private _spriteSheet!: SpriteSheet;
25
  private _spriteFont!: SpriteFont;
26
  public load() {
UNCOV
27
    this._imageSource = new ImageSource(this.fontSheet);
×
UNCOV
28
    return this._imageSource.load().then(() => {
×
UNCOV
29
      this._spriteSheet = SpriteSheet.fromImageSource({
×
30
        image: this._imageSource,
31
        grid: {
32
          rows: 4,
33
          columns: 16,
34
          spriteWidth: 16,
35
          spriteHeight: 16
36
        }
37
      });
UNCOV
38
      this._spriteFont = new SpriteFont({
×
39
        alphabet: '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ,!\'&."?-()+# ',
40
        caseInsensitive: true,
41
        spriteSheet: this._spriteSheet,
42
        spacing: -6
43
      });
44
    });
45
  }
46

47
  /**
48
   * Writes debug text using the built in sprint font
49
   * @param ctx
50
   * @param text
51
   * @param pos
52
   */
53
  public write(ctx: ExcaliburGraphicsContext, text: string, pos: Vector) {
UNCOV
54
    if (this._imageSource.isLoaded()) {
×
UNCOV
55
      this._spriteFont.render(ctx, text, null, pos.x, pos.y);
×
56
    }
57
  }
58
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc