0.1.0-2-beta.1.fix.1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// file: Android/game-reflex-poc/build.gradle
|
||||
// version: 17
|
||||
// version: 18
|
||||
|
||||
plugins {
|
||||
id 'com.android.application'
|
||||
@@ -18,7 +18,7 @@ android {
|
||||
minSdk 21
|
||||
targetSdk 36
|
||||
versionCode 1
|
||||
versionName '0.1.0-2-beta.1'
|
||||
versionName '0.1.0-2-beta.1.fix.1'
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// file: Android/game-snake-poc/build.gradle
|
||||
// version: 17
|
||||
// version: 18
|
||||
|
||||
plugins {
|
||||
id 'com.android.application'
|
||||
@@ -18,7 +18,7 @@ android {
|
||||
minSdk 21
|
||||
targetSdk 36
|
||||
versionCode 1
|
||||
versionName '0.1.0-2-beta.1'
|
||||
versionName '0.1.0-2-beta.1.fix.1'
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
|
||||
@@ -19,7 +19,7 @@ members = [
|
||||
]
|
||||
|
||||
[workspace.package]
|
||||
version = "0.1.0-2-beta.1"
|
||||
version = "0.1.0-2-beta.1.fix.1"
|
||||
edition = "2024"
|
||||
license = "MIT"
|
||||
repository = "https://git.sasedev.com/Sasedev/games"
|
||||
|
||||
@@ -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": {
|
||||
|
||||
93
deltas/0.1.0/2-beta.1.fix.1.md
Normal file
93
deltas/0.1.0/2-beta.1.fix.1.md
Normal file
@@ -0,0 +1,93 @@
|
||||
<!-- file: deltas/0.1.0/2-beta.1.fix.1.md -->
|
||||
<!-- version: 1 -->
|
||||
|
||||
# Delta 0.1.0-2-beta.1.fix.1
|
||||
|
||||
## Base
|
||||
|
||||
Base déclarée : `0.1.0-2-beta.1`, non validée.
|
||||
|
||||
## Échec observé
|
||||
|
||||
Les gates Rust, la suite workspace complète, le build WASM, les builds Desktop natifs et les builds Android passent.
|
||||
|
||||
Le packaging Tauri échoue dans `beforeBuildCommand` pendant :
|
||||
|
||||
```text
|
||||
tsc && vite build
|
||||
```
|
||||
|
||||
Erreur :
|
||||
|
||||
```text
|
||||
frontend/ts/game.ts:62:30 - error TS2345:
|
||||
Argument of type 'CanvasRenderingContext2D | null'
|
||||
is not assignable to parameter of type 'CanvasRenderingContext2D'.
|
||||
```
|
||||
|
||||
## Cause
|
||||
|
||||
TypeScript ne conserve pas le narrowing de `context` dans la closure `pointerdown`.
|
||||
|
||||
Le contrôle :
|
||||
|
||||
```text
|
||||
if (context === null) { ... }
|
||||
```
|
||||
|
||||
est correct à l'exécution, mais le compilateur strict ne considère pas la variable capturée comme définitivement non-null dans la closure.
|
||||
|
||||
## Correctif
|
||||
|
||||
Après le guard, le contexte est stabilisé dans une variable explicitement non-null :
|
||||
|
||||
```text
|
||||
const drawingContext: CanvasRenderingContext2D = context;
|
||||
```
|
||||
|
||||
Toutes les closures et tous les appels `render(...)` utilisent ensuite `drawingContext`.
|
||||
|
||||
Aucune logique gameplay, WASM, Tauri, tracing ou input n'est modifiée.
|
||||
|
||||
## Validation
|
||||
|
||||
```bash
|
||||
cargo fmt --all
|
||||
cargo fmt --all -- --check
|
||||
|
||||
python3 scripts/audit_rust_workspace_rules.py
|
||||
python3 scripts/audit_markdown_tables.py README.md RULES.md ROADMAP.md CHANGELOG.md docs prompts crates Android deltas history
|
||||
python3 scripts/audit_distribution_layout.py
|
||||
|
||||
cargo check --workspace
|
||||
cargo clippy --workspace --all-targets --all-features -- -D warnings
|
||||
```
|
||||
|
||||
La suite workspace complète n'a pas besoin d'être rejouée pour ce fix TypeScript isolé si les gates ci-dessus restent propres.
|
||||
|
||||
## Packaging Tauri
|
||||
|
||||
```bash
|
||||
cd crates/apps/game-reflex-poc-tauri
|
||||
cargo tauri build
|
||||
cd ../../..
|
||||
```
|
||||
|
||||
Attendu :
|
||||
|
||||
- `tsc` propre ;
|
||||
- `vite build` propre ;
|
||||
- build Rust Tauri release propre ;
|
||||
- génération de l'artefact Tauri.
|
||||
|
||||
## Android
|
||||
|
||||
Les builds x86_64 et ARM64 de `2-beta.1` ont déjà été validés.
|
||||
|
||||
Aucune logique Android n'est modifiée par ce fix.
|
||||
|
||||
## Transition
|
||||
|
||||
Si `cargo tauri build` passe et les smokes beta restent propres, `2-beta.1.fix.1` pourra être validée.
|
||||
|
||||
Tout nouvel échec imputable au projet reste dans `2-beta.1.fix.N`.
|
||||
Reference in New Issue
Block a user