Skip to main content

pyglet wrapper for making games.

Project description

📦 pyglet-gamemaker

PyPI version

ℹ️ Overview

pyglet-gamemaker is an extension of Pyglet that simplifies the process of making games! This project began when I became frustrated at the boilerplate I had to write all the time, and I wanted a cleaner system to quickly add features.

🌟 Features

  • Hitboxes
    • Fully working convex polygon collision
    • Includes circles
  • Spritesheets:
    • Automatically loaded
    • Labelable to allow for indexing by string
  • Widgets:
    • Dynamic anchoring for changing size
    • Uses spritesheets instead of individual images
  • Scenes:
    • Enabling and disabling handled automatically
    • Menus:
      • Easily create visuals + widgets
      • Widget positions relative to window size
  • Main Window class handles switching of scenes

✍️ Authors

I'm Steven Robles and I am a high school student with a small? passion for making games.

🚀 Usage

A simple program to render an empty Menu with button detection:

>>> import pyglet_gamemaker as pgm
>>> from pyglet_gamemaker.types import Color
>>> 
>>> 
>>> class Menu(pgm.Menu):
>>>     # Create widgets here
>>>     def create_widgets(self): ...
>>>     # Code that runs when button is pressed down
>>>     def on_half_click(self, button): ...
>>>     # Code that runs when button is fully clicked and released
>>>     def on_full_click(self, button): ...
>>>     # Code that runs when scene is enabled
>>>     def enable(self): ...
>>>     # Code that runs when scene is disabled
>>>     def disable(self): ...
>>> 
>>> 
>>> scene = Menu('Test')
>>> game = pgm.Window((640, 480))
>>> game.add_scene('Test', scene)
>>> game.run()

Creating a spritesheet

>>> # Create a sprite sheet with image assets
>>> #   This image, found in /test, has 3 images (bottom to top):
>>> #   Unpressed, Hover, and Pressed
>>> self.sheet = pgm.sprite.SpriteSheet('test/Default Button.png', rows=3, cols=1)

The following should go in Menu.create_widgets():

  • Creating text
>>> self.create_text(
>>>     'Text', 'Test',
>>>     ('center', 'center'), color=pgm.types.Color.BLACK
>>> )
  • Creating a button
>>> self.create_button(
>>>     'Button', self.sheet, 0,
>>>     ('center', 'center'),
>>>     # Event handlers defined in empty Menu class above
>>>     on_half_click=self.on_half_click, on_full_click=self.on_full_click
>>> )
  • Creating a text and button in one
>>> # A textbutton combines text and a button
>>> #   Hover enlarge makes text larger when hovering
>>> #   Works well with using larger hover sprite for button
>>> self.create_text_button(
>>>     'TextButton', 'Text',
>>>     self.sheet, 0,
>>>     ('center', 'center'), ('center', 'center'),
>>>     # Event handlers defined in empty Menu class above
>>>     on_half_click=self.on_half_click, on_full_click=self.on_full_click
>>> )

⬇️ Installation

Simple, understandable installation instructions!

pip install pyglet-gamemaker

Works in Python >=3.10

💭 Feedback and Contributing

To request features or report bugs, open an issue here.

Contact me directly

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

pyglet_gamemaker-1.0.1.tar.gz (3.4 MB view details)

Uploaded Source

Built Distribution

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

pyglet_gamemaker-1.0.1-py3-none-any.whl (23.5 kB view details)

Uploaded Python 3

File details

Details for the file pyglet_gamemaker-1.0.1.tar.gz.

File metadata

  • Download URL: pyglet_gamemaker-1.0.1.tar.gz
  • Upload date:
  • Size: 3.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyglet_gamemaker-1.0.1.tar.gz
Algorithm Hash digest
SHA256 7e7c38fc09ee8dacd7d5f261545d4244f362ffd6030a9c8297e5a5a2c0719ac7
MD5 4c60eda31cba3df957e5b25a5d21bc67
BLAKE2b-256 ed4e1446564fdf0541cd2c999012ceacf93fec0a9f9465e70b6ce047e9c4d645

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyglet_gamemaker-1.0.1.tar.gz:

Publisher: release.yml on Badnameee/pyglet-gamemaker

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyglet_gamemaker-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for pyglet_gamemaker-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7e54d154bf29ccd92472192dba17f78164e7843b5e4ef77e743b3dc95c7efa2f
MD5 df42c57137696def6f392427e881e727
BLAKE2b-256 f3ea7a8ec9c3fbc3d5cd8c7f35a024c5e9602c2fe4fa87984bb9da77ec0e2642

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyglet_gamemaker-1.0.1-py3-none-any.whl:

Publisher: release.yml on Badnameee/pyglet-gamemaker

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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