-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
110 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
Copyright (c) 2020, Jean-Paul Balabanian | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
1. Redistributions of source code must retain the above copyright notice, | ||
this list of conditions and the following disclaimer. | ||
2. Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS | ||
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | ||
THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# 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](https://github.com/jepebe/pixelengine/blob/master/images/palette.png?raw=true) | ||
|
||
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](https://github.com/jepebe/pixelengine/blob/master/images/animated_sprites.png?raw=true) | ||
|
||
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](https://github.com/jepebe/pixelengine/blob/master/images/text_rendering.png?raw=true) | ||
|
||
|
||
|
||
## Copyrights | ||
|
||
- C64 font - The font is included as part of the repository and the license | ||
is available here: https://style64.org/c64-truetype/license | ||
- olcPixelGameEngine - https://github.com/OneLoneCoder/olcPixelGameEngine | ||
- Freetype - The code for generating bitmap fonts as numpy arrays and rendering text with OpenGL Display Lists is copyrighted by Nicolas P. Rougier. | ||
https://github.com/rougier/freetype-py/blob/master/examples/opengl.py | ||
|
||
## Credits | ||
|
||
- thekingphoenix and Bonsaiheldin for the character sprite | ||
- para for particle effects |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
Create distribution: | ||
- python setup.py sdist bdist_wheel | ||
|
||
Upload package: | ||
- twine upload dist/* | ||
|
||
|
||
Simplify upload with a file $HOME/.pypirc containing: | ||
|
||
[pypi] | ||
username = __token__ | ||
password = pypi-token | ||
|
||
The token is generated on the PYPI account page. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import setuptools | ||
|
||
with open("README.md", "r") as fh: | ||
long_description = fh.read() | ||
|
||
setuptools.setup( | ||
name="pxng", | ||
version="0.0.3", | ||
author="Jean-Paul Balabanian", | ||
author_email="[email protected]", | ||
description="A library for fiddling with pixels", | ||
long_description=long_description, | ||
long_description_content_type="text/markdown", | ||
url="https://github.com/jepebe/pixelengine", | ||
packages=setuptools.find_packages(), | ||
license='BSD', | ||
classifiers=[ | ||
"Programming Language :: Python :: 3", | ||
"License :: OSI Approved :: BSD License", | ||
"Operating System :: OS Independent", | ||
], | ||
install_requires=[ | ||
'glfw>=2.0.0', | ||
'pyopengl>=3.1.0', | ||
'freetype-py>=2.2.0', | ||
'numpy>=1.19.0', | ||
'imageio>=2.9.0' | ||
], | ||
package_data={'pxng': ['resources/fonts/C64_Pro_Mono-STYLE.ttf']}, | ||
python_requires='>=3.6', | ||
) |