-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHUDRenderer.js
More file actions
38 lines (26 loc) · 1.09 KB
/
HUDRenderer.js
File metadata and controls
38 lines (26 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
export default class HUDRenderer {
constructor() {
this._div = document.createElement('div');
this._span = document.createElement('span');
this._container = document.createElement('div');
this._container.style.display = 'flex';
this._container.style.justifyContent = "flex-end";
this._container.style.alignItems = "flex-end";
this._container.style.pointerEvents = "none";
this._container.style.position = "fixed";
this._div.style.display = 'flex';
this._div.style.backgroundColor = "rgba(0, 0, 0, 0.4)";
this._div.style.color = "rgba(255, 255, 255, 1)";
this._div.style.padding = "20px"
this._div.style.fontSize = "24pt";
this._div.style.fontWeight = "bold";
this._div.appendChild(this._span);
this._container.appendChild(this._div);
document.body.appendChild(this._container);
}
draw(info) {
this._span.innerHTML = info.text;
this._container.style.width = info.width + "px";
this._container.style.height = info.height + "px";
}
}