22 lines
1,004 B
JavaScript
22 lines
1,004 B
JavaScript
console.log('[js] starting');
|
|
const bgm = { name: null, handle: null };
|
|
globalThis.onmessage = (source, message) => {
|
|
console.log('[js] msg', source, message);
|
|
if (message == 'reload') {
|
|
game.loadFile(source, source + '.html');
|
|
} else if (message == 'unload') {
|
|
game.unload(source);
|
|
} else if (message.kind) {
|
|
if (message.kind == 'bgm') {
|
|
if (message.bgm != bgm.name) {
|
|
if (bgm.handle != null) game.stop(bgm.handle);
|
|
bgm.handle = game.play(bgm.name = message.bgm, { loop: true, });
|
|
}
|
|
}
|
|
}
|
|
};
|
|
game.loadFile('index', 'index.html');
|
|
//game.loadFile('index1', 'index1.html');
|
|
//game.load('index', "<html style=\"x:10;x_view:10;width:10\"><script src=\"file://script.js\"></script><body style=\"color:5\"><p>TESTING STUFF</p>YAY HTML<p>idk</p><img src=\"file://a.ppm\"></img></html>");
|
|
//game.load('index1', "<html style=\"width:10\"><script></script><body style=\"color:5\"><p>TESTING STUFF</p>YAY HTML<p>idk</p><img src=\"file://a.ppm\"></img></html>");
|