start on text
This commit is contained in:
parent
c196646955
commit
0da7c3ab23
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
|
||||
|
27
src/static/fonts.css
Normal file
27
src/static/fonts.css
Normal file
@ -0,0 +1,27 @@
|
||||
@font-face {
|
||||
font-family: 'DominionTitle';
|
||||
font-display: auto;
|
||||
src: local("Trajan Pro Bold"), local("TrajanPro-Bold"), local('Trajan Pro'),
|
||||
url('https://fonts.cdnfonts.com/s/14928/TrajanPro-Bold.woff') format('woff'),
|
||||
url('https://shemitz.net/static/dominion3/Trajan%20Pro%20Bold.ttf') format('truetype'),
|
||||
url('https://dominion.games/fonts/TrajanPro-Bold.otf') format('opentype'),
|
||||
local("Trajan"),
|
||||
local("Optimus Princeps"),
|
||||
url(https://fonts.gstatic.com/s/cinzel/v8/8vIJ7ww63mVu7gt79mT7PkRXMw.woff2) format('woff2');
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'DominionText';
|
||||
font-display: auto;
|
||||
src: local("Times New Roman"), serif;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'DominionSpecials';
|
||||
font-display: auto;
|
||||
src: local("Minion Std Black"), local("MinionStd-Black"), local("Minion Std"), local('Minion Pro'),
|
||||
url('https://fonts.cdnfonts.com/s/13260/MinionPro-Regular.woff') format('woff'),
|
||||
url('https://shemitz.net/static/dominion3/MinionStd-Black.otf') format('opentype'),
|
||||
local("Optimus Princeps"),
|
||||
url(https://fonts.gstatic.com/s/cinzel/v8/8vIJ7ww63mVu7gt79mT7PkRXMw.woff2) format('woff2');
|
||||
}
|
@ -4,6 +4,7 @@
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Dominionator</title>
|
||||
<link rel="stylesheet" href="/static/fonts.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user