/
sound-editor.js
126 lines (118 loc) · 3.21 KB
/
sound-editor.js
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
// Phosphor - a browser-based microcomputer
// Copyright (c) 2017-2018 Marc Lepage
'use strict';
const Ui = require('./ui.js');
module.exports = class SoundEditor {
main() {
const sys = this.sys;
const ui = new Ui([
{ // bg
x: 0, y: 0, w: 192, h: 128,
onDraw() {
sys.clear(3);
sys.rect(0, 0, 192, 7, 11);
sys.rect(0, 121, 192, 7, 11);
const str = 'SOUND EDITOR UNDER CONSTRUCTION';
sys.text(str, 96-(str.length*5)/2, 64, 11);
},
},
{ // menu button (menu)
x: 0, y: 0, w: 8, h: 9,
onDraw() {
sys.char(6, this.x, this.y, 5);
},
onMouseDown() {
},
},
{ // menu button (undo)
x: 16, y: 0, w: 8, h: 9,
onDraw() {
sys.char(7, this.x, this.y, 5);
},
onMouseDown() {
},
},
{ // menu button (redo)
x: 24, y: 0, w: 8, h: 9,
onDraw() {
sys.char(8, this.x, this.y, 5);
},
onMouseDown() {
},
},
{ // menu button (cut)
x: 40, y: 0, w: 8, h: 9,
onDraw() {
sys.char(9, this.x, this.y, 5);
},
onMouseDown() {
},
},
{ // menu button (copy)
x: 48, y: 0, w: 8, h: 9,
onDraw() {
sys.char(10, this.x, this.y, 5);
},
onMouseDown() {
},
},
{ // menu button (paste)
x: 56, y: 0, w: 8, h: 9,
onDraw() {
sys.char(11, this.x, this.y, 5);
},
onMouseDown() {
},
},
{ // menu button (code)
x: 152, y: 0, w: 8, h: 8,
onDraw() {
sys.char(1, this.x, this.y, 5);
},
onMouseDown() {
sys.vc(1);
},
},
{ // menu button (sprite)
x: 160, y: 0, w: 8, h: 8,
onDraw() {
sys.char(2, this.x, this.y, 5);
},
onMouseDown() {
sys.vc(2);
},
},
{ // menu button (map)
x: 168, y: 0, w: 8, h: 8,
onDraw() {
sys.char(3, this.x, this.y, 5);
},
onMouseDown() {
sys.vc(3);
},
},
{ // menu button (sound)
x: 176, y: 0, w: 8, h: 8,
onDraw() {
sys.char(4, this.x, this.y, 15);
},
onMouseDown() {
sys.vc(4);
},
},
{ // menu button (music)
x: 184, y: 0, w: 8, h: 8,
onDraw() {
sys.char(5, this.x, this.y, 5);
},
onMouseDown() {
sys.vc(5);
},
},
], this);
}
// ---------------------------------------------------------------------------
onResume() {
this.sys.memwrite(0x8000, '00221408142200000036222222360000001c2a3e3e2a0000003636003636000000080c2c3c3e0000001010101c1c0000007c007c007c00000010087c081000000010207c20100000002828106c6c0000003c7c4c4c78000000787c64643c0000000000000000000000000000000000000000000000000000000000000000000010387c3e1d090700102040fe7d391100000000000000000055004100410055001454547d7f7e3c007f41415d41417f007f41495d49417f007f557f557f557f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040604000000000404040400000000040c0400');
}
};