-
Notifications
You must be signed in to change notification settings - Fork 4
/
khafile.js
30 lines (27 loc) · 914 Bytes
/
khafile.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
let project = new Project('first_hx_game');
project.addSources('src');
project.addAssets('res/**', {
nameBaseDir: 'res',
destination: '{dir}/{name}',
name: '{dir}/{name}'
});
project.addDefine('kha_no_ogg');
project.addDefine('analyzer-optimize');
project.addParameter('-dce full');
project.targetOptions.html5.disableContextMenu = true;
if (process.argv.includes("--watch")) {
project.targetOptions.html5.unsafeEval = true;
let libPath = project.addLibrary('hotml');
project.addDefine('js_classic');
const path = require('path');
if (!libPath) libPath = path.resolve('./Libraries/hotml');
const Server = require(`${libPath}/bin/server.js`).hotml.server.Main;
const server = new Server(`${path.resolve('.')}/build/${platform}`, 'kha.js');
callbacks.postHaxeRecompilation = () => {
server.reload();
}
callbacks.postAssetReexporting = (path) => {
server.reloadAsset(path);
}
}
resolve(project);