0.1.0-2-beta.1.fix.1
This commit is contained in:
@@ -44,13 +44,14 @@ export async function startGame(canvas: HTMLCanvasElement, score: HTMLOutputElem
|
||||
if (context === null) {
|
||||
throw new Error("2D canvas context is unavailable");
|
||||
}
|
||||
const drawingContext: CanvasRenderingContext2D = context;
|
||||
const game = new ReflexWasmGame();
|
||||
canvas.addEventListener("pointerdown", event => {
|
||||
const bounds = canvas.getBoundingClientRect();
|
||||
const x = (event.clientX - bounds.left) / bounds.width;
|
||||
const y = (event.clientY - bounds.top) / bounds.height;
|
||||
game.pointer_down(x, y);
|
||||
render(game, canvas, context, score);
|
||||
render(game, canvas, drawingContext, score);
|
||||
void tracingTrace(`pointerdown x=${x.toFixed(4)} y=${y.toFixed(4)} score=${game.score()}`);
|
||||
});
|
||||
let previous = performance.now();
|
||||
@@ -59,10 +60,10 @@ export async function startGame(canvas: HTMLCanvasElement, score: HTMLOutputElem
|
||||
game.tick();
|
||||
previous += FRAME_MS;
|
||||
}
|
||||
render(game, canvas, context, score);
|
||||
render(game, canvas, drawingContext, score);
|
||||
window.requestAnimationFrame(frame);
|
||||
}
|
||||
render(game, canvas, context, score);
|
||||
render(game, canvas, drawingContext, score);
|
||||
window.requestAnimationFrame(frame);
|
||||
return game;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "game-reflex-poc-tauri",
|
||||
"private": true,
|
||||
"version": "0.1.0-2-beta.1",
|
||||
"version": "0.1.0-2-beta.1.fix.1",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "https://schema.tauri.app/config/2",
|
||||
"productName": "Reflex POC Tauri",
|
||||
"version": "0.1.0-2-beta.1",
|
||||
"version": "0.1.0-2-beta.1.fix.1",
|
||||
"identifier": "com.sasedev.games.reflex.tauri",
|
||||
"build": {
|
||||
"beforeDevCommand": {
|
||||
|
||||
Reference in New Issue
Block a user