@almadar/ui 5.52.0 → 5.54.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/avl/index.cjs +44 -3
- package/dist/avl/index.js +44 -3
- package/dist/components/index.cjs +44 -3
- package/dist/components/index.js +44 -3
- package/dist/providers/index.cjs +44 -3
- package/dist/providers/index.js +44 -3
- package/dist/runtime/index.cjs +44 -3
- package/dist/runtime/index.js +44 -3
- package/package.json +1 -1
package/dist/avl/index.cjs
CHANGED
|
@@ -31382,6 +31382,7 @@ function PlatformerCanvas({
|
|
|
31382
31382
|
const canvasRef = React90.useRef(null);
|
|
31383
31383
|
const eventBus = useEventBus();
|
|
31384
31384
|
const keysRef = React90.useRef(/* @__PURE__ */ new Set());
|
|
31385
|
+
const lastPlatCountRef = React90.useRef(-1);
|
|
31385
31386
|
const imageCache = React90.useRef(/* @__PURE__ */ new Map());
|
|
31386
31387
|
const [loadedImages, setLoadedImages] = React90.useState(/* @__PURE__ */ new Set());
|
|
31387
31388
|
const loadImage = React90.useCallback((url) => {
|
|
@@ -31537,6 +31538,24 @@ function PlatformerCanvas({
|
|
|
31537
31538
|
camX = Math.max(0, Math.min(px - cw / 2, ww - cw));
|
|
31538
31539
|
camY = Math.max(0, Math.min(py - ch / 2 - 50, wh - ch));
|
|
31539
31540
|
}
|
|
31541
|
+
const shouldDiag = plats.length !== lastPlatCountRef.current;
|
|
31542
|
+
if (shouldDiag) {
|
|
31543
|
+
lastPlatCountRef.current = plats.length;
|
|
31544
|
+
canvasLog.debug("draw:platforms", {
|
|
31545
|
+
platformCount: plats.length,
|
|
31546
|
+
camX,
|
|
31547
|
+
camY,
|
|
31548
|
+
plat0: JSON.stringify(plats[0]),
|
|
31549
|
+
plat2: JSON.stringify(plats[2]),
|
|
31550
|
+
tSpritesType: tSprites ? tSprites instanceof Map ? "Map" : typeof tSprites : "none",
|
|
31551
|
+
canvasW: canvas.width,
|
|
31552
|
+
canvasH: canvas.height,
|
|
31553
|
+
player: { x: px, y: py },
|
|
31554
|
+
worldWidth: ww,
|
|
31555
|
+
canvasWidth: cw,
|
|
31556
|
+
followCamera: fc
|
|
31557
|
+
});
|
|
31558
|
+
}
|
|
31540
31559
|
const bgImage = bgImg ? loadImage(bgImg) : null;
|
|
31541
31560
|
if (bgImage) {
|
|
31542
31561
|
ctx.drawImage(bgImage, 0, 0, cw, ch);
|
|
@@ -31571,6 +31590,19 @@ function PlatformerCanvas({
|
|
|
31571
31590
|
const platType = plat.type ?? "ground";
|
|
31572
31591
|
const spriteUrl = tSprites?.[platType];
|
|
31573
31592
|
const tileImg = spriteUrl ? loadImage(spriteUrl) : null;
|
|
31593
|
+
if (shouldDiag) {
|
|
31594
|
+
canvasLog.debug("plat:draw", {
|
|
31595
|
+
platType,
|
|
31596
|
+
platX,
|
|
31597
|
+
platY,
|
|
31598
|
+
w: plat.width,
|
|
31599
|
+
h: plat.height,
|
|
31600
|
+
branch: tileImg ? "tile" : "color",
|
|
31601
|
+
natW: tileImg?.naturalWidth,
|
|
31602
|
+
natH: tileImg?.naturalHeight,
|
|
31603
|
+
spriteUrl: spriteUrl ?? null
|
|
31604
|
+
});
|
|
31605
|
+
}
|
|
31574
31606
|
if (tileImg) {
|
|
31575
31607
|
const tileW = tileImg.naturalWidth;
|
|
31576
31608
|
const tileH = tileImg.naturalHeight;
|
|
@@ -31662,13 +31694,14 @@ function PlatformerCanvas({
|
|
|
31662
31694
|
}
|
|
31663
31695
|
);
|
|
31664
31696
|
}
|
|
31665
|
-
var PLATFORM_COLORS, PLAYER_COLOR, PLAYER_EYE_COLOR, SKY_GRADIENT_TOP, SKY_GRADIENT_BOTTOM, GRID_COLOR;
|
|
31697
|
+
var canvasLog, PLATFORM_COLORS, PLAYER_COLOR, PLAYER_EYE_COLOR, SKY_GRADIENT_TOP, SKY_GRADIENT_BOTTOM, GRID_COLOR;
|
|
31666
31698
|
var init_PlatformerCanvas = __esm({
|
|
31667
31699
|
"components/game/molecules/PlatformerCanvas.tsx"() {
|
|
31668
31700
|
init_cn();
|
|
31669
31701
|
init_useEventBus();
|
|
31670
31702
|
init_verificationRegistry();
|
|
31671
31703
|
init_useRenderInterpolation();
|
|
31704
|
+
canvasLog = logger.createLogger("almadar:ui:game:platformer-canvas");
|
|
31672
31705
|
PLATFORM_COLORS = {
|
|
31673
31706
|
ground: "#4a7c59",
|
|
31674
31707
|
platform: "#7c6b4a",
|
|
@@ -46605,14 +46638,20 @@ function PlatformerBoard({
|
|
|
46605
46638
|
grounded: false,
|
|
46606
46639
|
facingRight: true
|
|
46607
46640
|
};
|
|
46608
|
-
const
|
|
46609
|
-
const platforms = propPlatforms ?? entityPlatforms ?? [
|
|
46641
|
+
const platforms = propPlatforms ?? [
|
|
46610
46642
|
{ x: 0, y: 368, width: 800, height: 32, type: "ground" },
|
|
46611
46643
|
{ x: 150, y: 280, width: 160, height: 16, type: "platform" },
|
|
46612
46644
|
{ x: 420, y: 220, width: 160, height: 16, type: "platform" },
|
|
46613
46645
|
{ x: 580, y: 300, width: 80, height: 16, type: "hazard" },
|
|
46614
46646
|
{ x: 700, y: 340, width: 64, height: 28, type: "goal" }
|
|
46615
46647
|
];
|
|
46648
|
+
boardLog.debug("platforms-resolve", {
|
|
46649
|
+
propPlatformsCount: Array.isArray(propPlatforms) ? propPlatforms.length : null,
|
|
46650
|
+
usedFallback: propPlatforms === void 0,
|
|
46651
|
+
finalCount: platforms.length,
|
|
46652
|
+
player: { x: player.x, y: player.y, vx: player.vx, vy: player.vy, grounded: player.grounded },
|
|
46653
|
+
result
|
|
46654
|
+
});
|
|
46616
46655
|
const handleRestart = React90.useCallback(() => {
|
|
46617
46656
|
if (playAgainEvent) {
|
|
46618
46657
|
eventBus.emit(`UI:${playAgainEvent}`, {});
|
|
@@ -46691,6 +46730,7 @@ function PlatformerBoard({
|
|
|
46691
46730
|
}
|
|
46692
46731
|
);
|
|
46693
46732
|
}
|
|
46733
|
+
var boardLog;
|
|
46694
46734
|
var init_PlatformerBoard = __esm({
|
|
46695
46735
|
"components/game/organisms/PlatformerBoard.tsx"() {
|
|
46696
46736
|
"use client";
|
|
@@ -46701,6 +46741,7 @@ var init_PlatformerBoard = __esm({
|
|
|
46701
46741
|
init_Typography();
|
|
46702
46742
|
init_Stack();
|
|
46703
46743
|
init_PlatformerCanvas();
|
|
46744
|
+
boardLog = logger.createLogger("almadar:ui:game:platformer-board");
|
|
46704
46745
|
PlatformerBoard.displayName = "PlatformerBoard";
|
|
46705
46746
|
}
|
|
46706
46747
|
});
|
package/dist/avl/index.js
CHANGED
|
@@ -31335,6 +31335,7 @@ function PlatformerCanvas({
|
|
|
31335
31335
|
const canvasRef = useRef(null);
|
|
31336
31336
|
const eventBus = useEventBus();
|
|
31337
31337
|
const keysRef = useRef(/* @__PURE__ */ new Set());
|
|
31338
|
+
const lastPlatCountRef = useRef(-1);
|
|
31338
31339
|
const imageCache = useRef(/* @__PURE__ */ new Map());
|
|
31339
31340
|
const [loadedImages, setLoadedImages] = useState(/* @__PURE__ */ new Set());
|
|
31340
31341
|
const loadImage = useCallback((url) => {
|
|
@@ -31490,6 +31491,24 @@ function PlatformerCanvas({
|
|
|
31490
31491
|
camX = Math.max(0, Math.min(px - cw / 2, ww - cw));
|
|
31491
31492
|
camY = Math.max(0, Math.min(py - ch / 2 - 50, wh - ch));
|
|
31492
31493
|
}
|
|
31494
|
+
const shouldDiag = plats.length !== lastPlatCountRef.current;
|
|
31495
|
+
if (shouldDiag) {
|
|
31496
|
+
lastPlatCountRef.current = plats.length;
|
|
31497
|
+
canvasLog.debug("draw:platforms", {
|
|
31498
|
+
platformCount: plats.length,
|
|
31499
|
+
camX,
|
|
31500
|
+
camY,
|
|
31501
|
+
plat0: JSON.stringify(plats[0]),
|
|
31502
|
+
plat2: JSON.stringify(plats[2]),
|
|
31503
|
+
tSpritesType: tSprites ? tSprites instanceof Map ? "Map" : typeof tSprites : "none",
|
|
31504
|
+
canvasW: canvas.width,
|
|
31505
|
+
canvasH: canvas.height,
|
|
31506
|
+
player: { x: px, y: py },
|
|
31507
|
+
worldWidth: ww,
|
|
31508
|
+
canvasWidth: cw,
|
|
31509
|
+
followCamera: fc
|
|
31510
|
+
});
|
|
31511
|
+
}
|
|
31493
31512
|
const bgImage = bgImg ? loadImage(bgImg) : null;
|
|
31494
31513
|
if (bgImage) {
|
|
31495
31514
|
ctx.drawImage(bgImage, 0, 0, cw, ch);
|
|
@@ -31524,6 +31543,19 @@ function PlatformerCanvas({
|
|
|
31524
31543
|
const platType = plat.type ?? "ground";
|
|
31525
31544
|
const spriteUrl = tSprites?.[platType];
|
|
31526
31545
|
const tileImg = spriteUrl ? loadImage(spriteUrl) : null;
|
|
31546
|
+
if (shouldDiag) {
|
|
31547
|
+
canvasLog.debug("plat:draw", {
|
|
31548
|
+
platType,
|
|
31549
|
+
platX,
|
|
31550
|
+
platY,
|
|
31551
|
+
w: plat.width,
|
|
31552
|
+
h: plat.height,
|
|
31553
|
+
branch: tileImg ? "tile" : "color",
|
|
31554
|
+
natW: tileImg?.naturalWidth,
|
|
31555
|
+
natH: tileImg?.naturalHeight,
|
|
31556
|
+
spriteUrl: spriteUrl ?? null
|
|
31557
|
+
});
|
|
31558
|
+
}
|
|
31527
31559
|
if (tileImg) {
|
|
31528
31560
|
const tileW = tileImg.naturalWidth;
|
|
31529
31561
|
const tileH = tileImg.naturalHeight;
|
|
@@ -31615,13 +31647,14 @@ function PlatformerCanvas({
|
|
|
31615
31647
|
}
|
|
31616
31648
|
);
|
|
31617
31649
|
}
|
|
31618
|
-
var PLATFORM_COLORS, PLAYER_COLOR, PLAYER_EYE_COLOR, SKY_GRADIENT_TOP, SKY_GRADIENT_BOTTOM, GRID_COLOR;
|
|
31650
|
+
var canvasLog, PLATFORM_COLORS, PLAYER_COLOR, PLAYER_EYE_COLOR, SKY_GRADIENT_TOP, SKY_GRADIENT_BOTTOM, GRID_COLOR;
|
|
31619
31651
|
var init_PlatformerCanvas = __esm({
|
|
31620
31652
|
"components/game/molecules/PlatformerCanvas.tsx"() {
|
|
31621
31653
|
init_cn();
|
|
31622
31654
|
init_useEventBus();
|
|
31623
31655
|
init_verificationRegistry();
|
|
31624
31656
|
init_useRenderInterpolation();
|
|
31657
|
+
canvasLog = createLogger("almadar:ui:game:platformer-canvas");
|
|
31625
31658
|
PLATFORM_COLORS = {
|
|
31626
31659
|
ground: "#4a7c59",
|
|
31627
31660
|
platform: "#7c6b4a",
|
|
@@ -46558,14 +46591,20 @@ function PlatformerBoard({
|
|
|
46558
46591
|
grounded: false,
|
|
46559
46592
|
facingRight: true
|
|
46560
46593
|
};
|
|
46561
|
-
const
|
|
46562
|
-
const platforms = propPlatforms ?? entityPlatforms ?? [
|
|
46594
|
+
const platforms = propPlatforms ?? [
|
|
46563
46595
|
{ x: 0, y: 368, width: 800, height: 32, type: "ground" },
|
|
46564
46596
|
{ x: 150, y: 280, width: 160, height: 16, type: "platform" },
|
|
46565
46597
|
{ x: 420, y: 220, width: 160, height: 16, type: "platform" },
|
|
46566
46598
|
{ x: 580, y: 300, width: 80, height: 16, type: "hazard" },
|
|
46567
46599
|
{ x: 700, y: 340, width: 64, height: 28, type: "goal" }
|
|
46568
46600
|
];
|
|
46601
|
+
boardLog.debug("platforms-resolve", {
|
|
46602
|
+
propPlatformsCount: Array.isArray(propPlatforms) ? propPlatforms.length : null,
|
|
46603
|
+
usedFallback: propPlatforms === void 0,
|
|
46604
|
+
finalCount: platforms.length,
|
|
46605
|
+
player: { x: player.x, y: player.y, vx: player.vx, vy: player.vy, grounded: player.grounded },
|
|
46606
|
+
result
|
|
46607
|
+
});
|
|
46569
46608
|
const handleRestart = useCallback(() => {
|
|
46570
46609
|
if (playAgainEvent) {
|
|
46571
46610
|
eventBus.emit(`UI:${playAgainEvent}`, {});
|
|
@@ -46644,6 +46683,7 @@ function PlatformerBoard({
|
|
|
46644
46683
|
}
|
|
46645
46684
|
);
|
|
46646
46685
|
}
|
|
46686
|
+
var boardLog;
|
|
46647
46687
|
var init_PlatformerBoard = __esm({
|
|
46648
46688
|
"components/game/organisms/PlatformerBoard.tsx"() {
|
|
46649
46689
|
"use client";
|
|
@@ -46654,6 +46694,7 @@ var init_PlatformerBoard = __esm({
|
|
|
46654
46694
|
init_Typography();
|
|
46655
46695
|
init_Stack();
|
|
46656
46696
|
init_PlatformerCanvas();
|
|
46697
|
+
boardLog = createLogger("almadar:ui:game:platformer-board");
|
|
46657
46698
|
PlatformerBoard.displayName = "PlatformerBoard";
|
|
46658
46699
|
}
|
|
46659
46700
|
});
|
|
@@ -29178,6 +29178,7 @@ function PlatformerCanvas({
|
|
|
29178
29178
|
const canvasRef = React76.useRef(null);
|
|
29179
29179
|
const eventBus = useEventBus();
|
|
29180
29180
|
const keysRef = React76.useRef(/* @__PURE__ */ new Set());
|
|
29181
|
+
const lastPlatCountRef = React76.useRef(-1);
|
|
29181
29182
|
const imageCache = React76.useRef(/* @__PURE__ */ new Map());
|
|
29182
29183
|
const [loadedImages, setLoadedImages] = React76.useState(/* @__PURE__ */ new Set());
|
|
29183
29184
|
const loadImage = React76.useCallback((url) => {
|
|
@@ -29333,6 +29334,24 @@ function PlatformerCanvas({
|
|
|
29333
29334
|
camX = Math.max(0, Math.min(px - cw / 2, ww - cw));
|
|
29334
29335
|
camY = Math.max(0, Math.min(py - ch / 2 - 50, wh - ch));
|
|
29335
29336
|
}
|
|
29337
|
+
const shouldDiag = plats.length !== lastPlatCountRef.current;
|
|
29338
|
+
if (shouldDiag) {
|
|
29339
|
+
lastPlatCountRef.current = plats.length;
|
|
29340
|
+
canvasLog.debug("draw:platforms", {
|
|
29341
|
+
platformCount: plats.length,
|
|
29342
|
+
camX,
|
|
29343
|
+
camY,
|
|
29344
|
+
plat0: JSON.stringify(plats[0]),
|
|
29345
|
+
plat2: JSON.stringify(plats[2]),
|
|
29346
|
+
tSpritesType: tSprites ? tSprites instanceof Map ? "Map" : typeof tSprites : "none",
|
|
29347
|
+
canvasW: canvas.width,
|
|
29348
|
+
canvasH: canvas.height,
|
|
29349
|
+
player: { x: px, y: py },
|
|
29350
|
+
worldWidth: ww,
|
|
29351
|
+
canvasWidth: cw,
|
|
29352
|
+
followCamera: fc
|
|
29353
|
+
});
|
|
29354
|
+
}
|
|
29336
29355
|
const bgImage = bgImg ? loadImage(bgImg) : null;
|
|
29337
29356
|
if (bgImage) {
|
|
29338
29357
|
ctx.drawImage(bgImage, 0, 0, cw, ch);
|
|
@@ -29367,6 +29386,19 @@ function PlatformerCanvas({
|
|
|
29367
29386
|
const platType = plat.type ?? "ground";
|
|
29368
29387
|
const spriteUrl = tSprites?.[platType];
|
|
29369
29388
|
const tileImg = spriteUrl ? loadImage(spriteUrl) : null;
|
|
29389
|
+
if (shouldDiag) {
|
|
29390
|
+
canvasLog.debug("plat:draw", {
|
|
29391
|
+
platType,
|
|
29392
|
+
platX,
|
|
29393
|
+
platY,
|
|
29394
|
+
w: plat.width,
|
|
29395
|
+
h: plat.height,
|
|
29396
|
+
branch: tileImg ? "tile" : "color",
|
|
29397
|
+
natW: tileImg?.naturalWidth,
|
|
29398
|
+
natH: tileImg?.naturalHeight,
|
|
29399
|
+
spriteUrl: spriteUrl ?? null
|
|
29400
|
+
});
|
|
29401
|
+
}
|
|
29370
29402
|
if (tileImg) {
|
|
29371
29403
|
const tileW = tileImg.naturalWidth;
|
|
29372
29404
|
const tileH = tileImg.naturalHeight;
|
|
@@ -29458,13 +29490,14 @@ function PlatformerCanvas({
|
|
|
29458
29490
|
}
|
|
29459
29491
|
);
|
|
29460
29492
|
}
|
|
29461
|
-
var PLATFORM_COLORS, PLAYER_COLOR, PLAYER_EYE_COLOR, SKY_GRADIENT_TOP, SKY_GRADIENT_BOTTOM, GRID_COLOR;
|
|
29493
|
+
var canvasLog, PLATFORM_COLORS, PLAYER_COLOR, PLAYER_EYE_COLOR, SKY_GRADIENT_TOP, SKY_GRADIENT_BOTTOM, GRID_COLOR;
|
|
29462
29494
|
var init_PlatformerCanvas = __esm({
|
|
29463
29495
|
"components/game/molecules/PlatformerCanvas.tsx"() {
|
|
29464
29496
|
init_cn();
|
|
29465
29497
|
init_useEventBus();
|
|
29466
29498
|
init_verificationRegistry();
|
|
29467
29499
|
init_useRenderInterpolation();
|
|
29500
|
+
canvasLog = logger.createLogger("almadar:ui:game:platformer-canvas");
|
|
29468
29501
|
PLATFORM_COLORS = {
|
|
29469
29502
|
ground: "#4a7c59",
|
|
29470
29503
|
platform: "#7c6b4a",
|
|
@@ -45267,14 +45300,20 @@ function PlatformerBoard({
|
|
|
45267
45300
|
grounded: false,
|
|
45268
45301
|
facingRight: true
|
|
45269
45302
|
};
|
|
45270
|
-
const
|
|
45271
|
-
const platforms = propPlatforms ?? entityPlatforms ?? [
|
|
45303
|
+
const platforms = propPlatforms ?? [
|
|
45272
45304
|
{ x: 0, y: 368, width: 800, height: 32, type: "ground" },
|
|
45273
45305
|
{ x: 150, y: 280, width: 160, height: 16, type: "platform" },
|
|
45274
45306
|
{ x: 420, y: 220, width: 160, height: 16, type: "platform" },
|
|
45275
45307
|
{ x: 580, y: 300, width: 80, height: 16, type: "hazard" },
|
|
45276
45308
|
{ x: 700, y: 340, width: 64, height: 28, type: "goal" }
|
|
45277
45309
|
];
|
|
45310
|
+
boardLog.debug("platforms-resolve", {
|
|
45311
|
+
propPlatformsCount: Array.isArray(propPlatforms) ? propPlatforms.length : null,
|
|
45312
|
+
usedFallback: propPlatforms === void 0,
|
|
45313
|
+
finalCount: platforms.length,
|
|
45314
|
+
player: { x: player.x, y: player.y, vx: player.vx, vy: player.vy, grounded: player.grounded },
|
|
45315
|
+
result
|
|
45316
|
+
});
|
|
45278
45317
|
const handleRestart = React76.useCallback(() => {
|
|
45279
45318
|
if (playAgainEvent) {
|
|
45280
45319
|
eventBus.emit(`UI:${playAgainEvent}`, {});
|
|
@@ -45353,6 +45392,7 @@ function PlatformerBoard({
|
|
|
45353
45392
|
}
|
|
45354
45393
|
);
|
|
45355
45394
|
}
|
|
45395
|
+
var boardLog;
|
|
45356
45396
|
var init_PlatformerBoard = __esm({
|
|
45357
45397
|
"components/game/organisms/PlatformerBoard.tsx"() {
|
|
45358
45398
|
"use client";
|
|
@@ -45363,6 +45403,7 @@ var init_PlatformerBoard = __esm({
|
|
|
45363
45403
|
init_Typography();
|
|
45364
45404
|
init_Stack();
|
|
45365
45405
|
init_PlatformerCanvas();
|
|
45406
|
+
boardLog = logger.createLogger("almadar:ui:game:platformer-board");
|
|
45366
45407
|
PlatformerBoard.displayName = "PlatformerBoard";
|
|
45367
45408
|
}
|
|
45368
45409
|
});
|
package/dist/components/index.js
CHANGED
|
@@ -29132,6 +29132,7 @@ function PlatformerCanvas({
|
|
|
29132
29132
|
const canvasRef = useRef(null);
|
|
29133
29133
|
const eventBus = useEventBus();
|
|
29134
29134
|
const keysRef = useRef(/* @__PURE__ */ new Set());
|
|
29135
|
+
const lastPlatCountRef = useRef(-1);
|
|
29135
29136
|
const imageCache = useRef(/* @__PURE__ */ new Map());
|
|
29136
29137
|
const [loadedImages, setLoadedImages] = useState(/* @__PURE__ */ new Set());
|
|
29137
29138
|
const loadImage = useCallback((url) => {
|
|
@@ -29287,6 +29288,24 @@ function PlatformerCanvas({
|
|
|
29287
29288
|
camX = Math.max(0, Math.min(px - cw / 2, ww - cw));
|
|
29288
29289
|
camY = Math.max(0, Math.min(py - ch / 2 - 50, wh - ch));
|
|
29289
29290
|
}
|
|
29291
|
+
const shouldDiag = plats.length !== lastPlatCountRef.current;
|
|
29292
|
+
if (shouldDiag) {
|
|
29293
|
+
lastPlatCountRef.current = plats.length;
|
|
29294
|
+
canvasLog.debug("draw:platforms", {
|
|
29295
|
+
platformCount: plats.length,
|
|
29296
|
+
camX,
|
|
29297
|
+
camY,
|
|
29298
|
+
plat0: JSON.stringify(plats[0]),
|
|
29299
|
+
plat2: JSON.stringify(plats[2]),
|
|
29300
|
+
tSpritesType: tSprites ? tSprites instanceof Map ? "Map" : typeof tSprites : "none",
|
|
29301
|
+
canvasW: canvas.width,
|
|
29302
|
+
canvasH: canvas.height,
|
|
29303
|
+
player: { x: px, y: py },
|
|
29304
|
+
worldWidth: ww,
|
|
29305
|
+
canvasWidth: cw,
|
|
29306
|
+
followCamera: fc
|
|
29307
|
+
});
|
|
29308
|
+
}
|
|
29290
29309
|
const bgImage = bgImg ? loadImage(bgImg) : null;
|
|
29291
29310
|
if (bgImage) {
|
|
29292
29311
|
ctx.drawImage(bgImage, 0, 0, cw, ch);
|
|
@@ -29321,6 +29340,19 @@ function PlatformerCanvas({
|
|
|
29321
29340
|
const platType = plat.type ?? "ground";
|
|
29322
29341
|
const spriteUrl = tSprites?.[platType];
|
|
29323
29342
|
const tileImg = spriteUrl ? loadImage(spriteUrl) : null;
|
|
29343
|
+
if (shouldDiag) {
|
|
29344
|
+
canvasLog.debug("plat:draw", {
|
|
29345
|
+
platType,
|
|
29346
|
+
platX,
|
|
29347
|
+
platY,
|
|
29348
|
+
w: plat.width,
|
|
29349
|
+
h: plat.height,
|
|
29350
|
+
branch: tileImg ? "tile" : "color",
|
|
29351
|
+
natW: tileImg?.naturalWidth,
|
|
29352
|
+
natH: tileImg?.naturalHeight,
|
|
29353
|
+
spriteUrl: spriteUrl ?? null
|
|
29354
|
+
});
|
|
29355
|
+
}
|
|
29324
29356
|
if (tileImg) {
|
|
29325
29357
|
const tileW = tileImg.naturalWidth;
|
|
29326
29358
|
const tileH = tileImg.naturalHeight;
|
|
@@ -29412,13 +29444,14 @@ function PlatformerCanvas({
|
|
|
29412
29444
|
}
|
|
29413
29445
|
);
|
|
29414
29446
|
}
|
|
29415
|
-
var PLATFORM_COLORS, PLAYER_COLOR, PLAYER_EYE_COLOR, SKY_GRADIENT_TOP, SKY_GRADIENT_BOTTOM, GRID_COLOR;
|
|
29447
|
+
var canvasLog, PLATFORM_COLORS, PLAYER_COLOR, PLAYER_EYE_COLOR, SKY_GRADIENT_TOP, SKY_GRADIENT_BOTTOM, GRID_COLOR;
|
|
29416
29448
|
var init_PlatformerCanvas = __esm({
|
|
29417
29449
|
"components/game/molecules/PlatformerCanvas.tsx"() {
|
|
29418
29450
|
init_cn();
|
|
29419
29451
|
init_useEventBus();
|
|
29420
29452
|
init_verificationRegistry();
|
|
29421
29453
|
init_useRenderInterpolation();
|
|
29454
|
+
canvasLog = createLogger("almadar:ui:game:platformer-canvas");
|
|
29422
29455
|
PLATFORM_COLORS = {
|
|
29423
29456
|
ground: "#4a7c59",
|
|
29424
29457
|
platform: "#7c6b4a",
|
|
@@ -45221,14 +45254,20 @@ function PlatformerBoard({
|
|
|
45221
45254
|
grounded: false,
|
|
45222
45255
|
facingRight: true
|
|
45223
45256
|
};
|
|
45224
|
-
const
|
|
45225
|
-
const platforms = propPlatforms ?? entityPlatforms ?? [
|
|
45257
|
+
const platforms = propPlatforms ?? [
|
|
45226
45258
|
{ x: 0, y: 368, width: 800, height: 32, type: "ground" },
|
|
45227
45259
|
{ x: 150, y: 280, width: 160, height: 16, type: "platform" },
|
|
45228
45260
|
{ x: 420, y: 220, width: 160, height: 16, type: "platform" },
|
|
45229
45261
|
{ x: 580, y: 300, width: 80, height: 16, type: "hazard" },
|
|
45230
45262
|
{ x: 700, y: 340, width: 64, height: 28, type: "goal" }
|
|
45231
45263
|
];
|
|
45264
|
+
boardLog.debug("platforms-resolve", {
|
|
45265
|
+
propPlatformsCount: Array.isArray(propPlatforms) ? propPlatforms.length : null,
|
|
45266
|
+
usedFallback: propPlatforms === void 0,
|
|
45267
|
+
finalCount: platforms.length,
|
|
45268
|
+
player: { x: player.x, y: player.y, vx: player.vx, vy: player.vy, grounded: player.grounded },
|
|
45269
|
+
result
|
|
45270
|
+
});
|
|
45232
45271
|
const handleRestart = useCallback(() => {
|
|
45233
45272
|
if (playAgainEvent) {
|
|
45234
45273
|
eventBus.emit(`UI:${playAgainEvent}`, {});
|
|
@@ -45307,6 +45346,7 @@ function PlatformerBoard({
|
|
|
45307
45346
|
}
|
|
45308
45347
|
);
|
|
45309
45348
|
}
|
|
45349
|
+
var boardLog;
|
|
45310
45350
|
var init_PlatformerBoard = __esm({
|
|
45311
45351
|
"components/game/organisms/PlatformerBoard.tsx"() {
|
|
45312
45352
|
"use client";
|
|
@@ -45317,6 +45357,7 @@ var init_PlatformerBoard = __esm({
|
|
|
45317
45357
|
init_Typography();
|
|
45318
45358
|
init_Stack();
|
|
45319
45359
|
init_PlatformerCanvas();
|
|
45360
|
+
boardLog = createLogger("almadar:ui:game:platformer-board");
|
|
45320
45361
|
PlatformerBoard.displayName = "PlatformerBoard";
|
|
45321
45362
|
}
|
|
45322
45363
|
});
|
package/dist/providers/index.cjs
CHANGED
|
@@ -28774,6 +28774,7 @@ function PlatformerCanvas({
|
|
|
28774
28774
|
const canvasRef = React82.useRef(null);
|
|
28775
28775
|
const eventBus = useEventBus();
|
|
28776
28776
|
const keysRef = React82.useRef(/* @__PURE__ */ new Set());
|
|
28777
|
+
const lastPlatCountRef = React82.useRef(-1);
|
|
28777
28778
|
const imageCache = React82.useRef(/* @__PURE__ */ new Map());
|
|
28778
28779
|
const [loadedImages, setLoadedImages] = React82.useState(/* @__PURE__ */ new Set());
|
|
28779
28780
|
const loadImage = React82.useCallback((url) => {
|
|
@@ -28929,6 +28930,24 @@ function PlatformerCanvas({
|
|
|
28929
28930
|
camX = Math.max(0, Math.min(px - cw / 2, ww - cw));
|
|
28930
28931
|
camY = Math.max(0, Math.min(py - ch / 2 - 50, wh - ch));
|
|
28931
28932
|
}
|
|
28933
|
+
const shouldDiag = plats.length !== lastPlatCountRef.current;
|
|
28934
|
+
if (shouldDiag) {
|
|
28935
|
+
lastPlatCountRef.current = plats.length;
|
|
28936
|
+
canvasLog.debug("draw:platforms", {
|
|
28937
|
+
platformCount: plats.length,
|
|
28938
|
+
camX,
|
|
28939
|
+
camY,
|
|
28940
|
+
plat0: JSON.stringify(plats[0]),
|
|
28941
|
+
plat2: JSON.stringify(plats[2]),
|
|
28942
|
+
tSpritesType: tSprites ? tSprites instanceof Map ? "Map" : typeof tSprites : "none",
|
|
28943
|
+
canvasW: canvas.width,
|
|
28944
|
+
canvasH: canvas.height,
|
|
28945
|
+
player: { x: px, y: py },
|
|
28946
|
+
worldWidth: ww,
|
|
28947
|
+
canvasWidth: cw,
|
|
28948
|
+
followCamera: fc
|
|
28949
|
+
});
|
|
28950
|
+
}
|
|
28932
28951
|
const bgImage = bgImg ? loadImage(bgImg) : null;
|
|
28933
28952
|
if (bgImage) {
|
|
28934
28953
|
ctx.drawImage(bgImage, 0, 0, cw, ch);
|
|
@@ -28963,6 +28982,19 @@ function PlatformerCanvas({
|
|
|
28963
28982
|
const platType = plat.type ?? "ground";
|
|
28964
28983
|
const spriteUrl = tSprites?.[platType];
|
|
28965
28984
|
const tileImg = spriteUrl ? loadImage(spriteUrl) : null;
|
|
28985
|
+
if (shouldDiag) {
|
|
28986
|
+
canvasLog.debug("plat:draw", {
|
|
28987
|
+
platType,
|
|
28988
|
+
platX,
|
|
28989
|
+
platY,
|
|
28990
|
+
w: plat.width,
|
|
28991
|
+
h: plat.height,
|
|
28992
|
+
branch: tileImg ? "tile" : "color",
|
|
28993
|
+
natW: tileImg?.naturalWidth,
|
|
28994
|
+
natH: tileImg?.naturalHeight,
|
|
28995
|
+
spriteUrl: spriteUrl ?? null
|
|
28996
|
+
});
|
|
28997
|
+
}
|
|
28966
28998
|
if (tileImg) {
|
|
28967
28999
|
const tileW = tileImg.naturalWidth;
|
|
28968
29000
|
const tileH = tileImg.naturalHeight;
|
|
@@ -29054,13 +29086,14 @@ function PlatformerCanvas({
|
|
|
29054
29086
|
}
|
|
29055
29087
|
);
|
|
29056
29088
|
}
|
|
29057
|
-
var PLATFORM_COLORS, PLAYER_COLOR, PLAYER_EYE_COLOR, SKY_GRADIENT_TOP, SKY_GRADIENT_BOTTOM, GRID_COLOR;
|
|
29089
|
+
var canvasLog, PLATFORM_COLORS, PLAYER_COLOR, PLAYER_EYE_COLOR, SKY_GRADIENT_TOP, SKY_GRADIENT_BOTTOM, GRID_COLOR;
|
|
29058
29090
|
var init_PlatformerCanvas = __esm({
|
|
29059
29091
|
"components/game/molecules/PlatformerCanvas.tsx"() {
|
|
29060
29092
|
init_cn();
|
|
29061
29093
|
init_useEventBus();
|
|
29062
29094
|
init_verificationRegistry();
|
|
29063
29095
|
init_useRenderInterpolation();
|
|
29096
|
+
canvasLog = logger.createLogger("almadar:ui:game:platformer-canvas");
|
|
29064
29097
|
PLATFORM_COLORS = {
|
|
29065
29098
|
ground: "#4a7c59",
|
|
29066
29099
|
platform: "#7c6b4a",
|
|
@@ -44406,14 +44439,20 @@ function PlatformerBoard({
|
|
|
44406
44439
|
grounded: false,
|
|
44407
44440
|
facingRight: true
|
|
44408
44441
|
};
|
|
44409
|
-
const
|
|
44410
|
-
const platforms = propPlatforms ?? entityPlatforms ?? [
|
|
44442
|
+
const platforms = propPlatforms ?? [
|
|
44411
44443
|
{ x: 0, y: 368, width: 800, height: 32, type: "ground" },
|
|
44412
44444
|
{ x: 150, y: 280, width: 160, height: 16, type: "platform" },
|
|
44413
44445
|
{ x: 420, y: 220, width: 160, height: 16, type: "platform" },
|
|
44414
44446
|
{ x: 580, y: 300, width: 80, height: 16, type: "hazard" },
|
|
44415
44447
|
{ x: 700, y: 340, width: 64, height: 28, type: "goal" }
|
|
44416
44448
|
];
|
|
44449
|
+
boardLog.debug("platforms-resolve", {
|
|
44450
|
+
propPlatformsCount: Array.isArray(propPlatforms) ? propPlatforms.length : null,
|
|
44451
|
+
usedFallback: propPlatforms === void 0,
|
|
44452
|
+
finalCount: platforms.length,
|
|
44453
|
+
player: { x: player.x, y: player.y, vx: player.vx, vy: player.vy, grounded: player.grounded },
|
|
44454
|
+
result
|
|
44455
|
+
});
|
|
44417
44456
|
const handleRestart = React82.useCallback(() => {
|
|
44418
44457
|
if (playAgainEvent) {
|
|
44419
44458
|
eventBus.emit(`UI:${playAgainEvent}`, {});
|
|
@@ -44492,6 +44531,7 @@ function PlatformerBoard({
|
|
|
44492
44531
|
}
|
|
44493
44532
|
);
|
|
44494
44533
|
}
|
|
44534
|
+
var boardLog;
|
|
44495
44535
|
var init_PlatformerBoard = __esm({
|
|
44496
44536
|
"components/game/organisms/PlatformerBoard.tsx"() {
|
|
44497
44537
|
"use client";
|
|
@@ -44502,6 +44542,7 @@ var init_PlatformerBoard = __esm({
|
|
|
44502
44542
|
init_Typography();
|
|
44503
44543
|
init_Stack();
|
|
44504
44544
|
init_PlatformerCanvas();
|
|
44545
|
+
boardLog = logger.createLogger("almadar:ui:game:platformer-board");
|
|
44505
44546
|
PlatformerBoard.displayName = "PlatformerBoard";
|
|
44506
44547
|
}
|
|
44507
44548
|
});
|
package/dist/providers/index.js
CHANGED
|
@@ -28727,6 +28727,7 @@ function PlatformerCanvas({
|
|
|
28727
28727
|
const canvasRef = useRef(null);
|
|
28728
28728
|
const eventBus = useEventBus();
|
|
28729
28729
|
const keysRef = useRef(/* @__PURE__ */ new Set());
|
|
28730
|
+
const lastPlatCountRef = useRef(-1);
|
|
28730
28731
|
const imageCache = useRef(/* @__PURE__ */ new Map());
|
|
28731
28732
|
const [loadedImages, setLoadedImages] = useState(/* @__PURE__ */ new Set());
|
|
28732
28733
|
const loadImage = useCallback((url) => {
|
|
@@ -28882,6 +28883,24 @@ function PlatformerCanvas({
|
|
|
28882
28883
|
camX = Math.max(0, Math.min(px - cw / 2, ww - cw));
|
|
28883
28884
|
camY = Math.max(0, Math.min(py - ch / 2 - 50, wh - ch));
|
|
28884
28885
|
}
|
|
28886
|
+
const shouldDiag = plats.length !== lastPlatCountRef.current;
|
|
28887
|
+
if (shouldDiag) {
|
|
28888
|
+
lastPlatCountRef.current = plats.length;
|
|
28889
|
+
canvasLog.debug("draw:platforms", {
|
|
28890
|
+
platformCount: plats.length,
|
|
28891
|
+
camX,
|
|
28892
|
+
camY,
|
|
28893
|
+
plat0: JSON.stringify(plats[0]),
|
|
28894
|
+
plat2: JSON.stringify(plats[2]),
|
|
28895
|
+
tSpritesType: tSprites ? tSprites instanceof Map ? "Map" : typeof tSprites : "none",
|
|
28896
|
+
canvasW: canvas.width,
|
|
28897
|
+
canvasH: canvas.height,
|
|
28898
|
+
player: { x: px, y: py },
|
|
28899
|
+
worldWidth: ww,
|
|
28900
|
+
canvasWidth: cw,
|
|
28901
|
+
followCamera: fc
|
|
28902
|
+
});
|
|
28903
|
+
}
|
|
28885
28904
|
const bgImage = bgImg ? loadImage(bgImg) : null;
|
|
28886
28905
|
if (bgImage) {
|
|
28887
28906
|
ctx.drawImage(bgImage, 0, 0, cw, ch);
|
|
@@ -28916,6 +28935,19 @@ function PlatformerCanvas({
|
|
|
28916
28935
|
const platType = plat.type ?? "ground";
|
|
28917
28936
|
const spriteUrl = tSprites?.[platType];
|
|
28918
28937
|
const tileImg = spriteUrl ? loadImage(spriteUrl) : null;
|
|
28938
|
+
if (shouldDiag) {
|
|
28939
|
+
canvasLog.debug("plat:draw", {
|
|
28940
|
+
platType,
|
|
28941
|
+
platX,
|
|
28942
|
+
platY,
|
|
28943
|
+
w: plat.width,
|
|
28944
|
+
h: plat.height,
|
|
28945
|
+
branch: tileImg ? "tile" : "color",
|
|
28946
|
+
natW: tileImg?.naturalWidth,
|
|
28947
|
+
natH: tileImg?.naturalHeight,
|
|
28948
|
+
spriteUrl: spriteUrl ?? null
|
|
28949
|
+
});
|
|
28950
|
+
}
|
|
28919
28951
|
if (tileImg) {
|
|
28920
28952
|
const tileW = tileImg.naturalWidth;
|
|
28921
28953
|
const tileH = tileImg.naturalHeight;
|
|
@@ -29007,13 +29039,14 @@ function PlatformerCanvas({
|
|
|
29007
29039
|
}
|
|
29008
29040
|
);
|
|
29009
29041
|
}
|
|
29010
|
-
var PLATFORM_COLORS, PLAYER_COLOR, PLAYER_EYE_COLOR, SKY_GRADIENT_TOP, SKY_GRADIENT_BOTTOM, GRID_COLOR;
|
|
29042
|
+
var canvasLog, PLATFORM_COLORS, PLAYER_COLOR, PLAYER_EYE_COLOR, SKY_GRADIENT_TOP, SKY_GRADIENT_BOTTOM, GRID_COLOR;
|
|
29011
29043
|
var init_PlatformerCanvas = __esm({
|
|
29012
29044
|
"components/game/molecules/PlatformerCanvas.tsx"() {
|
|
29013
29045
|
init_cn();
|
|
29014
29046
|
init_useEventBus();
|
|
29015
29047
|
init_verificationRegistry();
|
|
29016
29048
|
init_useRenderInterpolation();
|
|
29049
|
+
canvasLog = createLogger("almadar:ui:game:platformer-canvas");
|
|
29017
29050
|
PLATFORM_COLORS = {
|
|
29018
29051
|
ground: "#4a7c59",
|
|
29019
29052
|
platform: "#7c6b4a",
|
|
@@ -44359,14 +44392,20 @@ function PlatformerBoard({
|
|
|
44359
44392
|
grounded: false,
|
|
44360
44393
|
facingRight: true
|
|
44361
44394
|
};
|
|
44362
|
-
const
|
|
44363
|
-
const platforms = propPlatforms ?? entityPlatforms ?? [
|
|
44395
|
+
const platforms = propPlatforms ?? [
|
|
44364
44396
|
{ x: 0, y: 368, width: 800, height: 32, type: "ground" },
|
|
44365
44397
|
{ x: 150, y: 280, width: 160, height: 16, type: "platform" },
|
|
44366
44398
|
{ x: 420, y: 220, width: 160, height: 16, type: "platform" },
|
|
44367
44399
|
{ x: 580, y: 300, width: 80, height: 16, type: "hazard" },
|
|
44368
44400
|
{ x: 700, y: 340, width: 64, height: 28, type: "goal" }
|
|
44369
44401
|
];
|
|
44402
|
+
boardLog.debug("platforms-resolve", {
|
|
44403
|
+
propPlatformsCount: Array.isArray(propPlatforms) ? propPlatforms.length : null,
|
|
44404
|
+
usedFallback: propPlatforms === void 0,
|
|
44405
|
+
finalCount: platforms.length,
|
|
44406
|
+
player: { x: player.x, y: player.y, vx: player.vx, vy: player.vy, grounded: player.grounded },
|
|
44407
|
+
result
|
|
44408
|
+
});
|
|
44370
44409
|
const handleRestart = useCallback(() => {
|
|
44371
44410
|
if (playAgainEvent) {
|
|
44372
44411
|
eventBus.emit(`UI:${playAgainEvent}`, {});
|
|
@@ -44445,6 +44484,7 @@ function PlatformerBoard({
|
|
|
44445
44484
|
}
|
|
44446
44485
|
);
|
|
44447
44486
|
}
|
|
44487
|
+
var boardLog;
|
|
44448
44488
|
var init_PlatformerBoard = __esm({
|
|
44449
44489
|
"components/game/organisms/PlatformerBoard.tsx"() {
|
|
44450
44490
|
"use client";
|
|
@@ -44455,6 +44495,7 @@ var init_PlatformerBoard = __esm({
|
|
|
44455
44495
|
init_Typography();
|
|
44456
44496
|
init_Stack();
|
|
44457
44497
|
init_PlatformerCanvas();
|
|
44498
|
+
boardLog = createLogger("almadar:ui:game:platformer-board");
|
|
44458
44499
|
PlatformerBoard.displayName = "PlatformerBoard";
|
|
44459
44500
|
}
|
|
44460
44501
|
});
|
package/dist/runtime/index.cjs
CHANGED
|
@@ -28472,6 +28472,7 @@ function PlatformerCanvas({
|
|
|
28472
28472
|
const canvasRef = React81.useRef(null);
|
|
28473
28473
|
const eventBus = useEventBus();
|
|
28474
28474
|
const keysRef = React81.useRef(/* @__PURE__ */ new Set());
|
|
28475
|
+
const lastPlatCountRef = React81.useRef(-1);
|
|
28475
28476
|
const imageCache = React81.useRef(/* @__PURE__ */ new Map());
|
|
28476
28477
|
const [loadedImages, setLoadedImages] = React81.useState(/* @__PURE__ */ new Set());
|
|
28477
28478
|
const loadImage = React81.useCallback((url) => {
|
|
@@ -28627,6 +28628,24 @@ function PlatformerCanvas({
|
|
|
28627
28628
|
camX = Math.max(0, Math.min(px - cw / 2, ww - cw));
|
|
28628
28629
|
camY = Math.max(0, Math.min(py - ch / 2 - 50, wh - ch));
|
|
28629
28630
|
}
|
|
28631
|
+
const shouldDiag = plats.length !== lastPlatCountRef.current;
|
|
28632
|
+
if (shouldDiag) {
|
|
28633
|
+
lastPlatCountRef.current = plats.length;
|
|
28634
|
+
canvasLog.debug("draw:platforms", {
|
|
28635
|
+
platformCount: plats.length,
|
|
28636
|
+
camX,
|
|
28637
|
+
camY,
|
|
28638
|
+
plat0: JSON.stringify(plats[0]),
|
|
28639
|
+
plat2: JSON.stringify(plats[2]),
|
|
28640
|
+
tSpritesType: tSprites ? tSprites instanceof Map ? "Map" : typeof tSprites : "none",
|
|
28641
|
+
canvasW: canvas.width,
|
|
28642
|
+
canvasH: canvas.height,
|
|
28643
|
+
player: { x: px, y: py },
|
|
28644
|
+
worldWidth: ww,
|
|
28645
|
+
canvasWidth: cw,
|
|
28646
|
+
followCamera: fc
|
|
28647
|
+
});
|
|
28648
|
+
}
|
|
28630
28649
|
const bgImage = bgImg ? loadImage(bgImg) : null;
|
|
28631
28650
|
if (bgImage) {
|
|
28632
28651
|
ctx.drawImage(bgImage, 0, 0, cw, ch);
|
|
@@ -28661,6 +28680,19 @@ function PlatformerCanvas({
|
|
|
28661
28680
|
const platType = plat.type ?? "ground";
|
|
28662
28681
|
const spriteUrl = tSprites?.[platType];
|
|
28663
28682
|
const tileImg = spriteUrl ? loadImage(spriteUrl) : null;
|
|
28683
|
+
if (shouldDiag) {
|
|
28684
|
+
canvasLog.debug("plat:draw", {
|
|
28685
|
+
platType,
|
|
28686
|
+
platX,
|
|
28687
|
+
platY,
|
|
28688
|
+
w: plat.width,
|
|
28689
|
+
h: plat.height,
|
|
28690
|
+
branch: tileImg ? "tile" : "color",
|
|
28691
|
+
natW: tileImg?.naturalWidth,
|
|
28692
|
+
natH: tileImg?.naturalHeight,
|
|
28693
|
+
spriteUrl: spriteUrl ?? null
|
|
28694
|
+
});
|
|
28695
|
+
}
|
|
28664
28696
|
if (tileImg) {
|
|
28665
28697
|
const tileW = tileImg.naturalWidth;
|
|
28666
28698
|
const tileH = tileImg.naturalHeight;
|
|
@@ -28752,13 +28784,14 @@ function PlatformerCanvas({
|
|
|
28752
28784
|
}
|
|
28753
28785
|
);
|
|
28754
28786
|
}
|
|
28755
|
-
var PLATFORM_COLORS, PLAYER_COLOR, PLAYER_EYE_COLOR, SKY_GRADIENT_TOP, SKY_GRADIENT_BOTTOM, GRID_COLOR;
|
|
28787
|
+
var canvasLog, PLATFORM_COLORS, PLAYER_COLOR, PLAYER_EYE_COLOR, SKY_GRADIENT_TOP, SKY_GRADIENT_BOTTOM, GRID_COLOR;
|
|
28756
28788
|
var init_PlatformerCanvas = __esm({
|
|
28757
28789
|
"components/game/molecules/PlatformerCanvas.tsx"() {
|
|
28758
28790
|
init_cn();
|
|
28759
28791
|
init_useEventBus();
|
|
28760
28792
|
init_verificationRegistry();
|
|
28761
28793
|
init_useRenderInterpolation();
|
|
28794
|
+
canvasLog = logger.createLogger("almadar:ui:game:platformer-canvas");
|
|
28762
28795
|
PLATFORM_COLORS = {
|
|
28763
28796
|
ground: "#4a7c59",
|
|
28764
28797
|
platform: "#7c6b4a",
|
|
@@ -44104,14 +44137,20 @@ function PlatformerBoard({
|
|
|
44104
44137
|
grounded: false,
|
|
44105
44138
|
facingRight: true
|
|
44106
44139
|
};
|
|
44107
|
-
const
|
|
44108
|
-
const platforms = propPlatforms ?? entityPlatforms ?? [
|
|
44140
|
+
const platforms = propPlatforms ?? [
|
|
44109
44141
|
{ x: 0, y: 368, width: 800, height: 32, type: "ground" },
|
|
44110
44142
|
{ x: 150, y: 280, width: 160, height: 16, type: "platform" },
|
|
44111
44143
|
{ x: 420, y: 220, width: 160, height: 16, type: "platform" },
|
|
44112
44144
|
{ x: 580, y: 300, width: 80, height: 16, type: "hazard" },
|
|
44113
44145
|
{ x: 700, y: 340, width: 64, height: 28, type: "goal" }
|
|
44114
44146
|
];
|
|
44147
|
+
boardLog.debug("platforms-resolve", {
|
|
44148
|
+
propPlatformsCount: Array.isArray(propPlatforms) ? propPlatforms.length : null,
|
|
44149
|
+
usedFallback: propPlatforms === void 0,
|
|
44150
|
+
finalCount: platforms.length,
|
|
44151
|
+
player: { x: player.x, y: player.y, vx: player.vx, vy: player.vy, grounded: player.grounded },
|
|
44152
|
+
result
|
|
44153
|
+
});
|
|
44115
44154
|
const handleRestart = React81.useCallback(() => {
|
|
44116
44155
|
if (playAgainEvent) {
|
|
44117
44156
|
eventBus.emit(`UI:${playAgainEvent}`, {});
|
|
@@ -44190,6 +44229,7 @@ function PlatformerBoard({
|
|
|
44190
44229
|
}
|
|
44191
44230
|
);
|
|
44192
44231
|
}
|
|
44232
|
+
var boardLog;
|
|
44193
44233
|
var init_PlatformerBoard = __esm({
|
|
44194
44234
|
"components/game/organisms/PlatformerBoard.tsx"() {
|
|
44195
44235
|
"use client";
|
|
@@ -44200,6 +44240,7 @@ var init_PlatformerBoard = __esm({
|
|
|
44200
44240
|
init_Typography();
|
|
44201
44241
|
init_Stack();
|
|
44202
44242
|
init_PlatformerCanvas();
|
|
44243
|
+
boardLog = logger.createLogger("almadar:ui:game:platformer-board");
|
|
44203
44244
|
PlatformerBoard.displayName = "PlatformerBoard";
|
|
44204
44245
|
}
|
|
44205
44246
|
});
|
package/dist/runtime/index.js
CHANGED
|
@@ -28425,6 +28425,7 @@ function PlatformerCanvas({
|
|
|
28425
28425
|
const canvasRef = useRef(null);
|
|
28426
28426
|
const eventBus = useEventBus();
|
|
28427
28427
|
const keysRef = useRef(/* @__PURE__ */ new Set());
|
|
28428
|
+
const lastPlatCountRef = useRef(-1);
|
|
28428
28429
|
const imageCache = useRef(/* @__PURE__ */ new Map());
|
|
28429
28430
|
const [loadedImages, setLoadedImages] = useState(/* @__PURE__ */ new Set());
|
|
28430
28431
|
const loadImage = useCallback((url) => {
|
|
@@ -28580,6 +28581,24 @@ function PlatformerCanvas({
|
|
|
28580
28581
|
camX = Math.max(0, Math.min(px - cw / 2, ww - cw));
|
|
28581
28582
|
camY = Math.max(0, Math.min(py - ch / 2 - 50, wh - ch));
|
|
28582
28583
|
}
|
|
28584
|
+
const shouldDiag = plats.length !== lastPlatCountRef.current;
|
|
28585
|
+
if (shouldDiag) {
|
|
28586
|
+
lastPlatCountRef.current = plats.length;
|
|
28587
|
+
canvasLog.debug("draw:platforms", {
|
|
28588
|
+
platformCount: plats.length,
|
|
28589
|
+
camX,
|
|
28590
|
+
camY,
|
|
28591
|
+
plat0: JSON.stringify(plats[0]),
|
|
28592
|
+
plat2: JSON.stringify(plats[2]),
|
|
28593
|
+
tSpritesType: tSprites ? tSprites instanceof Map ? "Map" : typeof tSprites : "none",
|
|
28594
|
+
canvasW: canvas.width,
|
|
28595
|
+
canvasH: canvas.height,
|
|
28596
|
+
player: { x: px, y: py },
|
|
28597
|
+
worldWidth: ww,
|
|
28598
|
+
canvasWidth: cw,
|
|
28599
|
+
followCamera: fc
|
|
28600
|
+
});
|
|
28601
|
+
}
|
|
28583
28602
|
const bgImage = bgImg ? loadImage(bgImg) : null;
|
|
28584
28603
|
if (bgImage) {
|
|
28585
28604
|
ctx.drawImage(bgImage, 0, 0, cw, ch);
|
|
@@ -28614,6 +28633,19 @@ function PlatformerCanvas({
|
|
|
28614
28633
|
const platType = plat.type ?? "ground";
|
|
28615
28634
|
const spriteUrl = tSprites?.[platType];
|
|
28616
28635
|
const tileImg = spriteUrl ? loadImage(spriteUrl) : null;
|
|
28636
|
+
if (shouldDiag) {
|
|
28637
|
+
canvasLog.debug("plat:draw", {
|
|
28638
|
+
platType,
|
|
28639
|
+
platX,
|
|
28640
|
+
platY,
|
|
28641
|
+
w: plat.width,
|
|
28642
|
+
h: plat.height,
|
|
28643
|
+
branch: tileImg ? "tile" : "color",
|
|
28644
|
+
natW: tileImg?.naturalWidth,
|
|
28645
|
+
natH: tileImg?.naturalHeight,
|
|
28646
|
+
spriteUrl: spriteUrl ?? null
|
|
28647
|
+
});
|
|
28648
|
+
}
|
|
28617
28649
|
if (tileImg) {
|
|
28618
28650
|
const tileW = tileImg.naturalWidth;
|
|
28619
28651
|
const tileH = tileImg.naturalHeight;
|
|
@@ -28705,13 +28737,14 @@ function PlatformerCanvas({
|
|
|
28705
28737
|
}
|
|
28706
28738
|
);
|
|
28707
28739
|
}
|
|
28708
|
-
var PLATFORM_COLORS, PLAYER_COLOR, PLAYER_EYE_COLOR, SKY_GRADIENT_TOP, SKY_GRADIENT_BOTTOM, GRID_COLOR;
|
|
28740
|
+
var canvasLog, PLATFORM_COLORS, PLAYER_COLOR, PLAYER_EYE_COLOR, SKY_GRADIENT_TOP, SKY_GRADIENT_BOTTOM, GRID_COLOR;
|
|
28709
28741
|
var init_PlatformerCanvas = __esm({
|
|
28710
28742
|
"components/game/molecules/PlatformerCanvas.tsx"() {
|
|
28711
28743
|
init_cn();
|
|
28712
28744
|
init_useEventBus();
|
|
28713
28745
|
init_verificationRegistry();
|
|
28714
28746
|
init_useRenderInterpolation();
|
|
28747
|
+
canvasLog = createLogger("almadar:ui:game:platformer-canvas");
|
|
28715
28748
|
PLATFORM_COLORS = {
|
|
28716
28749
|
ground: "#4a7c59",
|
|
28717
28750
|
platform: "#7c6b4a",
|
|
@@ -44057,14 +44090,20 @@ function PlatformerBoard({
|
|
|
44057
44090
|
grounded: false,
|
|
44058
44091
|
facingRight: true
|
|
44059
44092
|
};
|
|
44060
|
-
const
|
|
44061
|
-
const platforms = propPlatforms ?? entityPlatforms ?? [
|
|
44093
|
+
const platforms = propPlatforms ?? [
|
|
44062
44094
|
{ x: 0, y: 368, width: 800, height: 32, type: "ground" },
|
|
44063
44095
|
{ x: 150, y: 280, width: 160, height: 16, type: "platform" },
|
|
44064
44096
|
{ x: 420, y: 220, width: 160, height: 16, type: "platform" },
|
|
44065
44097
|
{ x: 580, y: 300, width: 80, height: 16, type: "hazard" },
|
|
44066
44098
|
{ x: 700, y: 340, width: 64, height: 28, type: "goal" }
|
|
44067
44099
|
];
|
|
44100
|
+
boardLog.debug("platforms-resolve", {
|
|
44101
|
+
propPlatformsCount: Array.isArray(propPlatforms) ? propPlatforms.length : null,
|
|
44102
|
+
usedFallback: propPlatforms === void 0,
|
|
44103
|
+
finalCount: platforms.length,
|
|
44104
|
+
player: { x: player.x, y: player.y, vx: player.vx, vy: player.vy, grounded: player.grounded },
|
|
44105
|
+
result
|
|
44106
|
+
});
|
|
44068
44107
|
const handleRestart = useCallback(() => {
|
|
44069
44108
|
if (playAgainEvent) {
|
|
44070
44109
|
eventBus.emit(`UI:${playAgainEvent}`, {});
|
|
@@ -44143,6 +44182,7 @@ function PlatformerBoard({
|
|
|
44143
44182
|
}
|
|
44144
44183
|
);
|
|
44145
44184
|
}
|
|
44185
|
+
var boardLog;
|
|
44146
44186
|
var init_PlatformerBoard = __esm({
|
|
44147
44187
|
"components/game/organisms/PlatformerBoard.tsx"() {
|
|
44148
44188
|
"use client";
|
|
@@ -44153,6 +44193,7 @@ var init_PlatformerBoard = __esm({
|
|
|
44153
44193
|
init_Typography();
|
|
44154
44194
|
init_Stack();
|
|
44155
44195
|
init_PlatformerCanvas();
|
|
44196
|
+
boardLog = createLogger("almadar:ui:game:platformer-board");
|
|
44156
44197
|
PlatformerBoard.displayName = "PlatformerBoard";
|
|
44157
44198
|
}
|
|
44158
44199
|
});
|