start on text
This commit is contained in:
22
src/draw.ts
22
src/draw.ts
@@ -88,6 +88,24 @@ export const drawCard = (
|
||||
}
|
||||
};
|
||||
|
||||
const drawText = (
|
||||
context: CanvasRenderingContext2D,
|
||||
text: string,
|
||||
x: number,
|
||||
y: number,
|
||||
options?: {
|
||||
maxWidth?: number;
|
||||
maxHeight?: number;
|
||||
allowWrap?: boolean;
|
||||
font?: string;
|
||||
color?: string;
|
||||
}
|
||||
) => {
|
||||
const { maxWidth = undefined } = options ?? {};
|
||||
context.font = "bold 48px serif";
|
||||
context.fillText(text, x, y, maxWidth);
|
||||
};
|
||||
|
||||
const drawStandardCard = async (
|
||||
context: CanvasRenderingContext2D,
|
||||
card: DominionCard
|
||||
@@ -97,11 +115,13 @@ const drawStandardCard = async (
|
||||
context.save();
|
||||
// Draw the image
|
||||
// Draw the card base
|
||||
context.drawImage(colorImage(getImage("card-color-1"), "#ff9900"), 0, 0);
|
||||
const color = "#ffffff"; // "#ffbc55";
|
||||
context.drawImage(colorImage(getImage("card-color-1"), color), 0, 0);
|
||||
context.drawImage(getImage("card-gray"), 0, 0);
|
||||
context.drawImage(colorImage(getImage("card-brown"), "#ff9911"), 0, 0);
|
||||
context.drawImage(getImage("card-description-focus"), 44, 1094);
|
||||
// Draw the name
|
||||
drawText(context, card.title, 300, 300);
|
||||
// Draw the description
|
||||
// Draw the types
|
||||
// Draw the cost
|
||||
|
||||
Reference in New Issue
Block a user