fix: use LOGICAL_WIDTH,HEIGHT instead of SCREEN_WIDTH,HEIGHT beucase screen is scaled

This commit is contained in:
2026-01-14 16:13:44 +01:00
parent c005c50081
commit f60b9b21f4
8 changed files with 13 additions and 13 deletions

View File

@@ -8,13 +8,13 @@ const confirmationModal = useConfirmationModal();
const BG_WIDTH = assets.images.common.confirmationModal.rect.width;
const BG_HEIGHT = assets.images.common.confirmationModal.rect.height;
const BG_X = Math.floor((SCREEN_WIDTH - BG_WIDTH) / 2);
const BG_Y = Math.floor((SCREEN_HEIGHT - BG_HEIGHT) / 2);
const BG_X = Math.floor((LOGICAL_WIDTH - BG_WIDTH) / 2);
const BG_Y = Math.floor((LOGICAL_HEIGHT - BG_HEIGHT) / 2);
const TEXT_Y = BG_Y + Math.floor(BG_HEIGHT / 2) - 8 - 16 + 2 + 2;
const BOTTOM_BAR_HEIGHT = 24;
const CLIP_HEIGHT = SCREEN_HEIGHT - BOTTOM_BAR_HEIGHT;
const CLIP_HEIGHT = LOGICAL_HEIGHT - BOTTOM_BAR_HEIGHT;
const handleActivateA = () => {
confirmationModal.onConfirm?.();
@@ -29,7 +29,7 @@ onRender((ctx) => {
if (!confirmationModal.isVisible) return;
ctx.beginPath();
ctx.rect(0, 0, SCREEN_WIDTH, CLIP_HEIGHT);
ctx.rect(0, 0, LOGICAL_WIDTH, CLIP_HEIGHT);
ctx.clip();
ctx.translate(0, confirmationModal.offsetY);

View File

@@ -12,7 +12,7 @@ onRender((ctx) => {
: store.isOutro
? store.outro.fadeOpacity
: 0;
ctx.fillRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
ctx.fillRect(0, 0, LOGICAL_WIDTH, LOGICAL_HEIGHT);
});
</script>

View File

@@ -22,7 +22,7 @@ onRender((ctx) => {
: store.isOutro
? store.outro.fadeOpacity
: 0;
ctx.fillRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
ctx.fillRect(0, 0, LOGICAL_WIDTH, LOGICAL_HEIGHT);
});
</script>

View File

@@ -160,7 +160,7 @@ onRender((ctx) => {
}
ctx.fillStyle = `rgba(0, 0, 0, ${store.isIntro ? store.intro.fadeOpacity : store.isOutro ? store.outro.fadeOpacity : 0})`;
ctx.fillRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
ctx.fillRect(0, 0, LOGICAL_WIDTH, LOGICAL_HEIGHT);
});
useKeyDown((key) => {
if (

View File

@@ -121,7 +121,7 @@ onRender((ctx) => {
// frame
ctx.strokeStyle = "#0000007f";
ctx.lineWidth = 1;
ctx.strokeRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
ctx.strokeRect(0, 0, LOGICAL_WIDTH, LOGICAL_HEIGHT);
// text
assets.images.projects.bottomScreen.popupTextBackground.draw(ctx, 2, 146);

View File

@@ -150,7 +150,7 @@ onRender((ctx) => {
);
ctx.fillStyle = `rgba(0, 0, 0, ${store.isIntro ? store.intro.fadeOpacity : store.isOutro ? store.outro.fadeOpacity : 0})`;
ctx.fillRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
ctx.fillRect(0, 0, LOGICAL_WIDTH, LOGICAL_HEIGHT);
});
defineOptions({

View File

@@ -59,7 +59,7 @@ const renderFrame = (timestamp: number) => {
const start = Date.now();
// render
ctx.clearRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
ctx.clearRect(0, 0, LOGICAL_WIDTH, LOGICAL_HEIGHT);
ctx.save();
ctx.scale(SCREEN_SCALE, SCREEN_SCALE);