pyglet wrapper for making games.
Project description
📦 pyglet-gamemaker
ℹ️ 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.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyglet_gamemaker-1.0.0.tar.gz.
File metadata
- Download URL: pyglet_gamemaker-1.0.0.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7fd5bb862233a6bf56695b42c3526c6a044f493f14cab68cbc772f851c356a63
|
|
| MD5 |
d0efe5445d55608ade0a4feaa871d402
|
|
| BLAKE2b-256 |
0142c1bb7c1caf1b5fc7f776beddb9134ff01541d40556e8d519c0bfafb4d328
|
Provenance
The following attestation bundles were made for pyglet_gamemaker-1.0.0.tar.gz:
Publisher:
release.yml on Badnameee/pyglet_gamemaker
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyglet_gamemaker-1.0.0.tar.gz -
Subject digest:
7fd5bb862233a6bf56695b42c3526c6a044f493f14cab68cbc772f851c356a63 - Sigstore transparency entry: 782081973
- Sigstore integration time:
-
Permalink:
Badnameee/pyglet_gamemaker@48727d7916837ae2115f9ea24c4cedfd0c708b11 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/Badnameee
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@48727d7916837ae2115f9ea24c4cedfd0c708b11 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pyglet_gamemaker-1.0.0-py3-none-any.whl.
File metadata
- Download URL: pyglet_gamemaker-1.0.0-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd1821f6b3b87d84c4cc2fe3e4c97e83056dce3055b9659ac3f34ffdfd8b1f01
|
|
| MD5 |
bec149e96b4b025cc299fae7b9bab300
|
|
| BLAKE2b-256 |
86c9738ce1213555537996c1efa800e18634d0142ff47fd44038096af6e5ae1d
|
Provenance
The following attestation bundles were made for pyglet_gamemaker-1.0.0-py3-none-any.whl:
Publisher:
release.yml on Badnameee/pyglet_gamemaker
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyglet_gamemaker-1.0.0-py3-none-any.whl -
Subject digest:
fd1821f6b3b87d84c4cc2fe3e4c97e83056dce3055b9659ac3f34ffdfd8b1f01 - Sigstore transparency entry: 782081974
- Sigstore integration time:
-
Permalink:
Badnameee/pyglet_gamemaker@48727d7916837ae2115f9ea24c4cedfd0c708b11 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/Badnameee
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@48727d7916837ae2115f9ea24c4cedfd0c708b11 -
Trigger Event:
release
-
Statement type: