-
Notifications
You must be signed in to change notification settings - Fork 0
/
test-kiwotigo-wasm.html
48 lines (47 loc) · 1.4 KB
/
test-kiwotigo-wasm.html
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
39
40
41
42
43
44
45
46
47
48
<html>
<head>
<meta charset="utf-8" />
<title>test kiwotigo (wasm)</title>
<script src="wasm_exec.js"></script>
<script>
const go = new Go();
const __kiwotiGo = WebAssembly.instantiateStreaming(
fetch("kiwotigo.wasm"),
go.importObject
).then((result) => {
go.run(result.instance);
});
function kiwotigoCreateContinent(cfg) {
return __kiwotiGo.then(
() =>
new Promise((resolve) => {
__kiwotiGo_createContinent(
{
gridWidth: 10,
gridHeight: 10,
gridOuterPaddingX: 25,
gridOuterPaddingY: 25,
gridInnerPaddingX: 6,
gridInnerPaddingY: 3,
gridHexWidth: 16,
gridHexHeight: 14,
hexWidth: 12, //24,
hexHeight: 12,
hexPaddingX: 0, //5, //3,
hexPaddingY: 0, //5, //3,
fastGrowIterations: 8, //10,
minimalGrowIterations: 120, //48,
maxRegionSizeFactor: 3,
divisibilityBy: 1,
probabilityCreateRegionAt: 0.6,
...cfg,
},
(result) => resolve(JSON.parse(result))
);
})
);
}
</script>
</head>
<body></body>
</html>