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.3.0.tar.gz
(4.6 kB
view details)
Built Distribution
File details
Details for the file xecs_pygame-1.3.0.tar.gz
.
File metadata
- Download URL: xecs_pygame-1.3.0.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a567c160d52f4a91ad693fd33d090a8b0e0c3cd7dd0a73cc9fb6eeb0e9df1b99 |
|
MD5 | f6b76026a0d96bdc6a85cbfbdd472549 |
|
BLAKE2b-256 | c51f3bf146562fc9ab912579913d361f6c56129ab456f0f11f9b5b77f7fd03d4 |
File details
Details for the file xecs_pygame-1.3.0-py3-none-any.whl
.
File metadata
- Download URL: xecs_pygame-1.3.0-py3-none-any.whl
- Upload date:
- Size: 3.6 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 | 39da0e1214446458b8b4f89a0335f45708e7606e41729944cf40f8732b6b9f09 |
|
MD5 | 39ba7918ed415775e2162b42c004fcff |
|
BLAKE2b-256 | d7b65fc0d1035fd028e6d5bd1a6f9a6d168e495db3b8ee35a2063682d41eb60f |