feat(nds): add pressed state for all buttons

This commit is contained in:
2026-02-11 23:33:26 +01:00
parent 305ef81083
commit 2137abf424
57 changed files with 413 additions and 369 deletions

View File

@@ -162,6 +162,7 @@ export const drawButton = (
x: number,
y: number,
width: number,
pressed: boolean,
) => {
const { assets } = useAssets((a) => a.images.common);
@@ -175,13 +176,21 @@ export const drawButton = (
ctx.save();
ctx.translate(x, y);
assets.buttonLeft.draw(ctx, 0, 0);
(pressed ? assets.buttonLeftPressed : assets.buttonLeft).draw(ctx, 0, 0);
for (let i = 0; i < bodyCount; i++) {
assets.buttonBody.draw(ctx, LEFT_WIDTH + i * BODY_WIDTH, 0);
(pressed ? assets.buttonBodyPressed : assets.buttonBody).draw(
ctx,
LEFT_WIDTH + i * BODY_WIDTH,
0,
);
}
assets.buttonRight.draw(ctx, width - RIGHT_WIDTH, 0);
(pressed ? assets.buttonRightPressed : assets.buttonRight).draw(
ctx,
width - RIGHT_WIDTH,
0,
);
ctx.textBaseline = "top";
ctx.font = "10px NDS10";