• 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/Input/InputHost.ts
1
import { Engine } from '../Engine';
2
import { Gamepads } from './Gamepad';
3
import { InputMapper } from './InputMapper';
4
import { Keyboard } from './Keyboard';
5
import { PointerEventReceiver } from './PointerEventReceiver';
6

7
export interface InputHostOptions {
8
  pointerTarget: Document | HTMLCanvasElement;
9
  grabWindowFocus: boolean;
10
  engine: Engine;
11
}
12

13
export class InputHost {
UNCOV
14
  private _enabled = true;
×
15

16
  keyboard: Keyboard;
17
  pointers: PointerEventReceiver;
18
  gamepads: Gamepads;
19
  inputMapper: InputMapper;
20

21
  constructor(options: InputHostOptions) {
UNCOV
22
    const { pointerTarget, grabWindowFocus, engine } = options;
×
UNCOV
23
    this.keyboard = new Keyboard();
×
UNCOV
24
    this.pointers = new PointerEventReceiver(pointerTarget, engine);
×
UNCOV
25
    this.gamepads = new Gamepads();
×
26

UNCOV
27
    this.keyboard.init({ grabWindowFocus });
×
UNCOV
28
    this.pointers.init({ grabWindowFocus });
×
UNCOV
29
    this.gamepads.init();
×
UNCOV
30
    this.inputMapper = new InputMapper({
×
31
      keyboard: this.keyboard,
32
      pointers: this.pointers,
33
      gamepads: this.gamepads
34
    });
35
  }
36

37
  get enabled() {
UNCOV
38
    return this._enabled;
×
39
  }
40

41
  toggleEnabled(enabled: boolean) {
UNCOV
42
    this._enabled = enabled;
×
UNCOV
43
    this.keyboard.toggleEnabled(this._enabled);
×
UNCOV
44
    this.pointers.toggleEnabled(this._enabled);
×
UNCOV
45
    this.gamepads.toggleEnabled(this._enabled);
×
46
  }
47

48
  update() {
UNCOV
49
    if (this._enabled) {
×
UNCOV
50
      this.inputMapper.execute();
×
UNCOV
51
      this.keyboard.update();
×
UNCOV
52
      this.gamepads.update();
×
53
    }
54
  }
55

56
  clear() {
UNCOV
57
    this.keyboard.clear();
×
UNCOV
58
    this.pointers.clear();
×
59
    // this.gamepads.clear();
60
  }
61
}
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