0.0.5 • Published 11 months ago
ngx-chess-ultra v0.0.5
NgxChessUltra
(Work in progress) This library is designed to build a chess application in an educational context.
Installation
npm i ngx-chess-ultra
Within the assets folder, the following folder structure should be present.
- assets
- pieces
- black
- bishop.png
- king.png
- knight.png
- pawn.png
- queen.png
- rook.png
- white
- bishop.png
- king.png
- knight.png
- pawn.png
- queen.png
- rook.png
- black
- pieces
How to use the library?
Imported ngx-chess-ultra in the module where you want to use the chess boards.
import { ChessBoardModule } from 'ngx-chess-ultra';
...
imports: [ChessBoardModule]
In the component where you want to use it, you can use the chessMovingService to make de mov
import { Component, inject } from '@angular/core';
import { ChessMovingService } from 'ngx-chess-ultra';
@Component({
selector: 'app-chess-anotation-panel',
templateUrl: './chess-anotation-panel.component.html',
styleUrls: ['./chess-anotation-panel.component.css']
})
export class ChessGamePanelComponent {
movServ=inject(ChessMovingService)
makeMove(jugadaARealizar:string){
this.movServ.makeMove(jugadaARealizar);
}
and in the html you can use the component
<black-board-chess (jugadaARealizarEvent)="this.makeMove($event)"></black-board-chess>