Read the pixel size of a texture in a graph (#262)
A graph had no way to know how big a picture is. An icon sprite with a fixed size therefore stretched every icon of another size, an 8x8 pixel-art icon in a 16x16 slot was drawn twice as big. - New data node Texture size. It takes a texture, a frame or a pixel art and hands out width and height in pixels, 0 x 0 for none. Wired into a sprite's width and height, the picture shows pixel for pixel. - GraphLookup gets textureSize. The project answers it with the same pictureSize rule a sprite uses to size itself. Tests: - ./check.sh: 2749 tests, CHECK EXIT 0. - 2 catalog cases (a picture, no picture) and one test against a real project: pixel-art sheet, single frame, missing texture. - No e2e check and no counter-check for this node. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d7d0a6e7d4
commit
ef2600493f
6 files changed
+71
No files matched your search
@@ -265,6 +265,19 @@ const CASES: Record<string, Case[]> = {
|
||||
after: (ctx) => expect(ctx.states).toEqual({}),
|
||||
},
|
||||
],
|
||||
TextureSize: [
|
||||
{
|
||||
name: "hands out the picture's own pixel size",
|
||||
inputs: { texture: 'coin' },
|
||||
lookup: { ...NO_LOOKUP, textureSize: (id) => (id === 'coin' ? { w: 8, h: 6 } : null) },
|
||||
outputs: { width: 8, height: 6 },
|
||||
},
|
||||
{
|
||||
name: 'no picture is 0 × 0',
|
||||
inputs: { texture: '' },
|
||||
outputs: { width: 0, height: 0 },
|
||||
},
|
||||
],
|
||||
CurrentState: [
|
||||
{
|
||||
name: 'names the state the machine is in, and hands out its id as well',
|
||||
|
||||
Reference in new issue
Block a user