feat(assets): new assets loading system (currently only for images)

This commit is contained in:
2025-12-17 12:28:48 +01:00
parent a31f72f41d
commit 2f16f382e5
106 changed files with 359 additions and 366 deletions

View File

@@ -1,19 +1,11 @@
<script setup lang="ts">
import TOP_BAR_IMAGE from "/assets/images/contact/bottom-screen/top-bar.webp";
import BOTTOM_BAR_IMAGE from "/assets/images/contact/bottom-screen/bottom-bar.webp";
import BOTTOM_BAR_OK_IMAGE from "/assets/images/contact/bottom-screen/ok-button.webp";
const props = defineProps<{
okLabel: "Copy" | "Open";
}>();
const store = useContactStore();
const [topBarImage, bottomBarImage, bottomBarOkImage] = useImages(
TOP_BAR_IMAGE,
BOTTOM_BAR_IMAGE,
BOTTOM_BAR_OK_IMAGE,
);
const { assets } = useAssets();
useRender((ctx) => {
ctx.globalAlpha = store.isIntro
@@ -21,13 +13,17 @@ useRender((ctx) => {
: store.outro.stage2Opacity;
// top bar
ctx.drawImage(topBarImage!, 0, store.isIntro ? store.intro.topBarY : 0);
ctx.drawImage(
assets.contact.bottomScreen.topBar,
0,
store.isIntro ? store.intro.topBarY : 0,
);
// bottom bar
ctx.translate(0, store.isIntro ? store.intro.bottomBarY : SCREEN_HEIGHT - 24);
ctx.drawImage(bottomBarImage!, 0, 0);
ctx.drawImage(assets.contact.bottomScreen.bottomBar, 0, 0);
ctx.drawImage(bottomBarOkImage!, 144, 4);
ctx.drawImage(assets.contact.bottomScreen.okButton, 144, 4);
ctx.font = "10px NDS10";
ctx.fillStyle = "#000000";
ctx.fillText(props.okLabel, 144 + 35, 4 + 13);