Skip to content

Commit a8993e8

Browse files
committed
Add hold text.
1 parent 8fa249d commit a8993e8

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

src/nodes/HoldArea.ts

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
import { Container, Graphics } from "pixi.js";
1+
import { Container, Graphics, HTMLText } from "pixi.js";
22
import { container } from "../util";
33
import GameNode from "./GameNode";
44
import type { Piece } from "./Deck";
55
import QubitPair from "./QubitPair";
6-
import { CELL_SIZE } from "../constants";
6+
import { CELL_SIZE, TEXT_FONT, theme } from "../constants";
77

8+
const header = 75;
89
const width = 200;
910
const height = 200;
1011
export default class HoldArea extends GameNode {
@@ -14,11 +15,24 @@ export default class HoldArea extends GameNode {
1415
super();
1516
this.view.scale = 0.75;
1617
this.view.addChild(
17-
container(new Graphics().roundRect(0, 0, width, height))
18+
container(new Graphics().roundRect(0, 0, width, header + height))
1819
);
1920

2021
this.view.addChild(this.container);
21-
this.container.position = { x: 100, y: 100 };
22+
const text = new HTMLText({
23+
text: "HOLD",
24+
style: {
25+
fill: theme.colors.primary,
26+
stroke: { color: theme.colors.background, width: 10 },
27+
fontFamily: TEXT_FONT,
28+
fontWeight: "bold",
29+
fontSize: 48,
30+
},
31+
});
32+
text.anchor = { x: 0.5, y: 0.5 };
33+
text.position = { x: width / 2, y: header / 2 };
34+
this.view.addChild(text);
35+
this.container.position = { x: width / 2, y: header + height / 2 };
2236
}
2337

2438
setHold(piece: Piece) {

0 commit comments

Comments
 (0)