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.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
feat(render): a sprite says how it fills its box, instead of its texture saying
esengine7023c1992a8e
diff --git a/.github/workflows/build.yml b/.github/workflows/build.ymlindex 6a4b83396..a46290177 100644--- a/.github/workflows/build.yml+++ b/.github/workflows/build.yml@@ -29,7 +29,7 @@ env:test_registry_ondestroy test_view_api_matrixtest_shader_device test_draw_params test_texture_fb test_buffer_devicetest_compressed_format test_batch_builder test_boundary_span test_webgpu_device- test_clip_depth test_sort_key test_sprite_mask_range test_shadow_atlas test_particle_shapes test_lod_selection test_hdr_format test_probe_store test_occlusion_view test_reflection_store+ test_clip_depth test_sort_key test_sprite_mask_range test_sprite_draw_mode test_shadow_atlas test_particle_shapes test_lod_selection test_hdr_format test_probe_store test_occlusion_view test_reflection_storetest_text_edit test_render_graph test_device_loss test_physics_interpolationtest_bitmap_font test_texture_cache test_mesh_recovery test_aot_host test_aot_conformancetest_touch_streamdiff --git a/CHANGELOG.md b/CHANGELOG.mdindex e8ed1cc32..ac981b096 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -41,6 +41,15 @@ published separately; it ships inside the editor.### Added+- **A sprite can be drawn whole even when its texture carries a 9-slice border.** The+ texture decided, not the entity using it: import a panel image with slice borders and+ every Sprite showing it was 9-sliced, with nothing on the entity able to say otherwise.+ Sprites now have a **Draw Mode** — *Auto* is the old inference (tile size decides+ tiling, the texture's border decides 9-slice) and stays the default, so nothing you+ have drawn changes; *Simple*, *Tiled* and *9-Slice* say it outright. An override cannot+ invent what it needs, so *Tiled* with no tile size and *9-Slice* on a texture with no+ border both draw the plain quad, which is what the sprite would have drawn anyway.+- **A WeChat mini-game now carries only the optional subsystems its project uses.**The engine binary was never the only thing a package paid for whether it needed it ornot: the JavaScript bundle carried Spine, DragonBones, 2D physics, 3D physics and videodiff --git a/sdk/src/ecs/bridge/ptrAccessors.generated.ts b/sdk/src/ecs/bridge/ptrAccessors.generated.tsindex ee5e927c2..aa0729edb 100644--- a/sdk/src/ecs/bridge/ptrAccessors.generated.ts+++ b/sdk/src/ecs/bridge/ptrAccessors.generated.ts@@ -1802,6 +1802,7 @@ export interface SpritePtrData {lit: boolean;flipX: boolean;flipY: boolean;+ drawMode: number;tileSize: Vec2;tileSpacing: Vec2;parallax: Vec2;@@ -1825,6 +1826,7 @@ export function fillSprite(out.lit = u8[ptr + 64] !== 0;out.flipX = u8[ptr + 65] !== 0;out.flipY = u8[ptr + 66] !== 0;+ out.drawMode = u8[ptr + 67];const tileSize_ = out.tileSize; tileSize_.x = f32[(ptr + 68) >> 2]; tileSize_.y = f32[((ptr + 68) >> 2) + 1];const tileSpacing_ = out.tileSpacing; tileSpacing_.x = f32[(ptr + 76) >> 2]; tileSpacing_.y = f32[((ptr + 76) >> 2) + 1];const parallax_ = out.parallax; parallax_.x = f32[(ptr + 84) >> 2]; parallax_.y = f32[((ptr + 84) >> 2) + 1];@@ -1848,6 +1850,7 @@ export function writeSprite(u8[ptr + 64] = data.lit ? 1 : 0;u8[ptr + 65] = data.flipX ? 1 : 0;u8[ptr + 66] = data.flipY ? 1 : 0;+ u8[ptr + 67] = data.drawMode;f32[(ptr + 68) >> 2] = data.tileSize.x; f32[((ptr + 68) >> 2) + 1] = data.tileSize.y;f32[(ptr + 76) >> 2] = data.tileSpacing.x; f32[((ptr + 76) >> 2) + 1] = data.tileSpacing.y;f32[(ptr + 84) >> 2] = data.parallax.x; f32[((ptr + 84) >> 2) + 1] = data.parallax.y;@@ -1869,6 +1872,7 @@ export function createSpriteData(): SpritePtrData {lit: false,flipX: false,flipY: false,+ drawMode: 0,tileSize: { x: 0, y: 0 },tileSpacing: { x: 0, y: 0 },parallax: { x: 0, y: 0 },diff --git a/sdk/src/ecs/component.generated.ts b/sdk/src/ecs/component.generated.tsindex e55b6fa91..314b4f9e9 100644--- a/sdk/src/ecs/component.generated.ts+++ b/sdk/src/ecs/component.generated.ts@@ -7,7 +7,7 @@import type { AssetFieldType } from '../scene/scene';import type { FieldMeta } from './component';import type { Color, Entity, Quat, Vec2, Vec3, Vec4 } from '../types';-import type { AlignContent, AlignItems, AlignSelf, BodyType, CanvasScaleMode, ClearFlags, Dimension, EmitterShape, FlexDirection, FlexWrap, ForceFieldType, JustifyContent, LightType, MaskMode, Padding, ParticleEasing, ProjectionType, ScrollMovement, ShapeType, SimulationSpace, SpriteMaskInteraction, SubEmitterTrigger, TextAlign, TilemapOrientation, TilemapStaggerAxis, TilemapStaggerIndex, UIDisplay, UIFillMethod, UIFillOrigin, UIPointerEvents, UIPositionType, UIVisualFit, UIVisualType } from '../wasm/wasm.generated';+import type { AlignContent, AlignItems, AlignSelf, BodyType, CanvasScaleMode, ClearFlags, Dimension, EmitterShape, FlexDirection, FlexWrap, ForceFieldType, JustifyContent, LightType, MaskMode, Padding, ParticleEasing, ProjectionType, ScrollMovement, ShapeType, SimulationSpace, SpriteDrawMode, SpriteMaskInteraction, SubEmitterTrigger, TextAlign, TilemapOrientation, TilemapStaggerAxis, TilemapStaggerIndex, UIDisplay, UIFillMethod, UIFillOrigin, UIPointerEvents, UIPositionType, UIVisualFit, UIVisualType } from '../wasm/wasm.generated';/*** Single-source-of-truth hash of the C++/TS boundary ABI (component@@ -15,7 +15,7 @@ import type { AlignContent, AlignItems, AlignSelf, BodyType, CanvasScaleMode, Cl* getAbiLayoutHash(); BuiltinBridge.connect() compares them and refuses to* run on mismatch, because mismatched offsets read the wrong heap bytes.*/-export const ABI_LAYOUT_HASH = '10bb7593c5d041c3';+export const ABI_LAYOUT_HASH = '101981b3fea145cb';/*** One asset-valued field of a component: which field, and what kind of@@ -975,6 +975,7 @@ export const COMPONENT_META: Record<string, ComponentMetaEntry> = {lit: false,flipX: false,flipY: false,+ drawMode: 0,tileSize: { x: 0, y: 0 },tileSpacing: { x: 0, y: 0 },parallax: { x: 1, y: 1 },@@ -998,6 +999,7 @@ export const COMPONENT_META: Record<string, ComponentMetaEntry> = {order: { min: -128, max: 127, step: 1, tooltip: "Draw order inside the sorting layer — higher draws on top. Overrides the layer's Y-sort or depth ordering; leave 0 to keep it." },maskInteraction: { enum: [{ label: 'None', value: 0 }, { label: 'VisibleInside', value: 1 }, { label: 'VisibleOutside', value: 2 }], tooltip: "Whether a SpriteMask drawn before this sprite clips it, and which side survives." },lit: { tooltip: "Receive 2D lights: Light entities light this sprite (flat normal). A custom material overrides this." },+ drawMode: { enum: [{ label: 'Auto', value: 0 }, { label: 'Simple', value: 1 }, { label: 'Tiled', value: 2 }, { label: 'NineSlice', value: 3 }], tooltip: "Draw mode: Auto infers from tile size and the texture's 9-slice border; the others override it." },tileSize: { advanced: true },tileSpacing: { advanced: true },parallax: { tooltip: "Parallax scroll factor (1 = with world, <1 = slower, 0 = locked to camera).", advanced: true },@@ -1716,6 +1718,7 @@ export interface SpriteData {lit: boolean;flipX: boolean;flipY: boolean;+ drawMode: SpriteDrawMode;tileSize: Vec2;tileSpacing: Vec2;parallax: Vec2;diff --git a/sdk/src/wasm/ptrLayouts.generated.ts b/sdk/src/wasm/ptrLayouts.generated.tsindex 41a723537..be61b6125 100644--- a/sdk/src/wasm/ptrLayouts.generated.ts+++ b/sdk/src/wasm/ptrLayouts.generated.ts@@ -487,6 +487,7 @@ export const PTR_LAYOUTS: Record<string, PtrLayout> = {{ name: 'lit', type: 'bool', offset: 64 },{ name: 'flipX', type: 'bool', offset: 65 },{ name: 'flipY', type: 'bool', offset: 66 },+ { name: 'drawMode', type: 'u8', offset: 67 },{ name: 'tileSize', type: 'vec2', offset: 68 },{ name: 'tileSpacing', type: 'vec2', offset: 76 },{ name: 'parallax', type: 'vec2', offset: 84 },diff --git a/sdk/src/wasm/wasm.generated.ts b/sdk/src/wasm/wasm.generated.tsindex 92d4e2432..66788e9cd 100644--- a/sdk/src/wasm/wasm.generated.ts+++ b/sdk/src/wasm/wasm.generated.ts@@ -213,6 +213,18 @@ export enum SimulationSpace {Local = 1,}+/**+ * The engine's `SpriteDrawMode`, generated from the C++ enum.+ *+ * @beta+ */+export enum SpriteDrawMode {+ Auto = 0,+ Simple = 1,+ Tiled = 2,+ NineSlice = 3,+}+/*** The engine's `SpriteMaskInteraction`, generated from the C++ enum.*@@ -792,6 +804,7 @@ export interface Sprite {lit: boolean;flipX: boolean;flipY: boolean;+ drawMode: number;tileSize: Vec2;tileSpacing: Vec2;parallax: Vec2;diff --git a/sdk/tests/__snapshots__/component-fieldmeta-golden.test.ts.snap b/sdk/tests/__snapshots__/component-fieldmeta-golden.test.ts.snapindex 1298bb033..56d313a4b 100644--- a/sdk/tests/__snapshots__/component-fieldmeta-golden.test.ts.snap+++ b/sdk/tests/__snapshots__/component-fieldmeta-golden.test.ts.snap@@ -1035,6 +1035,27 @@ exports[`builtin FieldMeta (RC9-1 equivalence gate) > matches the golden snapsho"color": {"tooltip": "Tint multiplied into the texture (white = unchanged).",},+ "drawMode": {+ "enum": [+ {+ "label": "Auto",+ "value": 0,+ },+ {+ "label": "Simple",+ "value": 1,+ },+ {+ "label": "Tiled",+ "value": 2,+ },+ {+ "label": "NineSlice",+ "value": 3,+ },+ ],+ "tooltip": "Draw mode: Auto infers from tile size and the texture's 9-slice border; the others override it.",+ },"layer": {"enumSource": "sortingLayers","step": 1,diff --git a/src/esengine/bindings/EditorAPI.generated.cpp b/src/esengine/bindings/EditorAPI.generated.cppindex 2943b9567..0f34f4130 100644--- a/src/esengine/bindings/EditorAPI.generated.cpp+++ b/src/esengine/bindings/EditorAPI.generated.cpp@@ -2,10 +2,10 @@* @file EditorAPI.generated.cpp* @brief Auto-generated editor API with string-dispatched component access* @details Generated by EHT - DO NOT EDIT- * @schema_hash b8b8da4186821947+ * @schema_hash 2120a32e914a77a3*/-#define ES_EDITOR_API_SCHEMA_HASH "b8b8da4186821947"+#define ES_EDITOR_API_SCHEMA_HASH "2120a32e914a77a3"#include <emscripten/bind.h>#include <string>@@ -617,6 +617,7 @@ std::string editor_getComponentSchema(const std::string& name) {{"key":"lit","type":"bool","group":"Sprite"},{"key":"flipX","type":"bool","group":"Sprite"},{"key":"flipY","type":"bool","group":"Sprite"},+ {"key":"drawMode","type":"enum","group":"Sprite","values":["Auto","Simple","Tiled","NineSlice"]},{"key":"tileSize.x","type":"float","group":"Sprite"},{"key":"tileSize.y","type":"float","group":"Sprite"},{"key":"tileSpacing.x","type":"float","group":"Sprite"},@@ -2367,6 +2368,7 @@ bool editor_setInt(Registry& reg, u32 e, const std::string& comp, const std::strelse if (field == "layer") { c.layer = static_cast<i32>(value); }else if (field == "order") { c.order = static_cast<i32>(value); }else if (field == "maskInteraction") { c.maskInteraction = static_cast<i32>(value); }+ else if (field == "drawMode") { c.drawMode = static_cast<SpriteDrawMode>(value); }else if (field == "material") { c.material = static_cast<u32>(value); }else { return false; }return true;@@ -2595,6 +2597,7 @@ i32 editor_getInt(Registry& reg, u32 e, const std::string& comp, const std::strielse if (field == "layer") { return static_cast<i32>(c.layer); }else if (field == "order") { return static_cast<i32>(c.order); }else if (field == "maskInteraction") { return static_cast<i32>(c.maskInteraction); }+ else if (field == "drawMode") { return static_cast<i32>(c.drawMode); }else if (field == "material") { return static_cast<i32>(c.material); }} else if (comp == "SpriteMask") {if (!reg.has<esengine::ecs::SpriteMask>(entity)) return 0;diff --git a/src/esengine/bindings/WebBindings.generated.cpp b/src/esengine/bindings/WebBindings.generated.cppindex 34f797a74..3f05f86f0 100644--- a/src/esengine/bindings/WebBindings.generated.cpp+++ b/src/esengine/bindings/WebBindings.generated.cpp@@ -224,6 +224,12 @@ EMSCRIPTEN_BINDINGS(esengine_enums) {.value("World", esengine::ecs::SimulationSpace::World).value("Local", esengine::ecs::SimulationSpace::Local);+ enum_<esengine::ecs::SpriteDrawMode>("SpriteDrawMode")+ .value("Auto", esengine::ecs::SpriteDrawMode::Auto)+ .value("Simple", esengine::ecs::SpriteDrawMode::Simple)+ .value("Tiled", esengine::ecs::SpriteDrawMode::Tiled)+ .value("NineSlice", esengine::ecs::SpriteDrawMode::NineSlice);+enum_<esengine::ecs::SpriteMaskInteraction>("SpriteMaskInteraction").value("None", esengine::ecs::SpriteMaskInteraction::None).value("VisibleInside", esengine::ecs::SpriteMaskInteraction::VisibleInside)@@ -1161,6 +1167,7 @@ struct SpriteJS {bool lit;bool flipX;bool flipY;+ i32 drawMode;glm::vec2 tileSize;glm::vec2 tileSpacing;glm::vec2 parallax;@@ -1181,6 +1188,7 @@ void spriteApplyJS(esengine::ecs::Sprite& c, const SpriteJS& js) {c.lit = js.lit;c.flipX = js.flipX;c.flipY = js.flipY;+ c.drawMode = static_cast<SpriteDrawMode>(js.drawMode);c.tileSize = js.tileSize;c.tileSpacing = js.tileSpacing;c.parallax = js.parallax;@@ -1208,6 +1216,7 @@ SpriteJS spriteToJS(const esengine::ecs::Sprite& c) {js.lit = c.lit;js.flipX = c.flipX;js.flipY = c.flipY;+ js.drawMode = static_cast<i32>(c.drawMode);js.tileSize = c.tileSize;js.tileSpacing = c.tileSpacing;js.parallax = c.parallax;@@ -1920,6 +1929,7 @@ EMSCRIPTEN_BINDINGS(esengine_components) {.field("lit", &SpriteJS::lit).field("flipX", &SpriteJS::flipX).field("flipY", &SpriteJS::flipY)+ .field("drawMode", &SpriteJS::drawMode).field("tileSize", &SpriteJS::tileSize).field("tileSpacing", &SpriteJS::tileSpacing).field("parallax", &SpriteJS::parallax)@@ -3492,6 +3502,7 @@ static_assert(offsetof(esengine::ecs::Sprite, maskInteraction) == 60, "ABI offsestatic_assert(offsetof(esengine::ecs::Sprite, lit) == 64, "ABI offset drift: esengine::ecs::Sprite.lit (EHT expected 64)");static_assert(offsetof(esengine::ecs::Sprite, flipX) == 65, "ABI offset drift: esengine::ecs::Sprite.flipX (EHT expected 65)");static_assert(offsetof(esengine::ecs::Sprite, flipY) == 66, "ABI offset drift: esengine::ecs::Sprite.flipY (EHT expected 66)");+static_assert(offsetof(esengine::ecs::Sprite, drawMode) == 67, "ABI offset drift: esengine::ecs::Sprite.drawMode (EHT expected 67)");static_assert(offsetof(esengine::ecs::Sprite, tileSize) == 68, "ABI offset drift: esengine::ecs::Sprite.tileSize (EHT expected 68)");static_assert(offsetof(esengine::ecs::Sprite, tileSpacing) == 76, "ABI offset drift: esengine::ecs::Sprite.tileSpacing (EHT expected 76)");static_assert(offsetof(esengine::ecs::Sprite, parallax) == 84, "ABI offset drift: esengine::ecs::Sprite.parallax (EHT expected 84)");@@ -3591,7 +3602,7 @@ static_assert(offsetof(esengine::ecs::Velocity, angular) == 12, "ABI offset drif// ABI Hash -- runtime handshake against the SDK bundle// =============================================================================-static const char* kEsAbiLayoutHash = "10bb7593c5d041c3";+static const char* kEsAbiLayoutHash = "101981b3fea145cb";std::string esengineGetAbiLayoutHash() {return std::string(kEsAbiLayoutHash);diff --git a/src/esengine/ecs/components/Sprite.hpp b/src/esengine/ecs/components/Sprite.hppindex c59af0546..55d9d5503 100644--- a/src/esengine/ecs/components/Sprite.hpp+++ b/src/esengine/ecs/components/Sprite.hpp@@ -28,6 +28,22 @@ namespace esengine::ecs {// Sprite Component// =============================================================================+/**+ * @brief How a Sprite fills its box.+ *+ * @details Auto infers it: tileSize decides tiling, the texture's slice border+ * decides 9-slice. The other three are the author overriding that, and+ * an override cannot invent data — Tiled with no tileSize and NineSlice+ * with no border both draw the plain quad.+ */+ES_ENUM(stability=beta)+enum class SpriteDrawMode : u8 {+ Auto,+ Simple,+ Tiled,+ NineSlice+};+/*** @brief 2D sprite component for rendering*@@ -109,6 +125,11 @@ struct Sprite {ES_PROPERTY()bool flipY{false};+ /** @brief How this sprite fills its box; Auto infers it from tileSize and the+ * texture's slice border. */+ ES_PROPERTY(tooltip="Draw mode: Auto infers from tile size and the texture's 9-slice border; the others override it.")+ SpriteDrawMode drawMode{SpriteDrawMode::Auto};+/** @brief Tile size in world units for tiling mode ({0,0} = no tiling) */ES_PROPERTY(advanced)glm::vec2 tileSize{0.0f, 0.0f};diff --git a/src/esengine/renderer/draw/SpriteDrawResolve.hpp b/src/esengine/renderer/draw/SpriteDrawResolve.hppnew file mode 100644index 000000000..0970324a9--- /dev/null+++ b/src/esengine/renderer/draw/SpriteDrawResolve.hpp@@ -0,0 +1,47 @@+// SPDX-License-Identifier: Apache-2.0+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team+/**+ * @file SpriteDrawResolve.hpp+ * @brief Which geometry a Sprite draws — the rule, apart from the frame.+ * @details Pure so it can be held to cases directly: a frame shows that SOME+ * geometry was emitted, never which rule chose it.+ *+ * @copyright Copyright (c) 2026 ESEngine Team+ * Licensed under the Apache License, Version 2.0.+ */+#pragma once++#include "../../ecs/components/Sprite.hpp"++namespace esengine {++/** Which of the three geometries a sprite emits. At most one is true. */+struct SpriteDrawChoice {+ bool tiled{false};+ bool nineSlice{false};+};++/**+ * @brief Resolve the geometry from the author's mode and what the data offers.+ *+ * Under `Auto` a tileSize outranks a slice border, because a tileSize is only+ * ever set deliberately. A named mode overrides the inference but cannot invent+ * data: Tiled with no tileSize and NineSlice with no border draw the plain quad.+ */+constexpr SpriteDrawChoice resolveSpriteDraw(ecs::SpriteDrawMode mode,+ bool hasTileSize,+ bool hasSliceBorder) {+ switch (mode) {+ case ecs::SpriteDrawMode::Simple:+ return {};+ case ecs::SpriteDrawMode::Tiled:+ return {hasTileSize, false};+ case ecs::SpriteDrawMode::NineSlice:+ return {false, hasSliceBorder};+ case ecs::SpriteDrawMode::Auto:+ default:+ return {hasTileSize, !hasTileSize && hasSliceBorder};+ }+}++} // namespace esenginediff --git a/src/esengine/renderer/plugins/SpritePlugin.cpp b/src/esengine/renderer/plugins/SpritePlugin.cppindex f27c73ecc..f78f01f61 100644--- a/src/esengine/renderer/plugins/SpritePlugin.cpp+++ b/src/esengine/renderer/plugins/SpritePlugin.cpp@@ -9,6 +9,7 @@#include "../../ecs/components/Sprite.hpp"#include "../../ecs/components/SpriteMask.hpp"#include "../../ecs/components/UINode.hpp"+#include "../draw/SpriteDrawResolve.hpp"#include <cmath>@@ -89,7 +90,12 @@ void SpritePlugin::collect(RenderCollectContext& collect_ctx) {uvSc.y = -uvSc.y;}- bool hasTiling = sprite.tileSize.x > 0.0f && sprite.tileSize.y > 0.0f;+ const SpriteDrawChoice draw = resolveSpriteDraw(+ sprite.drawMode,+ sprite.tileSize.x > 0.0f && sprite.tileSize.y > 0.0f,+ useNineSlice);+ const bool hasTiling = draw.tiled;+ useNineSlice = draw.nineSlice;BatchDrawKey key{.stage = ctx.current_stage,diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txtindex 3e7d0ef55..286455a56 100644--- a/tests/CMakeLists.txt+++ b/tests/CMakeLists.txt@@ -195,6 +195,13 @@ target_include_directories(test_sprite_mask_range PRIVATE)add_test(NAME test_sprite_mask_range COMMAND test_sprite_mask_range)+add_executable(test_sprite_draw_mode renderer/test_sprite_draw_mode.cpp)+target_include_directories(test_sprite_draw_mode PRIVATE+ ${CMAKE_SOURCE_DIR}/src+ ${CMAKE_SOURCE_DIR}/third_party/glm+)+add_test(NAME test_sprite_draw_mode COMMAND test_sprite_draw_mode)+# The sort key's field layout, asserted on the bits. Header-only, so no engine link.add_executable(test_sort_key renderer/test_sort_key.cpp)target_include_directories(test_sort_key PRIVATEdiff --git a/tests/aot/generated/conformance/handshake.h b/tests/aot/generated/conformance/handshake.hindex 559d2e035..6d58addd5 100644--- a/tests/aot/generated/conformance/handshake.h+++ b/tests/aot/generated/conformance/handshake.h@@ -1,5 +1,5 @@/* GENERATED by sdk/tests/aot-conformance.test.ts — do not edit. *//* The contract half of the handshake. The width half is the harness. */-#define ES_CONF_EXPECTED_CONTRACT_HASH 0x0a33a91a226cd5e4ULL+#define ES_CONF_EXPECTED_CONTRACT_HASH 0x7ad43dff377757b9ULL/* And which BUILD the artifact beside this one is. */#define ES_CONF_EXPECTED_MODULE_CONTRACT 0xc3d0e057d5701a2eULLdiff --git a/tests/aot/generated/conformance/systems_decl.c b/tests/aot/generated/conformance/systems_decl.cindex 773b40fc5..ea4e705c8 100644--- a/tests/aot/generated/conformance/systems_decl.c+++ b/tests/aot/generated/conformance/systems_decl.c@@ -10,7 +10,7 @@answer, it is a read of a different field. The address width belongsto the MACHINE, so it mixes in here rather than in the compiler and a32-bit artifact cannot load into a 64-bit host. */-#define ES_ABI_ENGINE_DIGEST 0x0a33a91a226cd5e4ULL+#define ES_ABI_ENGINE_DIGEST 0x7ad43dff377757b9ULLES_EXPORT const uint64_t es_abi_hash =ES_ABI_ENGINE_DIGEST ^ (0x9e3779b97f4a7c15ULL * (uint64_t)sizeof(es_addr_t));diff --git a/tests/renderer/test_sprite_draw_mode.cpp b/tests/renderer/test_sprite_draw_mode.cppnew file mode 100644index 000000000..6ec2cf76b--- /dev/null+++ b/tests/renderer/test_sprite_draw_mode.cpp@@ -0,0 +1,61 @@+// Which geometry a Sprite emits, and who decided: the texture's metadata or the+// entity using it. Header-only, so no engine link.++#include "esengine/renderer/draw/SpriteDrawResolve.hpp"++#include <cstdio>++using namespace esengine;+using ecs::SpriteDrawMode;++static int g_failures = 0;+#define CHECK(cond, msg) \+ do { \+ if (!(cond)) { std::printf("FAIL: %s\n", msg); ++g_failures; } \+ else { std::printf("ok: %s\n", msg); } \+ } while (0)++static bool quad(SpriteDrawChoice c) { return !c.tiled && !c.nineSlice; }++int main() {+ // ---- Auto: the inference the component always made -----------------------------+ {+ CHECK(quad(resolveSpriteDraw(SpriteDrawMode::Auto, false, false)),+ "auto with neither draws the plain quad");+ CHECK(resolveSpriteDraw(SpriteDrawMode::Auto, false, true).nineSlice,+ "auto with a slice border 9-slices, as it always did");+ CHECK(resolveSpriteDraw(SpriteDrawMode::Auto, true, false).tiled,+ "auto with a tile size tiles, as it always did");+ // A tileSize is only ever set deliberately, so it outranks metadata the+ // author may not even know the texture carries.+ const SpriteDrawChoice both = resolveSpriteDraw(SpriteDrawMode::Auto, true, true);+ CHECK(both.tiled && !both.nineSlice, "auto prefers the tile size over the border");+ }++ // ---- The author overriding the inference ---------------------------------------+ {+ // The case this exists for: a 9-slice texture drawn whole.+ CHECK(quad(resolveSpriteDraw(SpriteDrawMode::Simple, false, true)),+ "Simple draws a 9-slice texture whole");+ CHECK(quad(resolveSpriteDraw(SpriteDrawMode::Simple, true, true)),+ "Simple overrides a tile size too");+ CHECK(resolveSpriteDraw(SpriteDrawMode::NineSlice, true, true).nineSlice,+ "NineSlice wins over a tile size");+ CHECK(!resolveSpriteDraw(SpriteDrawMode::NineSlice, true, true).tiled,+ "...and does not tile as well");+ CHECK(resolveSpriteDraw(SpriteDrawMode::Tiled, true, true).tiled,+ "Tiled wins over a slice border");+ }++ // ---- An override cannot invent the data it needs --------------------------------+ {+ CHECK(quad(resolveSpriteDraw(SpriteDrawMode::NineSlice, false, false)),+ "NineSlice with no border falls back to the quad");+ CHECK(quad(resolveSpriteDraw(SpriteDrawMode::Tiled, false, false)),+ "Tiled with no tile size falls back to the quad");+ }++ std::printf(g_failures == 0 ? "\nall sprite draw-mode cases hold\n"+ : "\n%d case(s) failed\n", g_failures);+ return g_failures == 0 ? 0 : 1;+}diff --git a/tools/releaseNotes.mjs b/tools/releaseNotes.mjsindex 78d9aef58..7f3564994 100644--- a/tools/releaseNotes.mjs+++ b/tools/releaseNotes.mjs@@ -28,6 +28,9 @@ export const NOTES_FLOOR = 'v0.65.0';* the reader recognises anyway.*/export const NOTED = {+ 'feat(render): a sprite says how it fills its box, instead of its texture saying':+ { note: 'A sprite can be drawn whole even when its texture carries a 9-slice border.' },+'refactor(sdk): 2D physics declares where its declarations end':{ internal: 'Where the same code lives; behaviour and the public surface are unchanged.' },