xecs-pygame
A plugin for xecs, allowing you to render your entities with pygame.
Usage
First, add the plugin to your xecs app.
import xecs as xx
from xecs_pygame import PyGamePlugin
def main() -> None:
app = xx.RealTimeApp()
app.add_plugin(PyGamePlugin())
Now, when you spawn entities, you can give them a Circle, Polygon, Rectangle component. If you do that, your entities will be rendered on the screen:
import xecs as xx
from xecs_pygame import Circle, PyGamePlugin
def spawn_three_circles(commands: xx.Commands, world: xx.World) -> None:
transformi, _ = commands.spawn((xx.Transform2, Circle), 3)
transform = world.get_view(xx.Transform2, transformi)
transform.translation.x.fill([0, 15, 30])
def main() -> None:
app = xx.RealTimeApp()
app.add_plugin(PyGamePlugin())
app.add_startup_system(spawn_three_circles)
app.add_pool(Circle.create_pool(3))
app.add_pool(xx.Transform2.create_pool(3))
app.run()
if __name__ == "__main__":
main()
Further examples
Installation
pip install xecs-pygame
Metadata
Release files for xecs-pygame 2.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| xecs_pygame-2.0.1.tar.gz | 6.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| xecs_pygame-2.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.9 kB
Release files / xecs_pygame-2.0.1.tar.gz
| Download URL | xecs_pygame-2.0.1.tar.gz |
|---|---|
| Size | 6.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
028de24793372784eb555d6cf4802d8c5d35e05f8293d9c0e22b830f1a4e2261
|
|
BLAKE2b-256 checksum How to use checksums |
8d96b38c847d4b7ee11379aff776ae432386b2577ee5cc4d6e4ed1b9c5e73330
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.5
|
Release files / xecs_pygame-2.0.1-py3-none-any.whl
| Download URL | xecs_pygame-2.0.1-py3-none-any.whl |
|---|---|
| Size | 4.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c0a804aaf31b80eb50c0e246e7188eedbef301f5fc4310630c5c73843fa287bd
|
|
BLAKE2b-256 checksum How to use checksums |
80168b346373f6980e6d248d0bbbf134b73f8efe7b2d05e04e5645729c7722fc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.5
|