Get rendering working

This commit is contained in:
Michael Mikovsky
2025-10-22 15:23:29 -06:00
parent 43a8dab882
commit b8ca903bba
11 changed files with 841 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
addEventListener("TrunkApplicationStarted", (event) => {
console.log("WASM application started!");
const canvas = document.getElementById("canvas");
var [width, height] = [window.innerWidth, window.innerHeight];
let context = window.wasmBindings.init(canvas, width, height);
window.wasmBindings.draw(context);
// window.wasmBindings.draw(window.innerWidth, window.innerHeight);
addEventListener("resize", () => {
[width, height] = [window.innerWidth, window.innerHeight];
// console.log("Window resized: (", width, ", ", height, ")");
window.wasmBindings.resize(context, width, height);
});
canvas.addEventListener("click", (e) => {
// console.log(e);
// [width, height] = [window.innerWidth, window.innerHeight];
// console.log("Window resized: (", width, ", ", height, ")");
window.wasmBindings.click(context, e.pageX, e.pageY);
});
});