Skip to main content

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.4.0.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

xecs_pygame-1.4.0-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file xecs_pygame-1.4.0.tar.gz.

File metadata

  • Download URL: xecs_pygame-1.4.0.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for xecs_pygame-1.4.0.tar.gz
Algorithm Hash digest
SHA256 df05eb874dd205e7429de5b818be99f973db22b810cc3d9486af627bd683f511
MD5 5a87930e4c84e5c2a9a42d4dc20d526f
BLAKE2b-256 39693b1289321db449e4b154a5a3fefa791d39bd77fa1ecc6dddd7f6211602b9

See more details on using hashes here.

File details

Details for the file xecs_pygame-1.4.0-py3-none-any.whl.

File metadata

  • Download URL: xecs_pygame-1.4.0-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for xecs_pygame-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5af60ca553d7b5d57e244f8a8b8aca6581bb0de8b4612defb111d761f4980441
MD5 5239d88e49f2f5e3153512117e81a5bc
BLAKE2b-256 9ee72bf0d9097cb95d3cdf5397858dd5ece09afac330f8bc81794b3043f42ed3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page