feat(assets): new assets loading system (currently only for images)
This commit is contained in:
@@ -1,11 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
import MENU_IMAGE from "/assets/images/settings/top-screen/options/options.webp";
|
||||
import MENU_ACTIVE_IMAGE from "/assets/images/settings/top-screen/options/options-active.png";
|
||||
import MENU_DISABLED_IMAGE from "/assets/images/settings/top-screen/options/options-disabled.png";
|
||||
import GBA_MODE_IMAGE from "/assets/images/settings/top-screen/options/gba-mode.webp";
|
||||
import LANGUAGE_IMAGE from "/assets/images/settings/top-screen/options/language.webp";
|
||||
import START_UP_IMAGE from "/assets/images/settings/top-screen/options/start-up.webp";
|
||||
|
||||
const props = defineProps<{
|
||||
x: number;
|
||||
y: number;
|
||||
@@ -13,21 +6,7 @@ const props = defineProps<{
|
||||
|
||||
const settingsStore = useSettingsStore();
|
||||
|
||||
const [
|
||||
menuImage,
|
||||
menuActiveImage,
|
||||
menuDisabledImage,
|
||||
gbaModeImage,
|
||||
languageImage,
|
||||
startUpImage,
|
||||
] = useImages(
|
||||
MENU_IMAGE,
|
||||
MENU_ACTIVE_IMAGE,
|
||||
MENU_DISABLED_IMAGE,
|
||||
GBA_MODE_IMAGE,
|
||||
LANGUAGE_IMAGE,
|
||||
START_UP_IMAGE,
|
||||
);
|
||||
const { assets } = useAssets();
|
||||
|
||||
const isOpen = computed(() => settingsStore.isMenuOpen("options"));
|
||||
const isAnyOtherMenuOpen = computed(() =>
|
||||
@@ -40,23 +19,27 @@ useRender((ctx) => {
|
||||
ctx.translate(props.x, props.y);
|
||||
|
||||
if (isOpen.value || animation.playing) {
|
||||
ctx.drawImage(languageImage!, 0, -48 + animation.stage1Offset);
|
||||
ctx.drawImage(
|
||||
gbaModeImage!,
|
||||
assets.settings.topScreen.options.language,
|
||||
0,
|
||||
-48 + animation.stage1Offset,
|
||||
);
|
||||
ctx.drawImage(
|
||||
assets.settings.topScreen.options.gbaMode,
|
||||
48 - animation.stage2Offset,
|
||||
-48 + animation.stage1Offset,
|
||||
);
|
||||
ctx.drawImage(
|
||||
startUpImage!,
|
||||
assets.settings.topScreen.options.startUp,
|
||||
0,
|
||||
-96 + animation.stage2Offset + animation.stage1Offset,
|
||||
);
|
||||
|
||||
ctx.drawImage(menuActiveImage!, 0, 0);
|
||||
ctx.drawImage(assets.settings.topScreen.options.optionsActive, 0, 0);
|
||||
} else if (isAnyOtherMenuOpen.value) {
|
||||
ctx.drawImage(menuDisabledImage!, 0, 0);
|
||||
ctx.drawImage(assets.settings.topScreen.options.optionsDisabled, 0, 0);
|
||||
} else {
|
||||
ctx.drawImage(menuImage!, 0, 0);
|
||||
ctx.drawImage(assets.settings.topScreen.options.options, 0, 0);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user