audio-vis/raw/javascript/app.js

57 lines
1.5 KiB
JavaScript
Raw Normal View History

2020-04-07 21:44:46 +02:00
const shaderHandler = new ShaderHandler(null),
audioHandler = new AudioHandler(),
gui = new GUI(),
2020-08-01 21:51:54 +02:00
visual = new VisualDrawer(),
template = new Template(),
player = new Player(),
2020-08-06 23:44:37 +02:00
vConf = new Config("visual"),
pConf = new Config("player"),
worker = new Worker('/out/js/worker.min.js'),
startup = new Startup(),
eventHandler = new EventHandler(),
2020-08-07 19:31:30 +02:00
playerConf = new PlayerConfigHandler(),
keyHandler = new KeyHandler();
2020-08-01 21:51:54 +02:00
2020-08-06 23:44:37 +02:00
let c, gl, cInfo, ctx;
worker.addEventListener('message', e => {
if (e.data.status === 'startup') {
startup.moduleLoaded(e.data.cmd);
return;
}
eventHandler.handleEvent(e);
});
window.addEventListener('startupFin', e => {
setTimeout(e => {
$('.loading-screen').remove();
}, 100)
})
2020-04-07 21:44:46 +02:00
async function startUP() {
pConf.loadConfigByName('default');
2020-08-06 23:44:37 +02:00
c = $('#c'),
gl = c.getContext("webgl2"),
cInfo = $('#cInfo'),
ctx = cInfo.getContext('2d');
2020-04-07 21:44:46 +02:00
if (!gl) {
alert("SORRY THE BROWSER DOESN'T SUPPORT WEBGL2");
return false;
}
shaderHandler.setGL(gl)
2020-08-06 23:44:37 +02:00
await shaderHandler.loadArray(["wave", "sphere", "water", "wave2d"], 'shaders/');
await NotificationHandler.instance.init();
2020-04-07 21:44:46 +02:00
await audioHandler.init();
await player.init();
2020-08-01 21:51:54 +02:00
await visual.init();
await gui.init();
await imageUploader.init();
2020-08-06 23:44:37 +02:00
await playerConf.init();
2020-08-07 19:31:30 +02:00
await keyHandler.init();
2020-08-01 21:51:54 +02:00
await initHandler();
2020-08-07 19:31:30 +02:00
toggleShuffle(false);
2020-04-07 21:44:46 +02:00
}
startUP().then(r => {
2020-08-06 23:44:37 +02:00
startup.moduleLoaded('startup');
2020-04-07 21:44:46 +02:00
});