tinyecs-compsys-patternengine 0.0.2__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.
- tinyecs_compsys_patternengine-0.0.2/LICENSE +21 -0
- tinyecs_compsys_patternengine-0.0.2/MANIFEST.in +1 -0
- tinyecs_compsys_patternengine-0.0.2/PKG-INFO +84 -0
- tinyecs_compsys_patternengine-0.0.2/README.rst +62 -0
- tinyecs_compsys_patternengine-0.0.2/pyproject.toml +39 -0
- tinyecs_compsys_patternengine-0.0.2/setup.cfg +4 -0
- tinyecs_compsys_patternengine-0.0.2/src/tinyecs/compsys/patternengine/__init__.py +66 -0
- tinyecs_compsys_patternengine-0.0.2/src/tinyecs_compsys_patternengine.egg-info/PKG-INFO +84 -0
- tinyecs_compsys_patternengine-0.0.2/src/tinyecs_compsys_patternengine.egg-info/SOURCES.txt +10 -0
- tinyecs_compsys_patternengine-0.0.2/src/tinyecs_compsys_patternengine.egg-info/dependency_links.txt +1 -0
- tinyecs_compsys_patternengine-0.0.2/src/tinyecs_compsys_patternengine.egg-info/requires.txt +6 -0
- tinyecs_compsys_patternengine-0.0.2/src/tinyecs_compsys_patternengine.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Michael Lamertz
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
graft src/*/assets
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tinyecs-compsys-patternengine
|
|
3
|
+
Version: 0.0.2
|
|
4
|
+
Summary: patternengine component and system library for tinyecs
|
|
5
|
+
Author-email: Michael Lamertz <michael.lamertz@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: homepage, https://github.com/dickerdackel/tinyecs-compsys-patternengine
|
|
8
|
+
Project-URL: bugtracker, https://github.com/DickerDackel/tinyecs-compsys-patternengine/issues
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Topic :: Games/Entertainment
|
|
12
|
+
Classifier: Topic :: Software Development :: Libraries :: pygame
|
|
13
|
+
Description-Content-Type: text/x-rst
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
Requires-Dist: aenum
|
|
16
|
+
Requires-Dist: patternengine
|
|
17
|
+
Requires-Dist: tinyecs>=0.5.0
|
|
18
|
+
Requires-Dist: tinyecs-compsys
|
|
19
|
+
Requires-Dist: tinyecs-compsys-base
|
|
20
|
+
Requires-Dist: tinyecs-compsys-dynamics
|
|
21
|
+
Dynamic: license-file
|
|
22
|
+
|
|
23
|
+
tinyecs-compsys-patternengine
|
|
24
|
+
=============================
|
|
25
|
+
|
|
26
|
+
These are components and systems for tinyecs together with the `patternengine`_.
|
|
27
|
+
|
|
28
|
+
.. _patternengine: https://github.com/dickerdackel/patternengine/
|
|
29
|
+
|
|
30
|
+
Synopsis
|
|
31
|
+
--------
|
|
32
|
+
|
|
33
|
+
This package relies on registered component IDs from ``tinyecs-compsys-base``.
|
|
34
|
+
It should not be used standalone, but instead be automatically detected and
|
|
35
|
+
registered with the top level ``tinyecs.compsys`` package.
|
|
36
|
+
|
|
37
|
+
.. code:: python
|
|
38
|
+
|
|
39
|
+
import tinyecs.compsys as cs
|
|
40
|
+
|
|
41
|
+
cs.register()
|
|
42
|
+
|
|
43
|
+
Usage
|
|
44
|
+
-----
|
|
45
|
+
|
|
46
|
+
Start with the `tinyecs docs`_, followed by the `patternengine docs`_
|
|
47
|
+
|
|
48
|
+
.. _tinyecs docs: https://tinyecs.readthedocs.io/en/latest/
|
|
49
|
+
.. _patternengine docs: https://patternengine.readthedocs.io/en/latest/
|
|
50
|
+
|
|
51
|
+
Then check the API docs.
|
|
52
|
+
|
|
53
|
+
Installation
|
|
54
|
+
------------
|
|
55
|
+
|
|
56
|
+
It's up to you, if you install the currently provided ``compsys`` packages from
|
|
57
|
+
``tinyecs`` by using
|
|
58
|
+
|
|
59
|
+
.. code:: console
|
|
60
|
+
|
|
61
|
+
pip install tinyecs[base,patternengine]
|
|
62
|
+
|
|
63
|
+
or include them by adding specific dependencies:
|
|
64
|
+
|
|
65
|
+
.. code:: console
|
|
66
|
+
|
|
67
|
+
pip install tinyecs
|
|
68
|
+
pip install tinyecs-compsys
|
|
69
|
+
pip install tinyecs-compsys-patternengine
|
|
70
|
+
|
|
71
|
+
Support / Contributing
|
|
72
|
+
----------------------
|
|
73
|
+
|
|
74
|
+
Issues can be opened on `github issues`_
|
|
75
|
+
|
|
76
|
+
.. _github issues: https://github.com/dickerdackel/tinyecs-compsys-patternengine/issues
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
License
|
|
80
|
+
-------
|
|
81
|
+
|
|
82
|
+
This software is provided under the MIT license.
|
|
83
|
+
|
|
84
|
+
See LICENSE file for details.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
tinyecs-compsys-patternengine
|
|
2
|
+
=============================
|
|
3
|
+
|
|
4
|
+
These are components and systems for tinyecs together with the `patternengine`_.
|
|
5
|
+
|
|
6
|
+
.. _patternengine: https://github.com/dickerdackel/patternengine/
|
|
7
|
+
|
|
8
|
+
Synopsis
|
|
9
|
+
--------
|
|
10
|
+
|
|
11
|
+
This package relies on registered component IDs from ``tinyecs-compsys-base``.
|
|
12
|
+
It should not be used standalone, but instead be automatically detected and
|
|
13
|
+
registered with the top level ``tinyecs.compsys`` package.
|
|
14
|
+
|
|
15
|
+
.. code:: python
|
|
16
|
+
|
|
17
|
+
import tinyecs.compsys as cs
|
|
18
|
+
|
|
19
|
+
cs.register()
|
|
20
|
+
|
|
21
|
+
Usage
|
|
22
|
+
-----
|
|
23
|
+
|
|
24
|
+
Start with the `tinyecs docs`_, followed by the `patternengine docs`_
|
|
25
|
+
|
|
26
|
+
.. _tinyecs docs: https://tinyecs.readthedocs.io/en/latest/
|
|
27
|
+
.. _patternengine docs: https://patternengine.readthedocs.io/en/latest/
|
|
28
|
+
|
|
29
|
+
Then check the API docs.
|
|
30
|
+
|
|
31
|
+
Installation
|
|
32
|
+
------------
|
|
33
|
+
|
|
34
|
+
It's up to you, if you install the currently provided ``compsys`` packages from
|
|
35
|
+
``tinyecs`` by using
|
|
36
|
+
|
|
37
|
+
.. code:: console
|
|
38
|
+
|
|
39
|
+
pip install tinyecs[base,patternengine]
|
|
40
|
+
|
|
41
|
+
or include them by adding specific dependencies:
|
|
42
|
+
|
|
43
|
+
.. code:: console
|
|
44
|
+
|
|
45
|
+
pip install tinyecs
|
|
46
|
+
pip install tinyecs-compsys
|
|
47
|
+
pip install tinyecs-compsys-patternengine
|
|
48
|
+
|
|
49
|
+
Support / Contributing
|
|
50
|
+
----------------------
|
|
51
|
+
|
|
52
|
+
Issues can be opened on `github issues`_
|
|
53
|
+
|
|
54
|
+
.. _github issues: https://github.com/dickerdackel/tinyecs-compsys-patternengine/issues
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
License
|
|
58
|
+
-------
|
|
59
|
+
|
|
60
|
+
This software is provided under the MIT license.
|
|
61
|
+
|
|
62
|
+
See LICENSE file for details.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "tinyecs-compsys-patternengine"
|
|
3
|
+
description = "patternengine component and system library for tinyecs"
|
|
4
|
+
version = "0.0.2"
|
|
5
|
+
readme = "README.rst"
|
|
6
|
+
|
|
7
|
+
authors = [
|
|
8
|
+
{ name="Michael Lamertz", email="michael.lamertz@gmail.com" }
|
|
9
|
+
]
|
|
10
|
+
|
|
11
|
+
classifiers = [
|
|
12
|
+
"Development Status :: 3 - Alpha",
|
|
13
|
+
"Intended Audience :: Developers",
|
|
14
|
+
"Topic :: Games/Entertainment",
|
|
15
|
+
"Topic :: Software Development :: Libraries :: pygame",
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
license = "MIT"
|
|
19
|
+
license-files = ["LICENSE"]
|
|
20
|
+
|
|
21
|
+
dependencies = [
|
|
22
|
+
'aenum',
|
|
23
|
+
'patternengine',
|
|
24
|
+
'tinyecs >= 0.5.0',
|
|
25
|
+
'tinyecs-compsys',
|
|
26
|
+
'tinyecs-compsys-base',
|
|
27
|
+
'tinyecs-compsys-dynamics',
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
[project.urls]
|
|
31
|
+
homepage = "https://github.com/dickerdackel/tinyecs-compsys-patternengine"
|
|
32
|
+
bugtracker = "https://github.com/DickerDackel/tinyecs-compsys-patternengine/issues"
|
|
33
|
+
|
|
34
|
+
[build-system]
|
|
35
|
+
requires = ["setuptools"]
|
|
36
|
+
build-backend = "setuptools.build_meta"
|
|
37
|
+
|
|
38
|
+
[tool.setuptools]
|
|
39
|
+
include-package-data = true
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
from collections.abc import Callable
|
|
2
|
+
from dataclasses import dataclass
|
|
3
|
+
|
|
4
|
+
import glm
|
|
5
|
+
import tinyecs as ecs
|
|
6
|
+
|
|
7
|
+
from aenum import extend_enum
|
|
8
|
+
from patternengine import BulletSource
|
|
9
|
+
from tinyecs import EntityID
|
|
10
|
+
from tinyecs.compsys import Comp
|
|
11
|
+
from tinyecs.compsys.dynamics import PRSA
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
extend_enum(Comp, 'EMITTER')
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@dataclass
|
|
18
|
+
class Emitter:
|
|
19
|
+
"""A component holding data for an emitter.
|
|
20
|
+
|
|
21
|
+
:param bullet_source: See :class:`patternengine.engine.BulletSource`
|
|
22
|
+
:param factory: The callback to launch bullets.
|
|
23
|
+
|
|
24
|
+
The prototype for ``factory`` is::
|
|
25
|
+
|
|
26
|
+
def factory(pos: glm.vec2, momentum: glm.vec2) -> None:
|
|
27
|
+
...
|
|
28
|
+
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
bullet_source: BulletSource
|
|
32
|
+
factory: Callable[[glm.vec2, glm.vec2], None]
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def sys_emitter(eid: EntityID, emitter: Emitter, prsa: PRSA):
|
|
36
|
+
"""Run an emit callback if the emitter fires.
|
|
37
|
+
|
|
38
|
+
:param eid: The entity ID
|
|
39
|
+
:param emitter: The :class:`Emitter` object
|
|
40
|
+
:param prsa: The PRSA transform object of the entity
|
|
41
|
+
|
|
42
|
+
The `patternengine` emits positions relative to ``(0, 0)``, and a
|
|
43
|
+
normalized momentum vector, both dependent of the chosen ring type in the
|
|
44
|
+
``BulletSource``.
|
|
45
|
+
|
|
46
|
+
The position will be rotated by the emitter's angle in degrees, after
|
|
47
|
+
that, the emitter's position will be added to it.
|
|
48
|
+
|
|
49
|
+
The momentum will also be rotated by the emitter's angle.
|
|
50
|
+
|
|
51
|
+
Then both will be passed to the factory callback.
|
|
52
|
+
|
|
53
|
+
Once the emitter is exhausted, the entity is marked as killed.
|
|
54
|
+
"""
|
|
55
|
+
|
|
56
|
+
try:
|
|
57
|
+
chunk = next(emitter.bullet_source)
|
|
58
|
+
except StopIteration:
|
|
59
|
+
ecs.add_component(eid, Comp.IS_KILLED, True)
|
|
60
|
+
return
|
|
61
|
+
|
|
62
|
+
rad = glm.radians(prsa.rotation)
|
|
63
|
+
for pos, momentum in chunk:
|
|
64
|
+
real_momentum = glm.rotate(momentum, rad)
|
|
65
|
+
real_pos = glm.rotate(pos, rad)
|
|
66
|
+
emitter.factory(real_pos + prsa.pos, real_momentum)
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tinyecs-compsys-patternengine
|
|
3
|
+
Version: 0.0.2
|
|
4
|
+
Summary: patternengine component and system library for tinyecs
|
|
5
|
+
Author-email: Michael Lamertz <michael.lamertz@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: homepage, https://github.com/dickerdackel/tinyecs-compsys-patternengine
|
|
8
|
+
Project-URL: bugtracker, https://github.com/DickerDackel/tinyecs-compsys-patternengine/issues
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Topic :: Games/Entertainment
|
|
12
|
+
Classifier: Topic :: Software Development :: Libraries :: pygame
|
|
13
|
+
Description-Content-Type: text/x-rst
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
Requires-Dist: aenum
|
|
16
|
+
Requires-Dist: patternengine
|
|
17
|
+
Requires-Dist: tinyecs>=0.5.0
|
|
18
|
+
Requires-Dist: tinyecs-compsys
|
|
19
|
+
Requires-Dist: tinyecs-compsys-base
|
|
20
|
+
Requires-Dist: tinyecs-compsys-dynamics
|
|
21
|
+
Dynamic: license-file
|
|
22
|
+
|
|
23
|
+
tinyecs-compsys-patternengine
|
|
24
|
+
=============================
|
|
25
|
+
|
|
26
|
+
These are components and systems for tinyecs together with the `patternengine`_.
|
|
27
|
+
|
|
28
|
+
.. _patternengine: https://github.com/dickerdackel/patternengine/
|
|
29
|
+
|
|
30
|
+
Synopsis
|
|
31
|
+
--------
|
|
32
|
+
|
|
33
|
+
This package relies on registered component IDs from ``tinyecs-compsys-base``.
|
|
34
|
+
It should not be used standalone, but instead be automatically detected and
|
|
35
|
+
registered with the top level ``tinyecs.compsys`` package.
|
|
36
|
+
|
|
37
|
+
.. code:: python
|
|
38
|
+
|
|
39
|
+
import tinyecs.compsys as cs
|
|
40
|
+
|
|
41
|
+
cs.register()
|
|
42
|
+
|
|
43
|
+
Usage
|
|
44
|
+
-----
|
|
45
|
+
|
|
46
|
+
Start with the `tinyecs docs`_, followed by the `patternengine docs`_
|
|
47
|
+
|
|
48
|
+
.. _tinyecs docs: https://tinyecs.readthedocs.io/en/latest/
|
|
49
|
+
.. _patternengine docs: https://patternengine.readthedocs.io/en/latest/
|
|
50
|
+
|
|
51
|
+
Then check the API docs.
|
|
52
|
+
|
|
53
|
+
Installation
|
|
54
|
+
------------
|
|
55
|
+
|
|
56
|
+
It's up to you, if you install the currently provided ``compsys`` packages from
|
|
57
|
+
``tinyecs`` by using
|
|
58
|
+
|
|
59
|
+
.. code:: console
|
|
60
|
+
|
|
61
|
+
pip install tinyecs[base,patternengine]
|
|
62
|
+
|
|
63
|
+
or include them by adding specific dependencies:
|
|
64
|
+
|
|
65
|
+
.. code:: console
|
|
66
|
+
|
|
67
|
+
pip install tinyecs
|
|
68
|
+
pip install tinyecs-compsys
|
|
69
|
+
pip install tinyecs-compsys-patternengine
|
|
70
|
+
|
|
71
|
+
Support / Contributing
|
|
72
|
+
----------------------
|
|
73
|
+
|
|
74
|
+
Issues can be opened on `github issues`_
|
|
75
|
+
|
|
76
|
+
.. _github issues: https://github.com/dickerdackel/tinyecs-compsys-patternengine/issues
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
License
|
|
80
|
+
-------
|
|
81
|
+
|
|
82
|
+
This software is provided under the MIT license.
|
|
83
|
+
|
|
84
|
+
See LICENSE file for details.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
MANIFEST.in
|
|
3
|
+
README.rst
|
|
4
|
+
pyproject.toml
|
|
5
|
+
src/tinyecs/compsys/patternengine/__init__.py
|
|
6
|
+
src/tinyecs_compsys_patternengine.egg-info/PKG-INFO
|
|
7
|
+
src/tinyecs_compsys_patternengine.egg-info/SOURCES.txt
|
|
8
|
+
src/tinyecs_compsys_patternengine.egg-info/dependency_links.txt
|
|
9
|
+
src/tinyecs_compsys_patternengine.egg-info/requires.txt
|
|
10
|
+
src/tinyecs_compsys_patternengine.egg-info/top_level.txt
|
tinyecs_compsys_patternengine-0.0.2/src/tinyecs_compsys_patternengine.egg-info/dependency_links.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
tinyecs
|