-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtextfile.js
More file actions
40 lines (36 loc) · 1.08 KB
/
textfile.js
File metadata and controls
40 lines (36 loc) · 1.08 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
39
40
function showTextfile(file, x, y) {
const width = 423;
const height = 311;
let background = this.add.sprite(x + width / 2, y + height / 2, notepadWindow).setInteractive()
const text = this.make.text({
x: x + 20,
y: y + 60,
text: file.content,
origin: 0,
style: {
font: 'bold 11px Arial',
fill: 'black'
}
});
text.setWordWrapWidth(width, false);
this.add.text(text);
const title = this.make.text({
x: x + 10,
y: y + 9,
text: `${file.name} - notepad.exe`,
origin: 0,
style: {
font: '10px Arial',
fill: 'white'
}
});
this.add.text(title)
const closeBtnSize = 16
const btnClose = this.add.sprite(x - 4 + width - closeBtnSize / 2, y + 6 + closeBtnSize / 2, closeIcon).setInteractive();
btnClose.displayWidth = closeBtnSize
btnClose.displayHeight = closeBtnSize
let objects = [background, text, btnClose, title]
btnClose.on('pointerdown', () => {
objects.forEach(obj => obj.destroy())
})
}