Skip to main content

A powerful game, graphics, and application development library for Python

Project description

Downloads PyPI PyPI - Python Version PyPI - Wheel GitHub


What is it?

goopylib is powerful game, graphics, and GUI library for Python and C++ to build cross-platform applications. It allows you to unlock the potential of OpenGL and low-level graphics with a high-level, simple-yet-powerful API.

Key Features:

  • Cross-Platform & Powerful
  • Fast! Built-in batch-rendering & optimizations
  • Accessible through Python & C++
  • Simple code to create, transform, & animate images, quads, triangles, circles, and more
  • Automatic 2D Orthographic Camera & Camera Controller
  • Window & Mouse events: key & button presses, several callbacks, etc.

In Development:

  • Text Rendering
  • GUI Elements
  • Animation Engine
  • Texture Factory
  • Low-Level API Access

Future Plans:

  • 2D Rigid-Body Physics Engine
  • Sound & Lighting Engine
  • Profiling Tools
  • Build & Distribution Tools

Examples

Solar System Simulator:

https://github.com/BhavyeMathur/goopylib-solar-system-simulation

Brick Breaker:

https://github.com/BhavyeMathur/goopylib-brick-breaker

Conway's Game of Life:

https://github.com/BhavyeMathur/goopylib-conways-game-of-life

Installation

Requires Python ≥ 3.8. To install goopylib on Windows or MacOS, use the Python Package Index (PyPI):

pip install goopylib

Wheels for Linux are not currently supported but coming as soon as I can build them!

Tutorial

Let's start by creating a rectangle on an empty window:

import goopylib as gp

window = gp.Window(700, 500)  # width=700, height=500

# centered at (0, 0), width=100, height=50
rect = gp.Rectangle((0, 0), 100, 50).draw(window)

while window.is_open():
    gp.update()

Inside the loop, you can check for events (or define callbacks instead):

while window.is_open():
    if window.check_key(gp.KEY_H):
        rect.hide()
    elif window.check_key(gp.KEY_S):
        rect.show()
    
    mousex, mousey = window.get_mouse_position()
    
    if rect.contains(mousex, mousey):
        print("Hovering over the rectangle!")
        
    gp.update()

Draw other shapes or more complex objects:

img = gp.Image("filepath.png", (0, 0)).draw(window)

Install a simple camera controller that automatically moves, rotates, and zooms in & out!

controller = gp.CameraController(window)

while window.is_open():
    # ...
    controller.update()

Documentation

The documentation for goopylib can be found here. Please submit an issue or email bhavyemathur@gmail.com for any questions!

Contributing & Usage

Contributions to goopylib are absolutely welcome! Please reach out to me if you have an idea or feature request or submit a pull request yourself. I'd love to hear if you've used goopylib for a project—maybe we could even add some screenshots to a gallery.

goopylib is licensed under the Mozilla Public License Version 2.0 which essentially enables you use and modify goopylib (commercially or otherwise) as long as you attribute the project! See choosealicense.com for more details.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

goopylib-2.1.0.tar.gz (7.4 MB view hashes)

Uploaded Source

Built Distributions

goopylib-2.1.0-cp311-cp311-win_amd64.whl (1.3 MB view hashes)

Uploaded CPython 3.11 Windows x86-64

goopylib-2.1.0-cp311-cp311-macosx_11_0_arm64.whl (3.6 MB view hashes)

Uploaded CPython 3.11 macOS 11.0+ ARM64

goopylib-2.1.0-cp311-cp311-macosx_10_9_x86_64.whl (3.7 MB view hashes)

Uploaded CPython 3.11 macOS 10.9+ x86-64

goopylib-2.1.0-cp310-cp310-win_amd64.whl (1.3 MB view hashes)

Uploaded CPython 3.10 Windows x86-64

goopylib-2.1.0-cp310-cp310-macosx_11_0_arm64.whl (3.6 MB view hashes)

Uploaded CPython 3.10 macOS 11.0+ ARM64

goopylib-2.1.0-cp310-cp310-macosx_10_9_x86_64.whl (3.7 MB view hashes)

Uploaded CPython 3.10 macOS 10.9+ x86-64

goopylib-2.1.0-cp39-cp39-win_amd64.whl (1.3 MB view hashes)

Uploaded CPython 3.9 Windows x86-64

goopylib-2.1.0-cp39-cp39-macosx_11_0_arm64.whl (3.6 MB view hashes)

Uploaded CPython 3.9 macOS 11.0+ ARM64

goopylib-2.1.0-cp39-cp39-macosx_10_9_x86_64.whl (3.7 MB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

goopylib-2.1.0-cp38-cp38-win_amd64.whl (1.3 MB view hashes)

Uploaded CPython 3.8 Windows x86-64

goopylib-2.1.0-cp38-cp38-macosx_11_0_arm64.whl (3.6 MB view hashes)

Uploaded CPython 3.8 macOS 11.0+ ARM64

goopylib-2.1.0-cp38-cp38-macosx_10_9_x86_64.whl (3.7 MB view hashes)

Uploaded CPython 3.8 macOS 10.9+ x86-64

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