diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1ce918e..315ce15 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -65,7 +65,7 @@ jobs: - name: Check bundle size uses: andresz1/size-limit-action@v1 with: - token: ${{ secrets.GITHUB_TOKEN }} + github_token: ${{ secrets.GITHUB_TOKEN }} deploy: runs-on: ubuntu-latest diff --git a/src/canvas-renderer.ts b/src/canvas-renderer.ts index 1fdf547..3debc53 100644 --- a/src/canvas-renderer.ts +++ b/src/canvas-renderer.ts @@ -114,6 +114,8 @@ export class CanvasRenderer { // Dessiner les cases de l'échiquier private drawTiles(): void { + const letters = 'abcdefgh'; + for (let y = 0; y < 8; y++) { for (let x = 0; x < 8; x++) { const { x: newX, y: newY } = this.getCoordinates(x, y); @@ -138,6 +140,25 @@ export class CanvasRenderer { ); } } + + // Dessiner les indicateurs a-h et 1-8 + this.context.font = '16px Arial'; + this.context.fillStyle = 'black'; + for (let i = 0; i < 8; i++) { + // Afficher les lettres a-h en bas + const letterX = + this.getCoordinates(i, 0).x * this.tileSize + this.tileSize / 2; + const letterY = this.canvas.height - 5; + this.context.textAlign = 'center'; + this.context.fillText(letters[i], letterX, letterY); + + // Afficher les numéros 1-8 sur le côté + const numberX = 5; + const numberY = + this.getCoordinates(0, i).y * this.tileSize + this.tileSize / 2; + this.context.textBaseline = 'middle'; + this.context.fillText(`${8 - i}`, numberX, numberY); + } } // Dessiner toutes les pièces sur l'échiquier diff --git a/src/index.ts b/src/index.ts index acd0d95..96b4099 100644 --- a/src/index.ts +++ b/src/index.ts @@ -176,7 +176,8 @@ export async function initializeGame(playerColor: PieceColor) { toY: number, pieceType: PieceType, ) { - const moveText = `${getPieceSymbol(pieceType, currentPlayer)} de (${fromX}, ${fromY}) à (${toX}, ${toY})`; + const letters = 'abcdefgh'; + const moveText = `${getPieceSymbol(pieceType, currentPlayer)} de (${letters[fromX]}${8 - fromY}) à (${letters[toX]}${8 - toY})`; const listItem = document.createElement('li'); listItem.textContent = moveText;