bump
This commit is contained in:
parent
a7e7218417
commit
1f18f3d16f
4 changed files with 13 additions and 17 deletions
1
frontend/www/bootstrap.js
vendored
1
frontend/www/bootstrap.js
vendored
|
@ -1,5 +1,6 @@
|
|||
// A dependency graph that contains any wasm must all be imported
|
||||
// asynchronously. This `bootstrap.js` file does the single async import, so
|
||||
// that no one else needs to worry about it again.
|
||||
// Import index.js that executes index.ts
|
||||
import("./index.js")
|
||||
.catch(e => console.error("Error importing `index.js`:", e));
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
<title>Hello wasm-pack!</title>
|
||||
</head>
|
||||
<body>
|
||||
<canvas id="c" width=1700 height=900></canvas>
|
||||
|
||||
<noscript>This page contains webassembly and javascript content, please enable javascript in your browser.</noscript>
|
||||
<script src="./bootstrap.js"></script>
|
||||
</body>
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import { Game } from "planetwars";
|
||||
import { memory } from "planetwars/plantwars_bg"
|
||||
import { Shader } from "./webgl/shader"
|
||||
|
||||
import { main } from './index.ts'
|
||||
|
@ -14,19 +13,3 @@ fetch(game_location)
|
|||
.then((response) => {
|
||||
main(Game.new(response));
|
||||
}).catch(console.error);
|
||||
|
||||
|
||||
// const g = Game.new("");
|
||||
|
||||
// const p1 = g.locations();
|
||||
// const s1 = g.location_count();
|
||||
// console.log(p1, s1);
|
||||
// const a1 = new Float64Array(memory.buffer, p1, s1 * 3);
|
||||
// console.log(a1);
|
||||
|
||||
// g.add_location(0.5, 1.2, 3.14);
|
||||
|
||||
// const p2 = g.locations();
|
||||
// const s2 = g.location_count();
|
||||
// const a2 = new Float64Array(memory.buffer, p2, s2 * 3);
|
||||
// console.log(a2);
|
||||
|
|
|
@ -1,5 +1,15 @@
|
|||
import { Game } from "planetwars";
|
||||
import { memory } from "planetwars/plantwars_bg";
|
||||
|
||||
const CANVAS = <HTMLCanvasElement>document.getElementById("c");
|
||||
|
||||
|
||||
function create_array(ptr: number, size: number): Float64Array {
|
||||
return new Float64Array(memory.buffer, ptr, size);
|
||||
}
|
||||
|
||||
export function main(game: Game) {
|
||||
console.log(game.turn_count());
|
||||
|
||||
console.log(create_array(game.get_viewbox(), 4));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue