Skip to main content

A library for fiddling with pixels

Project description

PXNG

PXNG is a python library that provides a simplified API for working with pixels, drawing shapes, writing text and interacting with input devices. It is inspired by the olcPixelGameEngine by OneLoneCoder.

What it can do:

  • Create a window for drawing. The window supports rendering at a lower virtual resolution.
  • Render text. The built in font is C64 styled.
  • Render filled shapes. Currently only rectangles. :)
  • Render sprites. Sprites can be scaled and blend with the background. Created from NumPy arrays. It is also possible to use imageio to read files directly in to sprites. Any changes in the data buffer of the sprite can be updated in the live rendering.
  • Animated sprites. Using a sprite sheet pxng supports animation.
  • Poll the keyboard for events.

How to Install

Installation of pxng is done simply by: pip install pxng. The examples are not part of the distribution.

Examples

In the examples folder there are three applications that show how the library is used to perform different tasks. These examples does not show the most efficient way of doing the task, however.

  1. Palette - By abusing fill_rect the following screenshot was created. The live rendering animates the color of the lower HSL view and all of the RGB views. Screenshot of palette.py

  2. Animated Sprites - Shows some of the possibilities of rendering sprite sheets. All of the visible sprites in the screenshot are animated by sub indexing the sprite sheet in a 8x8 grid. Screenshot of animated_sprites.py

  3. Text Rendering - This example shows animated rendering of text. The green field of hexadecimal numbers scrolls by as fast as it can. Screenshot of text_rendering.py

Copyrights

Credits

  • thekingphoenix and Bonsaiheldin for the character sprite
  • para for particle effects

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

pxng-0.0.2.tar.gz (21.4 kB view hashes)

Uploaded Source

Built Distribution

pxng-0.0.2-py3-none-any.whl (21.0 kB view hashes)

Uploaded Python 3

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