WIP
This commit is contained in:
BIN
public/textures/wood01_ico.png
Normal file
BIN
public/textures/wood01_ico.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 34 KiB |
BIN
public/textures/wood02_ico.png
Normal file
BIN
public/textures/wood02_ico.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 30 KiB |
BIN
public/textures/wood03_ico.png
Normal file
BIN
public/textures/wood03_ico.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 29 KiB |
BIN
public/textures/wood04_ico.png
Normal file
BIN
public/textures/wood04_ico.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 29 KiB |
@@ -245,7 +245,8 @@ class Board {
|
|||||||
this.innerSize,
|
this.innerSize,
|
||||||
this.cfg.showBorder ? this.borderWidth : 0,
|
this.cfg.showBorder ? this.borderWidth : 0,
|
||||||
(this.cfg.showBorder ? this.borderWidth : 0) + this.margin,
|
(this.cfg.showBorder ? this.borderWidth : 0) + this.margin,
|
||||||
background
|
background,
|
||||||
|
this.cfg.tiles
|
||||||
);
|
);
|
||||||
|
|
||||||
for (let rank = 0; rank < this.cfg.tiles; rank++) {
|
for (let rank = 0; rank < this.cfg.tiles; rank++) {
|
||||||
|
|||||||
@@ -8,11 +8,28 @@ const drawRectangle = async (
|
|||||||
height: number,
|
height: number,
|
||||||
x: number,
|
x: number,
|
||||||
y: number,
|
y: number,
|
||||||
squareStyle: SquareStyle
|
squareStyle: SquareStyle,
|
||||||
|
tiles: number = 8
|
||||||
) => {
|
) => {
|
||||||
if (squareStyle.type === "image") {
|
if (squareStyle.type === "image") {
|
||||||
const img = await loadImage(squareStyle.data.src);
|
const img = await loadImage(squareStyle.data.src);
|
||||||
ctx.drawImage(img, x, y, width, height);
|
|
||||||
|
if (tiles < 8) {
|
||||||
|
ctx.drawImage(
|
||||||
|
img,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
img.width * (tiles / 8),
|
||||||
|
img.height * (tiles / 8),
|
||||||
|
x,
|
||||||
|
y,
|
||||||
|
width,
|
||||||
|
height
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
ctx.drawImage(img, x, y, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import calm from "./gradient/calm";
|
|||||||
import laguna from "./gradient/laguna";
|
import laguna from "./gradient/laguna";
|
||||||
import sunset from "./gradient/sunset";
|
import sunset from "./gradient/sunset";
|
||||||
|
|
||||||
// import kittens from "./pic/kittens";
|
|
||||||
import wood1 from "./pic/wood1";
|
import wood1 from "./pic/wood1";
|
||||||
import wood2 from "./pic/wood2";
|
import wood2 from "./pic/wood2";
|
||||||
import wood3 from "./pic/wood3";
|
import wood3 from "./pic/wood3";
|
||||||
@@ -32,7 +31,6 @@ const styles = {
|
|||||||
calm,
|
calm,
|
||||||
laguna,
|
laguna,
|
||||||
sunset,
|
sunset,
|
||||||
// kittens,
|
|
||||||
wood1,
|
wood1,
|
||||||
wood2,
|
wood2,
|
||||||
wood3,
|
wood3,
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ const style: Style = {
|
|||||||
onDark: "#eee",
|
onDark: "#eee",
|
||||||
onBorder: "#ffffffbb",
|
onBorder: "#ffffffbb",
|
||||||
},
|
},
|
||||||
|
ico: "/textures/wood01_ico.png",
|
||||||
};
|
};
|
||||||
|
|
||||||
export default style;
|
export default style;
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ const style: Style = {
|
|||||||
onDark: "#eee",
|
onDark: "#eee",
|
||||||
onBorder: "#ffffffbb",
|
onBorder: "#ffffffbb",
|
||||||
},
|
},
|
||||||
|
ico: "/textures/wood02_ico.png",
|
||||||
};
|
};
|
||||||
|
|
||||||
export default style;
|
export default style;
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ const style: Style = {
|
|||||||
onDark: "#eee",
|
onDark: "#eee",
|
||||||
onBorder: "#ffffffbb",
|
onBorder: "#ffffffbb",
|
||||||
},
|
},
|
||||||
|
ico: "/textures/wood03_ico.png",
|
||||||
};
|
};
|
||||||
|
|
||||||
export default style;
|
export default style;
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ const style: Style = {
|
|||||||
onDark: "#eee",
|
onDark: "#eee",
|
||||||
onBorder: "#ffffffbb",
|
onBorder: "#ffffffbb",
|
||||||
},
|
},
|
||||||
|
ico: "/textures/wood04_ico.png",
|
||||||
};
|
};
|
||||||
|
|
||||||
export default style;
|
export default style;
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ export type Style = {
|
|||||||
moveIndicator: MoveIndicator;
|
moveIndicator: MoveIndicator;
|
||||||
border: SquareStyle;
|
border: SquareStyle;
|
||||||
coords: Coords;
|
coords: Coords;
|
||||||
|
ico?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type PieceType = "k" | "q" | "r" | "b" | "n" | "p";
|
export type PieceType = "k" | "q" | "r" | "b" | "n" | "p";
|
||||||
@@ -206,10 +207,3 @@ export type Header = {
|
|||||||
Site: string | null;
|
Site: string | null;
|
||||||
Result: string | null;
|
Result: string | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type CreateAnimation = (
|
|
||||||
pgn: string,
|
|
||||||
boardConfig: BoardConfig,
|
|
||||||
size: Size,
|
|
||||||
includeTitleScreen: boolean
|
|
||||||
) => Promise<File>;
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
border: solid 5px black;
|
border: solid 5px black;
|
||||||
margin: 5px;
|
margin: 5px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
width: 72px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.boards__ico--active {
|
.boards__ico--active {
|
||||||
|
|||||||
@@ -17,21 +17,29 @@ const prepareBoards = async () => {
|
|||||||
const boards = [];
|
const boards = [];
|
||||||
|
|
||||||
const board = new Board({
|
const board = new Board({
|
||||||
size: 72,
|
size: 144,
|
||||||
tiles: 2,
|
tiles: 2,
|
||||||
showBorder: true,
|
showBorder: true,
|
||||||
showExtraInfo: false,
|
showExtraInfo: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
for (const [key, style] of Object.entries(styles) as [BoardStyle, Style][]) {
|
for (const [key, style] of Object.entries(styles) as [BoardStyle, Style][]) {
|
||||||
await board.updateConfig({ boardStyle: key });
|
let img: string;
|
||||||
await board.frame(null);
|
|
||||||
board.render();
|
if (style.ico) {
|
||||||
|
img = style.ico;
|
||||||
|
} else {
|
||||||
|
await board.updateConfig({ boardStyle: key });
|
||||||
|
await board.frame(null);
|
||||||
|
board.render();
|
||||||
|
img = board.toImgUrl();
|
||||||
|
}
|
||||||
|
|
||||||
boards.push({
|
boards.push({
|
||||||
key,
|
key,
|
||||||
name: style.name,
|
name: style.name,
|
||||||
category: style.category,
|
category: style.category,
|
||||||
img: board.toImgUrl(),
|
img,
|
||||||
} as BoardPreview);
|
} as BoardPreview);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user