-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.js
40 lines (26 loc) · 1.13 KB
/
main.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
import GraphicRenderer from "./utility/GraphicRenderer.js";
import Metronome from "./utility/Metronome.js";
import DrumSequence from "./model/DrumSequence.js";
import DrumGrid from "./model/DrumGrid.js";
import GridStateUpdater from "./state/GridStateUpdater.js";
import Controller from "./controllers/Controller.js";
// http://0.0.0.0:8000/Documents/Universita%CC%80/Advanced%20Coding/project/GravityDrumMachine/index.html
// setting up the drumGrid //
let sequenceList = [new DrumSequence()];
let grid = new DrumGrid(sequenceList);
// linking GridStateUpdater with our drumGrid //
let gridStateUpdater = new GridStateUpdater(grid);
// let's setup the rendering engine //
let renderer = new GraphicRenderer(grid);
// time to set up our metronome //
let metronome = new Metronome(grid);
metronome.stateUpdate.push(gridStateUpdater.updateState.bind(gridStateUpdater));
// adding the controller //
let controller = new Controller(grid, metronome, renderer, gridStateUpdater);
// starting our app //
document.onclick = () => {
Tone.start();
renderer.startRendering();
metronome.initialize();
document.onclick = undefined;
};