progress!
This commit is contained in:
@ -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);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user