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:
def spawn_three_circles(commands: xx.Commands, world: xx.World) -> None:
circle_transformi, _ = commands.spawn((xx.Transform2, Circle), 3)
circle_transform = world.get_view(xx.Transform2, circle_transformi)
circle_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))
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.0.0.tar.gz
(4.2 kB
view hashes)
Built Distribution
Close
Hashes for xecs_pygame-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f92fbe90919f475f3df565eaaa35904313a8297f454356afe826ba802c4c0911 |
|
MD5 | d4bea1892f3acd5a14661931c45bc9f9 |
|
BLAKE2b-256 | 6f6d505221d8f92eec01fb09f6a226059a2e9db98ea8b2a0225e43975b8630c3 |