A simple atlasting system for Raylib-py
Project description
The Atlas Project 📖
A specialized system that allows users to create an effective atlas system with Raylib-py! With the help of Python, Raylib-py and coffee, this simple module can help you optimize your game by reducing draw calls.
How to use 🚀
1. Installing:
- Install it with pip:
pip install the-atlas-project
2. Importing:
- Import it to your project
# Import the AtlasReader class
from the_atlas_project import AtlasReader
3. Instance Creation
- Create an instance of the class and pass in the file name of your JSON Atlas properties (e.g. 'atlas.json')
# Create an instance of the AtlastReader class with it's respective arguments
atlas = AtlasReader("atlas.json")
- Note: The atlas properties file must follow this syntax in order to properly recognize the assets:
{
"atlas": "assets/atlas.jpg",
"entries": {
"sprite1": {
"x": 0,
"y": 0,
"w": 16,
"h": 16
},
"sprite2": {
"x": 17,
"y": 0,
"w": 16,
"h": 16
}
}
}
- Explanation:
atlasis the name of your atlas picture.entriesare where your sprite entries reside. You must put your sprite entries within here.sprite1andsprite2are custom names that you must assign in order to properly get use it indraw_sprite()later.x,y,wandhcorrespond to x position, y position, width, and height respectively. This is important because this is how the module can actually find the texture.
4. Drawing:
- Finally draw the sprite with the
draw_sprite()function and pass in the name of your sprite, corresponding to the atlas.json file, while also passing the x and y positions of where you want to place your sprite. - Optionally, you can pass scaling arguments to scale your sprite with type float. The default scaling factor is 1.0
# Draw the sprite
atlas.draw_sprite("sprite2", 20, 20, scalex=5.0, scaley=5.0)
5. Unloading
- Ensure to unload the atlas after use with the
unload()function. This ensure that no memory leaks can happen.
atlas.unload()
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
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 the_atlas_project-1.0.1.tar.gz.
File metadata
- Download URL: the_atlas_project-1.0.1.tar.gz
- Upload date:
- Size: 2.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
153a4620cb8e7129b3116e58e6f13fec337ee207883347f7b4aba71c0abdc019
|
|
| MD5 |
0c90c0dd79e9894cdb45cf22ee8b18de
|
|
| BLAKE2b-256 |
4e3bce00d0c1c5b5d536b1a1d7ae078b055d95d57843883bffd05e306e1222a0
|
File details
Details for the file the_atlas_project-1.0.1-py3-none-any.whl.
File metadata
- Download URL: the_atlas_project-1.0.1-py3-none-any.whl
- Upload date:
- Size: 2.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d558a2ca2b167d51ebab65d3c24f8fdd17179605f1bd6fca7aa9f8706ada5a81
|
|
| MD5 |
d3351a4357bddcdefbcf40cc314a8519
|
|
| BLAKE2b-256 |
a91ac8924d07b58f60d7f753a5b231d776a9f7513ac252d5d613dcde122b474c
|