This commit is contained in:
Maciej Caderek
2022-02-12 18:52:25 +01:00
parent f4b0d337ac
commit 840545886d
9 changed files with 159 additions and 21 deletions

View File

@@ -0,0 +1,20 @@
import { BoardConfig } from "../types";
import Board from "../board/Board";
import Game from "../game/Game";
const createImage = async (
fen: string,
boardConfig: BoardConfig,
size: number
) => {
const game = new Game().loadFEN(fen);
const board = new Board({ ...boardConfig, size });
const position = game.getPosition(0);
await board.frame(position, {});
board.render();
return board.toImgUrl();
};
export default createImage;