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.2.0.tar.gz
(4.4 kB
view details)
Built Distribution
File details
Details for the file xecs_pygame-1.2.0.tar.gz
.
File metadata
- Download URL: xecs_pygame-1.2.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 | b35faeb0b07c7c97cc5a574fba2e89330db615407b40fa5658baa8f6af79ee96 |
|
MD5 | 8303162a3b16b7a181a58a180609ad9d |
|
BLAKE2b-256 | 462c7ab3cefecfeaffd9a0f6f7097d098298b86cc8ec4e1f3065e07898c84787 |
File details
Details for the file xecs_pygame-1.2.0-py3-none-any.whl
.
File metadata
- Download URL: xecs_pygame-1.2.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 | d44cdc205c9c775a9f661853d57ca081e5ddd61812215d65af893151b72dc7c6 |
|
MD5 | a8f5c5007343c2448bad205c00343207 |
|
BLAKE2b-256 | 21be391849ae3671f1c90e8f131498fdad45a8663a7c9b64df772088ed26ea80 |