From 61af38f5877cd1154a1047ab0c5d1598d9c9dddf Mon Sep 17 00:00:00 2001 From: jeanpaul Date: Wed, 14 Oct 2020 19:10:18 +0200 Subject: [PATCH] Add setup.py --- LICENSE.md | 22 ++++++++++++++++++++++ README.md | 43 +++++++++++++++++++++++++++++++++++++++++++ notest.txt | 14 ++++++++++++++ setup.py | 31 +++++++++++++++++++++++++++++++ 4 files changed, 110 insertions(+) create mode 100644 LICENSE.md create mode 100644 README.md create mode 100644 notest.txt create mode 100644 setup.py diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..af80792 --- /dev/null +++ b/LICENSE.md @@ -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. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..3fa0581 --- /dev/null +++ b/README.md @@ -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 \ No newline at end of file diff --git a/notest.txt b/notest.txt new file mode 100644 index 0000000..028aeae --- /dev/null +++ b/notest.txt @@ -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. \ No newline at end of file diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..0476d00 --- /dev/null +++ b/setup.py @@ -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="jepebe@prador.net", + 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', +)