tilemap-parser 3.1.12__tar.gz → 3.1.13__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.12 → tilemap_parser-3.1.13}/PKG-INFO +1 -1
- {tilemap_parser-3.1.12 → tilemap_parser-3.1.13}/pyproject.toml +1 -1
- {tilemap_parser-3.1.12 → tilemap_parser-3.1.13}/src/tilemap_parser/runtime/particles.py +26 -9
- {tilemap_parser-3.1.12 → tilemap_parser-3.1.13}/src/tilemap_parser.egg-info/PKG-INFO +1 -1
- {tilemap_parser-3.1.12 → tilemap_parser-3.1.13}/LICENSE +0 -0
- {tilemap_parser-3.1.12 → tilemap_parser-3.1.13}/README.md +0 -0
- {tilemap_parser-3.1.12 → tilemap_parser-3.1.13}/setup.cfg +0 -0
- {tilemap_parser-3.1.12 → tilemap_parser-3.1.13}/src/tilemap_parser/__init__.py +0 -0
- {tilemap_parser-3.1.12 → tilemap_parser-3.1.13}/src/tilemap_parser/parser/__init__.py +0 -0
- {tilemap_parser-3.1.12 → tilemap_parser-3.1.13}/src/tilemap_parser/parser/animation.py +0 -0
- {tilemap_parser-3.1.12 → tilemap_parser-3.1.13}/src/tilemap_parser/parser/collision.py +0 -0
- {tilemap_parser-3.1.12 → tilemap_parser-3.1.13}/src/tilemap_parser/parser/collision_loader.py +0 -0
- {tilemap_parser-3.1.12 → tilemap_parser-3.1.13}/src/tilemap_parser/parser/map_parse.py +0 -0
- {tilemap_parser-3.1.12 → tilemap_parser-3.1.13}/src/tilemap_parser/parser/node_parse.py +0 -0
- {tilemap_parser-3.1.12 → tilemap_parser-3.1.13}/src/tilemap_parser/parser/particle.py +0 -0
- {tilemap_parser-3.1.12 → tilemap_parser-3.1.13}/src/tilemap_parser/runtime/__init__.py +0 -0
- {tilemap_parser-3.1.12 → tilemap_parser-3.1.13}/src/tilemap_parser/runtime/animation_player.py +0 -0
- {tilemap_parser-3.1.12 → tilemap_parser-3.1.13}/src/tilemap_parser/runtime/area_node.py +0 -0
- {tilemap_parser-3.1.12 → tilemap_parser-3.1.13}/src/tilemap_parser/runtime/collision_cache.py +0 -0
- {tilemap_parser-3.1.12 → tilemap_parser-3.1.13}/src/tilemap_parser/runtime/map_loader.py +0 -0
- {tilemap_parser-3.1.12 → tilemap_parser-3.1.13}/src/tilemap_parser/runtime/object_collision.py +0 -0
- {tilemap_parser-3.1.12 → tilemap_parser-3.1.13}/src/tilemap_parser/runtime/renderer.py +0 -0
- {tilemap_parser-3.1.12 → tilemap_parser-3.1.13}/src/tilemap_parser/runtime/tile_collision.py +0 -0
- {tilemap_parser-3.1.12 → tilemap_parser-3.1.13}/src/tilemap_parser/utils/__init__.py +0 -0
- {tilemap_parser-3.1.12 → tilemap_parser-3.1.13}/src/tilemap_parser/utils/geometry.py +0 -0
- {tilemap_parser-3.1.12 → tilemap_parser-3.1.13}/src/tilemap_parser.egg-info/SOURCES.txt +0 -0
- {tilemap_parser-3.1.12 → tilemap_parser-3.1.13}/src/tilemap_parser.egg-info/dependency_links.txt +0 -0
- {tilemap_parser-3.1.12 → tilemap_parser-3.1.13}/src/tilemap_parser.egg-info/requires.txt +0 -0
- {tilemap_parser-3.1.12 → tilemap_parser-3.1.13}/src/tilemap_parser.egg-info/top_level.txt +0 -0
- {tilemap_parser-3.1.12 → tilemap_parser-3.1.13}/tests/test_collision.py +0 -0
- {tilemap_parser-3.1.12 → tilemap_parser-3.1.13}/tests/test_geometry.py +0 -0
- {tilemap_parser-3.1.12 → tilemap_parser-3.1.13}/tests/test_map_loader.py +0 -0
- {tilemap_parser-3.1.12 → tilemap_parser-3.1.13}/tests/test_object_collision.py +0 -0
- {tilemap_parser-3.1.12 → tilemap_parser-3.1.13}/tests/test_render_scale.py +0 -0
- {tilemap_parser-3.1.12 → tilemap_parser-3.1.13}/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.13
|
|
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.13"
|
|
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"
|
|
@@ -18,6 +18,15 @@ from ..parser.particle import ParticleSystemConfig
|
|
|
18
18
|
PARTICLE_TEXTURE_SIZE = 24
|
|
19
19
|
MAX_DT = 0.05
|
|
20
20
|
|
|
21
|
+
_SYMMETRIC_SHAPES = frozenset({"circle", "square", "diamond", "star", "sparkle", "smoke"})
|
|
22
|
+
|
|
23
|
+
_ALPHA_FADE_MAP = {
|
|
24
|
+
"none": 0,
|
|
25
|
+
"fade_out": 1,
|
|
26
|
+
"fade_in": 2,
|
|
27
|
+
"fade_both": 3,
|
|
28
|
+
}
|
|
29
|
+
|
|
21
30
|
|
|
22
31
|
class ParticleEmitterNode:
|
|
23
32
|
def __init__(self, parsed: ParsedNode) -> None:
|
|
@@ -165,18 +174,18 @@ def _interp_color(
|
|
|
165
174
|
sc: Tuple[int, int, int, int],
|
|
166
175
|
ec: Tuple[int, int, int, int],
|
|
167
176
|
t: float,
|
|
168
|
-
alpha_fade:
|
|
177
|
+
alpha_fade: int,
|
|
169
178
|
) -> Tuple[int, int, int, int]:
|
|
170
179
|
r = int(sc[0] + (ec[0] - sc[0]) * t)
|
|
171
180
|
g = int(sc[1] + (ec[1] - sc[1]) * t)
|
|
172
181
|
b = int(sc[2] + (ec[2] - sc[2]) * t)
|
|
173
182
|
a_start = sc[3]
|
|
174
183
|
a_end = ec[3]
|
|
175
|
-
if alpha_fade ==
|
|
184
|
+
if alpha_fade == 0:
|
|
176
185
|
a = a_start
|
|
177
|
-
elif alpha_fade ==
|
|
186
|
+
elif alpha_fade == 1:
|
|
178
187
|
a = int(a_start + (a_end - a_start) * t)
|
|
179
|
-
elif alpha_fade ==
|
|
188
|
+
elif alpha_fade == 2:
|
|
180
189
|
a = int(a_end + (a_start - a_end) * t)
|
|
181
190
|
else:
|
|
182
191
|
mid = 0.5
|
|
@@ -255,7 +264,7 @@ class Particle:
|
|
|
255
264
|
start_scale: float,
|
|
256
265
|
end_scale: float,
|
|
257
266
|
rotation_speed: float,
|
|
258
|
-
alpha_fade:
|
|
267
|
+
alpha_fade: int,
|
|
259
268
|
shape: str,
|
|
260
269
|
):
|
|
261
270
|
self.x = x
|
|
@@ -360,6 +369,8 @@ class ParticleEmitter:
|
|
|
360
369
|
for i in range(alive, len(self.particles)):
|
|
361
370
|
self._pool.append(self.particles[i])
|
|
362
371
|
del self.particles[alive:]
|
|
372
|
+
if len(self._pool) > cfg.max_particles:
|
|
373
|
+
del self._pool[:len(self._pool) - cfg.max_particles]
|
|
363
374
|
|
|
364
375
|
def _spawn(
|
|
365
376
|
self, area_x: float, area_y: float, area_w: float, area_h: float
|
|
@@ -405,6 +416,7 @@ class ParticleEmitter:
|
|
|
405
416
|
cfg.start_color_a,
|
|
406
417
|
)
|
|
407
418
|
ec = (cfg.end_color_r, cfg.end_color_g, cfg.end_color_b, cfg.end_color_a)
|
|
419
|
+
alpha_int = _ALPHA_FADE_MAP.get(cfg.alpha_fade, 1)
|
|
408
420
|
|
|
409
421
|
p = self._pool.pop() if self._pool else None
|
|
410
422
|
if p is not None:
|
|
@@ -421,7 +433,7 @@ class ParticleEmitter:
|
|
|
421
433
|
p.end_color = ec
|
|
422
434
|
p.rotation = random.uniform(0, 360)
|
|
423
435
|
p.rotation_speed = cfg.rotation_speed
|
|
424
|
-
p.alpha_fade =
|
|
436
|
+
p.alpha_fade = alpha_int
|
|
425
437
|
p.shape = cfg.particle_shape
|
|
426
438
|
else:
|
|
427
439
|
p = Particle(
|
|
@@ -436,7 +448,7 @@ class ParticleEmitter:
|
|
|
436
448
|
start_scale=cfg.start_scale,
|
|
437
449
|
end_scale=cfg.end_scale,
|
|
438
450
|
rotation_speed=cfg.rotation_speed,
|
|
439
|
-
alpha_fade=
|
|
451
|
+
alpha_fade=alpha_int,
|
|
440
452
|
shape=cfg.particle_shape,
|
|
441
453
|
)
|
|
442
454
|
return p
|
|
@@ -465,6 +477,7 @@ class SpriteBatchRenderer(ParticleRenderer):
|
|
|
465
477
|
self._tint_surf: Optional[Surface] = None
|
|
466
478
|
self._tint_size: int = 0
|
|
467
479
|
self._particles: List[Particle] = []
|
|
480
|
+
self._batch: List[Tuple[Surface, Rect]] = []
|
|
468
481
|
|
|
469
482
|
def on_config_change(self, config: ParticleSystemConfig) -> None:
|
|
470
483
|
self._shape = config.particle_shape
|
|
@@ -495,13 +508,17 @@ class SpriteBatchRenderer(ParticleRenderer):
|
|
|
495
508
|
return
|
|
496
509
|
|
|
497
510
|
screen_rect = screen.get_rect()
|
|
498
|
-
batch
|
|
511
|
+
batch = self._batch
|
|
512
|
+
batch.clear()
|
|
513
|
+
|
|
514
|
+
needs_rotation = shape not in _SYMMETRIC_SHAPES
|
|
499
515
|
|
|
500
516
|
for p in particles:
|
|
501
517
|
|
|
502
518
|
sx = int((p.x - offset_x) * zoom)
|
|
503
519
|
sy = int((p.y - offset_y) * zoom)
|
|
504
520
|
size_px = max(1, int(p.current_size * zoom))
|
|
521
|
+
size_px = ((size_px + 4) // 8) * 8
|
|
505
522
|
half = size_px // 2 + 1
|
|
506
523
|
if (
|
|
507
524
|
sx + half < 0
|
|
@@ -525,7 +542,7 @@ class SpriteBatchRenderer(ParticleRenderer):
|
|
|
525
542
|
draw_surf.fill(color, special_flags=pygame.BLEND_RGBA_MULT)
|
|
526
543
|
_TINTED_CACHE[cache_key] = draw_surf # move to MRU position
|
|
527
544
|
|
|
528
|
-
if p.rotation_speed != 0:
|
|
545
|
+
if p.rotation_speed != 0 and needs_rotation:
|
|
529
546
|
rotated = pygame.transform.rotate(draw_surf, p.rotation)
|
|
530
547
|
dr = rotated.get_rect(center=(sx, sy))
|
|
531
548
|
screen.blit(rotated, dr)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tilemap-parser
|
|
3
|
-
Version: 3.1.
|
|
3
|
+
Version: 3.1.13
|
|
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
|
{tilemap_parser-3.1.12 → tilemap_parser-3.1.13}/src/tilemap_parser/parser/collision_loader.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tilemap_parser-3.1.12 → tilemap_parser-3.1.13}/src/tilemap_parser/runtime/animation_player.py
RENAMED
|
File without changes
|
|
File without changes
|
{tilemap_parser-3.1.12 → tilemap_parser-3.1.13}/src/tilemap_parser/runtime/collision_cache.py
RENAMED
|
File without changes
|
|
File without changes
|
{tilemap_parser-3.1.12 → tilemap_parser-3.1.13}/src/tilemap_parser/runtime/object_collision.py
RENAMED
|
File without changes
|
|
File without changes
|
{tilemap_parser-3.1.12 → tilemap_parser-3.1.13}/src/tilemap_parser/runtime/tile_collision.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tilemap_parser-3.1.12 → tilemap_parser-3.1.13}/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
|