@ignifx/2d 0.4.0 → 0.5.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ignifx/2d",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "ignifx 2D toolkit: Camera2D, sprites, sprite animation, atlases, tilemaps, sorting layers, pixel-perfect, parallax.",
5
5
  "keywords": [
6
6
  "ignifx",
@@ -43,11 +43,11 @@
43
43
  "typedoc-plugin-markdown": "^4.13.0",
44
44
  "typescript-native": "npm:typescript@7.0.2",
45
45
  "vitest": "^5.0.0",
46
- "@ignifx/core": "0.4.0"
46
+ "@ignifx/core": "0.5.0"
47
47
  },
48
48
  "peerDependencies": {
49
49
  "@babylonjs/lite": "1.27.0",
50
- "@ignifx/core": "0.4.0"
50
+ "@ignifx/core": "0.5.0"
51
51
  },
52
52
  "ignifx": {
53
53
  "extension": true,
@@ -3,7 +3,7 @@ name: 2d
3
3
  description: Builds 2D games in ignifx with @ignifx/2d: Camera2D, SpriteRenderer, SpriteAnimator, texture atlases, Tilemap rendering and import, sorting layers and Y-sort, pixel-perfect cameras, parallax layers, sprite batches, and 2D picking. Use when adding or editing sprites, sprite animation, tilemaps, atlases, sorting layers, sprite batches, or a 2D camera in an ignifx project, or when the user mentions @ignifx/2d, Camera2D, SpriteRenderer, SpriteBatch, or Tilemap.
4
4
  license: Apache-2.0
5
5
  metadata:
6
- ignifx-version: "0.4.0"
6
+ ignifx-version: "0.5.0"
7
7
  ---
8
8
 
9
9
  # @ignifx/2d
@@ -21,7 +21,7 @@ parse, `SpriteAnimator` advances on the stepped clock. Only the pixels need a GP
21
21
 
22
22
  ## Environment
23
23
 
24
- - Engine: ignifx `0.4.0`; this package targets `@ignifx/core` `>=0.0.0 <1.0.0`.
24
+ - Engine: ignifx `0.5.0`; this package targets `@ignifx/core` `>=0.0.0 <1.0.0`.
25
25
  - WebGPU only, browser and Electron. Babylon Lite `1.27.0` is a peer dependency.
26
26
  - Register it like any extension; nothing happens at import time.
27
27
 
@@ -91,11 +91,11 @@ if (canvas instanceof HTMLCanvasElement) {
91
91
  const hero = app.world.createEntity("Hero");
92
92
  hero.transform.position2D = new Vec2(0, 0);
93
93
  const sprite = hero.addComponent(SpriteRenderer);
94
- sprite.sprite = atlas.retain();
94
+ sprite.sprite = atlas;
95
95
  sprite.sortingLayer = "Default";
96
96
 
97
97
  const animator = hero.addComponent(SpriteAnimator);
98
- animator.animations = clips.retain();
98
+ animator.animations = clips;
99
99
  animator.play("idle");
100
100
 
101
101
  await app.start();
@@ -213,8 +213,8 @@ if (canvas instanceof HTMLCanvasElement) {
213
213
  await Promise.all([map.promise, tiles.promise]);
214
214
 
215
215
  const level = app.world.createEntity("Level");
216
- level.addComponent(Tilemap).map = map.retain();
217
- level.addComponent(TilemapRenderer).atlas = tiles.retain();
216
+ level.addComponent(Tilemap).map = map;
217
+ level.addComponent(TilemapRenderer).atlas = tiles;
218
218
  await app.start();
219
219
  }
220
220
  ```
@@ -284,11 +284,10 @@ Generated reference: `skills/ignifx/references/formats/`.
284
284
  the screen in a 2D game — and `Camera2D` has no `clearColor` field. Set it in `ignifx.config.ts`
285
285
  under `rendering`, not per camera. In `"mixed"` mode the render scene clears instead and the 3D
286
286
  precedence applies as usual.
287
- - **`clearColor` is sRGB and is presented as its linear value**, so a channel lands on screen at
288
- `srgbToLinear(value) * 255` rather than `value * 255`: `{ r: 0.6, g: 0.2, b: 0.9 }` reads back as
289
- bytes `81, 8, 201`, and a literal `#14181F` is almost black. That is the same in both 2D modes and
290
- on the 3D path — one setting, one colour — so pass the inverse if you are matching a page colour.
291
- Measured on 2026-09-08 (macOS arm64, SwiftShader, `packages/2d/test/clear-color.browser.test.ts`).
287
+ - **`clearColor` is sRGB and presents as authored**, so a channel lands on screen at `value * 255`:
288
+ `{ r: 0.6, g: 0.2, b: 0.9 }` reads back as bytes `153, 51, 230`, and `#14181F` matches the same
289
+ page colour. That is the same in both 2D modes and on the 3D path — one setting, one colour
290
+ (`packages/2d/test/clear-color.browser.test.ts`).
292
291
  - **A world whose only camera is a `Camera2D` does not log `IGX-0706`.** Core's "no enabled camera"
293
292
  warning is suppressed while the sprite renderer has an active `Camera2D`, so a correct 2D-only
294
293
  scene is quiet. Build the camera **before** `app.start()`, as the templates do: a world that is