feat(fonts): add more icons

This commit is contained in:
2026-02-04 17:15:48 +01:00
parent a8624a3031
commit bf593a8f45
8 changed files with 17 additions and 31 deletions

View File

@@ -17,7 +17,6 @@ const { assets } = useAssets();
const BUTTON_WIDTH = assets.images.common.button.rect.width;
const BUTTON_HEIGHT = assets.images.common.button.rect.height;
const LETTER_WIDTH = assets.images.common.B.rect.width;
const B_BUTTON: Rect = [31, 172, BUTTON_WIDTH, BUTTON_HEIGHT];
const A_BUTTON: Rect = [144, 172, BUTTON_WIDTH, BUTTON_HEIGHT];
@@ -29,24 +28,15 @@ onRender((ctx) => {
ctx.translate(0, props.yOffset);
const drawButton = (
image: AtlasImage,
text: string,
x: number,
offset: number,
) => {
const drawButton = (icon: string, text: string, x: number) => {
assets.images.common.button.draw(ctx, x, 172);
const { actualBoundingBoxRight: textWidth } = ctx.measureText(text);
const width = LETTER_WIDTH + 4 + textWidth;
const left = Math.ceil(x + BUTTON_WIDTH / 2 - width / 2 - offset / 2);
image.draw(ctx, left, 176);
ctx.fillText(text, left + LETTER_WIDTH + 4, 185);
const label = `${icon} ${text}`;
fillTextHCentered(ctx, label, x, 185, BUTTON_WIDTH);
};
drawButton(assets.images.common.B, props.bLabel, 31, 5);
drawButton(assets.images.common.A, props.aLabel, 144, 0);
drawButton(ICONS.B, props.bLabel, 31);
drawButton(ICONS.A, props.aLabel, 144);
}, 60);
onClick((x, y) => {