progress!

This commit is contained in:
Dylan Pizzo
2025-01-04 22:32:17 -05:00
parent 7236e9f04e
commit c196646955
4 changed files with 104 additions and 11 deletions

View File

@ -1,4 +1,4 @@
import { drawCard } from "../draw.ts";
import { drawCard, loadImages } from "../draw.ts";
import { DominionCard } from "../types.ts";
const sizeMap = {
@ -15,10 +15,13 @@ const sizeMap = {
export const Card = (props: {card: DominionCard}) => {
const {card} = props;
const {width, height} = sizeMap[card.orientation];
return <canvas style={{width: "2.5in"}} width={width} height={height} ref={(canvasElement) => {
return <canvas style={{width: "2.5in"}} width={width} height={height} ref={async (canvasElement) => {
if (canvasElement) {
const context = canvasElement.getContext("2d");
if (context) {
console.log("loading");
await loadImages()
console.log("done loading");
drawCard(context, card);
}
}