Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

fix: web build (spine index widening) + align stale examples to SDK

esengine6b3d0ace0a01
diff --git a/examples/audio-demo/src/systems/sfx.ts b/examples/audio-demo/src/systems/sfx.ts
index 2890cf15c..1f066391f 100644
--- a/examples/audio-demo/src/systems/sfx.ts
+++ b/examples/audio-demo/src/systems/sfx.ts
@@ -22,7 +22,7 @@ export const sfxTriggerSystem = defineSystem(
trigger.cooldown = Math.max(0, trigger.cooldown - time.delta);
const key = `Digit${triggerIndex + 1}`;
- const clicked = events.hasEvent(entity, 'click');
+ const clicked = events.query('click').some(e => e.target === entity);
if ((input.isKeyPressed(key) || clicked) && trigger.cooldown <= 0) {
const url = SFX_URLS[triggerIndex];
if (url) {
diff --git a/examples/ui-controls/src/main.ts b/examples/ui-controls/src/main.ts
index b0188bbd8..e2d4123c7 100644
--- a/examples/ui-controls/src/main.ts
+++ b/examples/ui-controls/src/main.ts
@@ -1,6 +1,5 @@
-import { addSystemToSchedule, Schedule } from 'esengine';
-
+// The progress bars in this scene are declarative (defined in the .esscene).
+// The old per-frame ProgressBar-component animation was removed: the SDK no
+// longer exposes a queryable ProgressBar component — progress is now an
+// imperative widget (createProgress -> ProgressHandle).
import './components';
-import { progressAnimateSystem } from './systems/animate';
-
-addSystemToSchedule(Schedule.Update, progressAnimateSystem);
diff --git a/examples/ui-controls/src/systems/animate.ts b/examples/ui-controls/src/systems/animate.ts
deleted file mode 100644
index 8fe5e8824..000000000
--- a/examples/ui-controls/src/systems/animate.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-import {
- defineSystem, Query, Mut, Res, Time, ProgressBar,
-} from 'esengine';
-import { ProgressAnimator } from '../components';
-
-export const progressAnimateSystem = defineSystem(
- [Query(Mut(ProgressBar), Mut(ProgressAnimator)), Res(Time)],
- (query, time) => {
- for (const [_entity, bar, animator] of query) {
- bar.value += animator.speed * animator.direction * time.delta;
- if (bar.value >= 1) {
- bar.value = 1;
- animator.direction = -1;
- } else if (bar.value <= 0) {
- bar.value = 0;
- animator.direction = 1;
- }
- }
- },
- { name: 'ProgressAnimateSystem' }
-);
diff --git a/examples/ui-interaction/src/systems/dragFocus.ts b/examples/ui-interaction/src/systems/dragFocus.ts
index ab0b55741..9966b88fe 100644
--- a/examples/ui-interaction/src/systems/dragFocus.ts
+++ b/examples/ui-interaction/src/systems/dragFocus.ts
@@ -72,8 +72,8 @@ export const dragFocusSystem = defineSystem(
return;
}
- const dragStartEntities = new Set(events.query('drag_start').map(e => e.entity));
- const dragEndEntities = new Set(events.query('drag_end').map(e => e.entity));
+ const dragStartEntities = new Set(events.query('drag_start').map(e => e.target));
+ const dragEndEntities = new Set(events.query('drag_end').map(e => e.target));
for (const e of dragStartEntities) {
droppedEntities.delete(e);
diff --git a/src/esengine/renderer/RenderFrameSubmit.cpp b/src/esengine/renderer/RenderFrameSubmit.cpp
index 4367706a7..2e9a88cd5 100644
--- a/src/esengine/renderer/RenderFrameSubmit.cpp
+++ b/src/esengine/renderer/RenderFrameSubmit.cpp
@@ -83,9 +83,9 @@ void RenderFrame::submitSpineBatch(
}
u32 baseVertex = vOff / sizeof(BatchVertex);
- std::vector<u16> offsetIndices(indexCount);
+ std::vector<u32> offsetIndices(indexCount);
for (i32 i = 0; i < indexCount; ++i) {
- offsetIndices[i] = static_cast<u16>(baseVertex + indices[i]);
+ offsetIndices[i] = static_cast<u32>(baseVertex + indices[i]);
}
u32 iOff = pool_.appendIndices(LayoutId::Batch, offsetIndices.data(), static_cast<u32>(indexCount));