Texture bag
This library provides a container to store textures without manual file loading and conversion boilerplate. It also provides single access point to textures, even if they weren't loaded on container init. Library supports lazy loading to load textures from a file on-demand and eager loading to load all textures on container init.
Usage
Add to your cargo.toml
[]
= "0.0.1"
Preparations
First of all, you need to create config file with list of all textures used in your project:
Default filename is texture_config.json
, but you can change it passing actual name and path as one of the parameters on TextureBag init.
Examples of usage
Further TODOs and issues
Please note that this version is basically alpha version of the project. API might change before it will be stabilized. Further possible improvements:
- For now texture_id is basically a String. I probably need to make it more generic and support any type that implemented Display interface
- "All or nothing" loading is good for small number of files. I need to implement chunk loading for big projects. Loading textures by groups seems good enough.