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

@@ -4,6 +4,8 @@ const props = withDefaults(
x: number;
y: number;
opacity?: number;
pressed: string | null;
isAnyOtherMenuOpen: boolean;
}>(),
{
opacity: 1,
@@ -12,39 +14,16 @@ const props = withDefaults(
const { onRender } = useScreen();
const settingsStore = useSettingsStore();
const menusContext = inject<{
isSubmenuSelected: ComputedRef<boolean>;
selectedSubmenuParent: ComputedRef<string | null>;
}>("menusContext")!;
const { assets } = useAssets();
// TODO: i don't like this
const isAnyOtherMenuOpen = computed(() => {
if (settingsStore.currentSubMenu) {
return !settingsStore.currentSubMenu.startsWith("touchScreen");
}
if (menusContext.isSubmenuSelected.value) {
return menusContext.selectedSubmenuParent.value !== "touchScreen";
}
return false;
});
const { assets } = useAssets((a) => a.images.settings.topScreen.touchScreen);
onRender((ctx) => {
ctx.globalAlpha = props.opacity;
if (isAnyOtherMenuOpen.value) {
assets.images.settings.topScreen.touchScreen.touchScreenDisabled.draw(
ctx,
props.x,
props.y,
);
if (props.pressed === "touchScreen") {
assets.touchScreenPressed.draw(ctx, props.x, props.y);
} else if (props.isAnyOtherMenuOpen) {
assets.touchScreenDisabled.draw(ctx, props.x, props.y);
} else {
assets.images.settings.topScreen.touchScreen.touchScreen.draw(
ctx,
props.x,
props.y,
);
assets.touchScreen.draw(ctx, props.x, props.y);
}
});

View File

@@ -393,6 +393,7 @@ onRender((ctx) => {
10,
2,
88,
false,
);
drawButton(
ctx,
@@ -400,6 +401,7 @@ onRender((ctx) => {
108,
2,
88,
false,
);
drawButton(
ctx,
@@ -407,6 +409,7 @@ onRender((ctx) => {
206,
2,
40,
false,
);
}, 110);