forked from 2003scape/rsc-client
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.js
executable file
·20 lines (19 loc) · 928 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import mudclient from './src/mudclient';
(async () => {
// initialize wasm module, stash into global scope for easy access
global.wasmMod = await import('./pkg/librsc.js');
if (typeof window !== 'object') {
console.error("Window doesn't exist! Currently running this client outside a web-browser is not possible. Eventually it may be, but for now the alternative is the client that is written in Java.");
throw Error("No window available for blitting to in current environment.");
}
const mc = global.ctx = new mudclient(window.document.getElementById('gameCanvas') || createCanvas(512,346));
mc.options.middleClickCamera = true;
mc.options.mouseWheel = true;
mc.options.resetCompass = true;
mc.options.zoomCamera = true;
const args = window.location.hash.slice(1).split(',');
if (args.length)
mc.members = (args[0].toLowerCase() === 'members');
mc.port = 43594;
await mc.startApplication(512, 346);
})();