0.3.0-0-pre.4-fix.2
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// file: Web/game-snake-poc/frontend/ts/game.ts
|
||||
// version: 1
|
||||
// version: 2
|
||||
|
||||
import init, { SnakeWasmGame } from "@snake-wasm";
|
||||
|
||||
@@ -77,6 +77,7 @@ export async function startGame(
|
||||
if (context === null) {
|
||||
throw new Error("Le contexte Canvas 2D est indisponible.");
|
||||
}
|
||||
const renderingContext: CanvasRenderingContext2D = context;
|
||||
const game = new SnakeWasmGame();
|
||||
let previous = performance.now();
|
||||
let accumulator = 0;
|
||||
@@ -89,11 +90,11 @@ export async function startGame(
|
||||
game.tick();
|
||||
accumulator -= FRAME_MILLIS;
|
||||
}
|
||||
render(game, canvas, context, score, length);
|
||||
render(game, canvas, renderingContext, score, length);
|
||||
window.requestAnimationFrame(frame);
|
||||
}
|
||||
|
||||
render(game, canvas, context, score, length);
|
||||
render(game, canvas, renderingContext, score, length);
|
||||
window.requestAnimationFrame(frame);
|
||||
return {
|
||||
queueDirection(direction: SnakeDirection): void {
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
],
|
||||
"paths": {
|
||||
"@snake-wasm": [
|
||||
"../../../builds/sasedev-games/game-snake-poc-web/wasm/game_snake_poc_wasm.js"
|
||||
"../../../builds/sasedev-games/game-snake-poc-web/wasm/game_snake_poc_wasm.d.ts"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user