No project description provided
Project description
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
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
xecs_pygame-1.1.0.tar.gz
(4.4 kB
view details)
Built Distribution
File details
Details for the file xecs_pygame-1.1.0.tar.gz
.
File metadata
- Download URL: xecs_pygame-1.1.0.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d7551e007f136096aea27f329597c505a506621d1a2698b230b69a7c2d9af216 |
|
MD5 | 5b225f247d98a6a2f1da3d6197bebd25 |
|
BLAKE2b-256 | f826d21161ca66fdd54df33b096694d754d7485762138e4e2b5e2adbc8b472a9 |
File details
Details for the file xecs_pygame-1.1.0-py3-none-any.whl
.
File metadata
- Download URL: xecs_pygame-1.1.0-py3-none-any.whl
- Upload date:
- Size: 3.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9e2691ff9b1918c35ae0776be177d8c62752ad81c743002f6bbbd37cab57d352 |
|
MD5 | 0abd22b67c145b72343b5c4201aa742f |
|
BLAKE2b-256 | c79571058e19bec295d9df605086b192059caaad3adb24bea23ddeccae47e177 |