Skip to main content

gamelib: A library for creating 3d applications in python.

Project description

Tests

gamelib

This is a library I've been working on for writing 3d applications in python. You'll need to know at least a little bit about writing shaders in glsl to be effective with this library, though I do plan to include default implementations in the future.

Prerequisites

This package requires support for OpenGL 3.3 or later and currently supports python >= 3.8. If building from source some compiler will be required dependent on your platform.

Installation

Optionally create a virtual environment:

Linux:

python3 -m venv venv
. venv/bin/activate

Windows:

python3 -m venv venv
venv\Scripts\activate

Install with pip:

pip install gamelib

Usage

Detailed usage documentation can be found in the modules themselves, to get started you should import gamelib and init must be called before doing anything involving the window or OpenGL context, so it's recommended to call at the entry point to your application.

import gamelib

gamelib.init()

Update should be called on a loop to not hang the application.

while gamelib.is_running():
    gamelib.update()

To avoid hanging the main loop while executing a long running task, you can use the internal schedules.

def my_long_running_function():
    time.sleep(1)

gamelib.threaded_schedule.once(my_long_running_function, -1)

As mentioned above, see the modules for further documentation, or refer to example applications linked below.

Running the test suite

To run the tests you'll first need to get the source and install both the requirements and requirements-dev dependencies.

git clone https://github.com/peffjepin/gamelib.git
cd gamelib
python3 -m pip install -r requirements-dev.txt
python3 -m pip install -r requirements.txt

Then to run the tests simply:

pytest

For testing against different python versions you can run tox. The tox environment is set up to skip tests that require an opengl context.

tox

For a coverage report:

pytest --cov=gamelib --cov-report=html

Example Applications

gamelib-chess

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

gamelib-0.0.7.tar.gz (80.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gamelib-0.0.7-py3-none-any.whl (88.9 kB view details)

Uploaded Python 3

File details

Details for the file gamelib-0.0.7.tar.gz.

File metadata

  • Download URL: gamelib-0.0.7.tar.gz
  • Upload date:
  • Size: 80.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for gamelib-0.0.7.tar.gz
Algorithm Hash digest
SHA256 7b44094afd78264eb37780324ad302e89a809473d5464f8b2df2c37b6afe67e3
MD5 c7cfb5db99c04a7e15c5d9ec9ef7e06f
BLAKE2b-256 665a490d64736f13f3367425f0d086e0c9f9cecfc62e8c13c3079dfea4b88ea2

See more details on using hashes here.

File details

Details for the file gamelib-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: gamelib-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 88.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for gamelib-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 922fc6f099889ec79bddb6ed043146b04dfe7fb940d3f3955c9eace0064aee4a
MD5 5144dce133091a589b4a349898304025
BLAKE2b-256 b2d40c501115938cfcd72fb83d3c5e529003580310964d623460894ec06b75f1

See more details on using hashes here.

Supported by

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