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()
Metadata
Release files for the-atlas-project 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| the_atlas_project-1.0.1.tar.gz | 2.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| the_atlas_project-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 5.5 kB
Release files / the_atlas_project-1.0.1.tar.gz
| Download URL | the_atlas_project-1.0.1.tar.gz |
|---|---|
| Size | 2.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
153a4620cb8e7129b3116e58e6f13fec337ee207883347f7b4aba71c0abdc019
|
|
BLAKE2b-256 checksum How to use checksums |
4e3bce00d0c1c5b5d536b1a1d7ae078b055d95d57843883bffd05e306e1222a0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.9
|
Release files / the_atlas_project-1.0.1-py3-none-any.whl
| Download URL | the_atlas_project-1.0.1-py3-none-any.whl |
|---|---|
| Size | 2.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d558a2ca2b167d51ebab65d3c24f8fdd17179605f1bd6fca7aa9f8706ada5a81
|
|
BLAKE2b-256 checksum How to use checksums |
a91ac8924d07b58f60d7f753a5b231d776a9f7513ac252d5d613dcde122b474c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.9
|