Skip to main content

Phoenyx - Pygame Engine v0.3.3

Some simple classes in python that could make your life much easier. Relies on pygame, numpy and pymunk, based on the idea of the Processing language.

Get the latest stable version using pip with pip install phoenyx.

  1. What it does
  2. How to ?
  3. Requirements
  4. Licenses
  5. Changelog
  6. TODOs

What it does

This library allows you to create graphical components in pygame in a very few lines of code. It handles all color management, stroke weights and filling for you. It also provides a Vector and a SandBox wrapper class for pymunk suitable for physics engines and more mathematical drawings.

Please go and check pygame and pymunk for their amazing work ! additional kudos to Daniel Shiffman.

How to ?

Please refer to the examples folder on GitHub for very simple but effective test files. You can now also read the helpme file for all available methods and objects.

from phoenyx import *
import random as rd

renderer: Renderer = Renderer(600, 600, "collision")
sandbox: SandBox = SandBox(renderer)

count = 0
fall = True


def revert() -> None:
    global fall
    fall = not fall


def clear() -> None:
    sandbox.clear()
    init()


def init() -> None:
    for i in range(11):
        for j in range(6):
            sandbox.add_ball(60*i + 30 * (j%2), 100 + 60*j, 1, 15, elasticity=.99, is_static=True)

    sandbox.add_segment((0, 600), (600, 600), 1, 5, is_static=True)
    for i in range(11):
        sandbox.add_segment((60 * i, 600), (60 * i, 500), 1, 5, is_static=True)


def setup() -> None:
    global fall
    init()
    renderer.create_menu("options", toggle=revert, clear=clear)

    renderer.set_background(51)
    renderer.text_size = 15


def draw() -> None:
    global count, fall
    sandbox.step(iter=1)
    sandbox.draw()
    renderer.text(10, 10, f"fps : {round(renderer.fps)}")

    count += 1
    if count >= 30:
        count = 0
        if fall:
            sandbox.add_ball(rd.randint(299, 301), 0, 1, 10, elasticity=.8)


if __name__ == "__main__":
    renderer.run()

Requirements

Obviously some distribution of python : python 3.9 or above is required.

You will also need pygame in order to use the Renderer, numpy to use Vectors math and pymunk to enable physics. To upgrade to a more recent version of any lib, run pip install --upgrade .... Requirements will automatically be met with pip when installing phoenyx.

Licenses

Phoenyx is licensed under the GPLv3. See LICENSE for more details. Phoenyx also includes the following components from other open source projects (see LICENSES folder for more) :

  • numpy licensed under the BSD 3-Clause "New" or "Revised" License
  • pygame licensed under the GNU LGPL version 2.1 License
  • pymunk licensed under the MIT License

Changelog

Please refer to the changelog file for the full history.

Migrating to the pymunk library for better physics (and complete support of chapes, joints and constraints). Circles, Segments and Polygons have been implemented (either dynamic or static ones). Pin joints, slide joints and segment extension have followed. Some fixes have been added to the Renderer as well as support for images manipulation.

v0.3.3: do a barrel roll (click to expand)
  • you can get rid of a SandBox shape if you want to
  • new methods for the Renderer to handle images and font changes
  • new ScrollBar thing (type help(phoenyx.ScrollBar) to learn more)
  • ScrollBar affects the Renderer view field of the main window
  • actual animation for the ScrollBar item
  • huge typo and format fix accross the entire repo (pray for the reorganisation)
  • somehow reorganisation worked around pymunk errors when closing main window
  • new method to handle the Renderer pixel array
  • new example file, water ripple (f slow)
  • finally worked around slicing vectors, functionnal getitem setitem delitem methods
  • new methods for the Renderer to draw anti-aliased lines

TODOs

  • option to hide buttons and sliders or to draw them only when needed
  • option of alts drawing methods for buttons
  • keyboard integration
  • scrollbars and side menus
  • interractive drawing
  • physics Sandbox
  • more physics happening for bodies
  • forms and confirm boxes, events
  • integrate some utility functions (based on the example files)
  • 2d game oriented approach, player, compas, cells, map, ...
  • get rid of the renderer and sandbox objects and bring all methods into main scope (not guaranteed)
  • if, big if, there is a v2, 3D rendering

Metadata

Release files for phoenyx 0.3.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for phoenyx 0.3.3
File Size Uploaded
phoenyx-0.3.3.tar.gz 84.3 kB Details

Release files / phoenyx-0.3.3.tar.gz

Download URL phoenyx-0.3.3.tar.gz
Size 84.3 kB
Tags Source
SHA-256 checksum
How to use checksums
bbdb972d1774bbde8f21b7fc7b39cc3a0c31d1f606f100f8c7eba3802d952cd2
BLAKE2b-256 checksum
How to use checksums
fa0121d0fe85a4fb5ace85bac101d378cc2b0f8adfcd1476a54f5af61f1deda6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page