Skip to content

Generate clean 2D game sprites & animation atlases — component-row pipeline: state rows, alpha cleanup, frame extraction, runtime atlases. Codex/Claude skill.

refactor(game-pack): a nine-slice's sides are ui_kit.SIDES, the copy removed

Soohong Kim5e2bb7272b10
diff --git a/sprite_gen/compose/game_pack.py b/sprite_gen/compose/game_pack.py
index 4b1c5ce..e4d7850 100644
--- a/sprite_gen/compose/game_pack.py
+++ b/sprite_gen/compose/game_pack.py
@@ -21,7 +21,7 @@ from PIL import Image
from sprite_gen.audio.manifest import load as load_sound
from sprite_gen.audio.playback import player as audio_player
-from sprite_gen.frames.ui_kit import (REPORT_KIND as UI_KIT_KIND, STRETCHES, content_rect, element_path,
+from sprite_gen.frames.ui_kit import (REPORT_KIND as UI_KIT_KIND, SIDES, STRETCHES, content_rect, element_path,
measure_insets)
from sprite_gen._deps import np
from sprite_gen.spec.assets import finite, load_asset, load_asset_states
@@ -32,7 +32,6 @@ from sprite_gen.util.console import utf8_streams
MAX_PAGE_SIZE = 4096
MAX_BYTES = 50_000_000
SCENE_SECTIONS = ("images", "tiles", "ui")
-SIDES = ("left", "right", "top", "bottom")
# A "base" footprint counts pixels at least this opaque (docs/game-pack.md "Version 2 request").
FOOTPRINT_ALPHA = 128
diff --git a/tests/compose/test_game_pack_v2.py b/tests/compose/test_game_pack_v2.py
index 6cbc644..9d2cdb0 100644
--- a/tests/compose/test_game_pack_v2.py
+++ b/tests/compose/test_game_pack_v2.py
@@ -14,6 +14,7 @@ import pytest
from PIL import Image, ImageDraw
from sprite_gen.compose import game_pack
+from sprite_gen.frames import ui_kit
from sprite_gen.frames.ui_kit import measure_insets
from sprite_gen.util.resample import resize_cell
@@ -115,6 +116,10 @@ def all_ints(value):
return type(value) is int
+def test_the_sides_of_a_nine_slice_are_the_ui_kit_s():
+ assert game_pack.SIDES is ui_kit.SIDES
+
+
def test_version_2_manifest_has_exactly_the_documented_sections(tmp_path):
out = tmp_path / "out"
result = game_pack.pack(scene_request(tmp_path), out)