tilemap-parser 3.1.3__tar.gz → 3.1.5__tar.gz
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.
- {tilemap_parser-3.1.3 → tilemap_parser-3.1.5}/PKG-INFO +1 -1
- {tilemap_parser-3.1.3 → tilemap_parser-3.1.5}/pyproject.toml +1 -1
- {tilemap_parser-3.1.3 → tilemap_parser-3.1.5}/src/tilemap_parser/parser/animation.py +10 -1
- {tilemap_parser-3.1.3 → tilemap_parser-3.1.5}/src/tilemap_parser/runtime/animation_player.py +8 -1
- {tilemap_parser-3.1.3 → tilemap_parser-3.1.5}/src/tilemap_parser/runtime/map_loader.py +1 -0
- {tilemap_parser-3.1.3 → tilemap_parser-3.1.5}/src/tilemap_parser/runtime/renderer.py +5 -0
- {tilemap_parser-3.1.3 → tilemap_parser-3.1.5}/src/tilemap_parser.egg-info/PKG-INFO +1 -1
- {tilemap_parser-3.1.3 → tilemap_parser-3.1.5}/LICENSE +0 -0
- {tilemap_parser-3.1.3 → tilemap_parser-3.1.5}/README.md +0 -0
- {tilemap_parser-3.1.3 → tilemap_parser-3.1.5}/setup.cfg +0 -0
- {tilemap_parser-3.1.3 → tilemap_parser-3.1.5}/src/tilemap_parser/__init__.py +0 -0
- {tilemap_parser-3.1.3 → tilemap_parser-3.1.5}/src/tilemap_parser/parser/__init__.py +0 -0
- {tilemap_parser-3.1.3 → tilemap_parser-3.1.5}/src/tilemap_parser/parser/collision.py +0 -0
- {tilemap_parser-3.1.3 → tilemap_parser-3.1.5}/src/tilemap_parser/parser/collision_loader.py +0 -0
- {tilemap_parser-3.1.3 → tilemap_parser-3.1.5}/src/tilemap_parser/parser/map_parse.py +0 -0
- {tilemap_parser-3.1.3 → tilemap_parser-3.1.5}/src/tilemap_parser/runtime/__init__.py +0 -0
- {tilemap_parser-3.1.3 → tilemap_parser-3.1.5}/src/tilemap_parser/runtime/collision_cache.py +0 -0
- {tilemap_parser-3.1.3 → tilemap_parser-3.1.5}/src/tilemap_parser/runtime/object_collision.py +0 -0
- {tilemap_parser-3.1.3 → tilemap_parser-3.1.5}/src/tilemap_parser/runtime/tile_collision.py +0 -0
- {tilemap_parser-3.1.3 → tilemap_parser-3.1.5}/src/tilemap_parser/utils/__init__.py +0 -0
- {tilemap_parser-3.1.3 → tilemap_parser-3.1.5}/src/tilemap_parser/utils/geometry.py +0 -0
- {tilemap_parser-3.1.3 → tilemap_parser-3.1.5}/src/tilemap_parser.egg-info/SOURCES.txt +0 -0
- {tilemap_parser-3.1.3 → tilemap_parser-3.1.5}/src/tilemap_parser.egg-info/dependency_links.txt +0 -0
- {tilemap_parser-3.1.3 → tilemap_parser-3.1.5}/src/tilemap_parser.egg-info/requires.txt +0 -0
- {tilemap_parser-3.1.3 → tilemap_parser-3.1.5}/src/tilemap_parser.egg-info/top_level.txt +0 -0
- {tilemap_parser-3.1.3 → tilemap_parser-3.1.5}/tests/test_collision.py +0 -0
- {tilemap_parser-3.1.3 → tilemap_parser-3.1.5}/tests/test_geometry.py +0 -0
- {tilemap_parser-3.1.3 → tilemap_parser-3.1.5}/tests/test_map_loader.py +0 -0
- {tilemap_parser-3.1.3 → tilemap_parser-3.1.5}/tests/test_object_collision.py +0 -0
- {tilemap_parser-3.1.3 → tilemap_parser-3.1.5}/tests/test_render_scale.py +0 -0
- {tilemap_parser-3.1.3 → tilemap_parser-3.1.5}/tests/test_tile_collision.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tilemap-parser
|
|
3
|
-
Version: 3.1.
|
|
3
|
+
Version: 3.1.5
|
|
4
4
|
Summary: Standalone parser/loader for tilemap-editor JSON maps, sprite animations, and collision detection runtime.
|
|
5
5
|
Author: tilemap parser contributors
|
|
6
6
|
License: GNU GENERAL PUBLIC LICENSE
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "tilemap-parser"
|
|
7
|
-
version = "3.1.
|
|
7
|
+
version = "3.1.5"
|
|
8
8
|
description = "Standalone parser/loader for tilemap-editor JSON maps, sprite animations, and collision detection runtime."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10"
|
|
@@ -97,6 +97,7 @@ class AnimationLibrary:
|
|
|
97
97
|
animations: Dict[str, AnimationClip] = field(default_factory=dict)
|
|
98
98
|
spritesheet_path: Optional[str] = None
|
|
99
99
|
tile_size: Tuple[int, int] = (32, 32)
|
|
100
|
+
grid_offset: Tuple[int, int] = (0, 0)
|
|
100
101
|
|
|
101
102
|
def get(self, name: str) -> Optional[AnimationClip]:
|
|
102
103
|
return self.animations.get(name)
|
|
@@ -153,13 +154,21 @@ def parse_animation_dict(data: Dict[str, Any]) -> AnimationLibrary:
|
|
|
153
154
|
if tw < 1 or th < 1:
|
|
154
155
|
raise AnimationParseError("tile_size: width and height must be >= 1")
|
|
155
156
|
|
|
157
|
+
grid_offset_raw = root.get("grid_offset", [0, 0])
|
|
158
|
+
if not isinstance(grid_offset_raw, (list, tuple)) or len(grid_offset_raw) != 2:
|
|
159
|
+
raise AnimationParseError("grid_offset: expected [x, y]")
|
|
160
|
+
gox = _coerce_int(grid_offset_raw[0], "grid_offset[0]")
|
|
161
|
+
goy = _coerce_int(grid_offset_raw[1], "grid_offset[1]")
|
|
162
|
+
if gox < 0 or goy < 0:
|
|
163
|
+
raise AnimationParseError("grid_offset: values must be >= 0")
|
|
164
|
+
|
|
156
165
|
animations_raw = _req_dict(root.get("animations", {}), "animations")
|
|
157
166
|
animations: Dict[str, AnimationClip] = {}
|
|
158
167
|
for key, value in animations_raw.items():
|
|
159
168
|
k = str(key)
|
|
160
169
|
animations[k] = _parse_animation(k, _req_dict(value, f"animations[{k!r}]"), f"animations[{k!r}]")
|
|
161
170
|
|
|
162
|
-
return AnimationLibrary(animations=animations, spritesheet_path=spritesheet_path, tile_size=(tw, th))
|
|
171
|
+
return AnimationLibrary(animations=animations, spritesheet_path=spritesheet_path, tile_size=(tw, th), grid_offset=(gox, goy))
|
|
163
172
|
|
|
164
173
|
|
|
165
174
|
def parse_animation_json(text: str) -> AnimationLibrary:
|
{tilemap_parser-3.1.3 → tilemap_parser-3.1.5}/src/tilemap_parser/runtime/animation_player.py
RENAMED
|
@@ -59,7 +59,14 @@ class SpriteAnimationSet:
|
|
|
59
59
|
except pygame.error as e:
|
|
60
60
|
raise AnimationParseError(f"Failed to load image {image_path}: {e}") from e
|
|
61
61
|
|
|
62
|
-
return cls(
|
|
62
|
+
return cls(
|
|
63
|
+
library=library,
|
|
64
|
+
surface=surface,
|
|
65
|
+
warnings=warnings,
|
|
66
|
+
json_path=path,
|
|
67
|
+
grid_offset_x=library.grid_offset[0],
|
|
68
|
+
grid_offset_y=library.grid_offset[1],
|
|
69
|
+
)
|
|
63
70
|
|
|
64
71
|
def get_image(self, variant_id: int, *, copy_surface: bool = True) -> Optional[Surface]:
|
|
65
72
|
tw, th = self.library.tile_size
|
|
@@ -34,6 +34,11 @@ class TileLayerRenderer:
|
|
|
34
34
|
raise ValueError(f"render_scale must be positive, got {self._rs}")
|
|
35
35
|
self._eff_w = int(self._tile_w * self._rs)
|
|
36
36
|
self._eff_h = int(self._tile_h * self._rs)
|
|
37
|
+
if self._eff_w <= 0 or self._eff_h <= 0:
|
|
38
|
+
raise ValueError(
|
|
39
|
+
f"effective tile size ({self._eff_w}, {self._eff_h}) must be positive; "
|
|
40
|
+
f"got tile_size=({self._tile_w}, {self._tile_h}) render_scale={self._rs}"
|
|
41
|
+
)
|
|
37
42
|
|
|
38
43
|
def get_layer_dict(self) -> Dict[int, object]:
|
|
39
44
|
return dict(self.tile_layers)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tilemap-parser
|
|
3
|
-
Version: 3.1.
|
|
3
|
+
Version: 3.1.5
|
|
4
4
|
Summary: Standalone parser/loader for tilemap-editor JSON maps, sprite animations, and collision detection runtime.
|
|
5
5
|
Author: tilemap parser contributors
|
|
6
6
|
License: GNU GENERAL PUBLIC LICENSE
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tilemap_parser-3.1.3 → tilemap_parser-3.1.5}/src/tilemap_parser/runtime/object_collision.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tilemap_parser-3.1.3 → tilemap_parser-3.1.5}/src/tilemap_parser.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|