{"id":15155324,"url":"https://github.com/ickshonpe/bevy_heterogeneous_texture_atlas_loader","last_synced_at":"2025-05-02T07:33:22.236Z","repository":{"id":50650250,"uuid":"458788968","full_name":"ickshonpe/bevy_heterogeneous_texture_atlas_loader","owner":"ickshonpe","description":"Load heterogeneous texture atlases with Bevy","archived":false,"fork":false,"pushed_at":"2022-11-14T10:36:44.000Z","size":86,"stargazers_count":7,"open_issues_count":2,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-10-29T23:08:08.501Z","etag":null,"topics":["bevy","bevy-plugin","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ickshonpe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-02-13T11:27:26.000Z","updated_at":"2024-01-20T07:27:52.000Z","dependencies_parsed_at":"2023-01-21T15:37:46.880Z","dependency_job_id":null,"html_url":"https://github.com/ickshonpe/bevy_heterogeneous_texture_atlas_loader","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ickshonpe%2Fbevy_heterogeneous_texture_atlas_loader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ickshonpe%2Fbevy_heterogeneous_texture_atlas_loader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ickshonpe%2Fbevy_heterogeneous_texture_atlas_loader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ickshonpe%2Fbevy_heterogeneous_texture_atlas_loader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ickshonpe","download_url":"https://codeload.github.com/ickshonpe/bevy_heterogeneous_texture_atlas_loader/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224305847,"owners_count":17289446,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bevy","bevy-plugin","rust"],"created_at":"2024-09-26T18:04:32.311Z","updated_at":"2024-11-12T16:04:56.040Z","avatar_url":"https://github.com/ickshonpe.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bevy Heterogenous Texture Atlas Loader\n\n[![crates.io](https://img.shields.io/crates/v/bevy_heterogeneous_texture_atlas_loader)](https://crates.io/crates/bevy_heterogeneous_texture_atlas_loader)\n[![MIT/Apache 2.0](https://img.shields.io/badge/license-MIT%2FApache-blue.svg)](https://github.com/ickshonpe/bevy_heterogeneous_texture_atlas_loader)\n[![crates.io](https://img.shields.io/crates/d/bevy_heterogeneous_texture_atlas_loader)](https://crates.io/crates/bevy_heterogeneous_texture_atlas_loader)\n\nBevy Heterogenous Texture Atlas Loader allows you to load heterogenous texture atlases from a RON file manifest.\n\n## Bevy Compatibility\n\n| version    | bevy |\n| ---------- | ---- |\n| 0.10       | 0.9 |\n| 0.7 to 0.9 | 0.8  |\n| 0.6        | 0.7  |\n| \u003c 0.6      | 0.6  |\n\n#\n## Basic usage\n1. Add to your project's `Cargo.toml` ```[dependencies]``` section\n\n    ```toml\n    bevy_heterogeneous_texture_atlas_loader = \"0.10.0\"\n    ```\n\n1. Add the `TextureAtlasLoaderPlugin` to your Bevy App.\n    ```rust\n    use bevy_heterogeneous_texture_atlas_loader::*;\n    app.add_plugin(TextureAtlasLoaderPlugin);\n    ```\n\n2. Add the atlas source image and `.ron` manifest to your assets folder.\n\n3. Load the texture atlas manifest using the asset server:\n    ```rust\n    let texture_atlas: Handle\u003cTextureAtlas\u003e = asset_server.load(\"\u003cpath\u003e.ron\");\n    ```\n    The plugin will then load the atlas image and create the TextureAtlas asset automatically.\n\n4. The `TextureAtlas`'s sprite indices respect the order of the sprites in the manifest. \n    Atlas index 0 will be the first sprite in the manifest, 1 the second, and so on.\n    You can also use the `TextureAtlas::get_texture_index` method to look up the index using an asset path:\n    ```rust\n    texture_atlas.get_texture_index(\u0026Handle::weak(\"sprite_name\".into()))\n    ```\n\n    which you can see used in `\\examples\\example.rs`\n\n#\n\n## The Manifest \n\n* To create a manifest for a sprite sheet with irregular sized and positioned sprites like:\n\n    ![/assets/example.png](/assets/example.png)\n\n\n1. Create a .ron file in your assets folder. \n\n    The sprite indices in the output TextureAtlas are ordered implicitly according to the order of the input list sprite rects.\n\n*   The `name` field is used to give a sprite a unique name that can be used to look\n    up their TextureAtlas index using a weak `Handle\u003cImage\u003e` with the asset_path \n    `\"sprite_name\"`.\n\n    ```rust\n    (\n        // Path to the texture atlas source image file \n        path: \"example.png\",        \n\n        // List of sprites        \n        sprites: [    \n            (\n                // use a handle with the asset path \"rothko\" \n                // to retrieve this sprite's index using TextureAtlas::get_texture_index.\n                name: \"rothko\",  \n\n                // top left x coordinate of the sprite in pixels\n                x: 18,           \n\n                // top left y coordinate of the sprite in pixels\n                y: 19,              \n\n                // width of the sprite in pixels\n                w: 46,              \n\n                // height of the sprite in pixels\n                h: 48               \n            ),\n            (\n                name: \"face\", \n                x: 93, \n                y: 108, \n                w: 32, \n                h: 31\n            ),\n            (\n                name: \"patches\", \n                x: 176, \n                y: 34, \n                w: 20, \n                h: 34\n            ),\n        ]\n    )\n    ```\n* If you don't need names for the sprites, you can leave out the `name` field:\n    ```rust\n    (\n        path: \"example.png\",\n\n        sprites:[         \n            (    \n                // sprite at atlas index 0\n                x: 18, \n                y: 19, \n                w: 46, \n                h: 48\n            ),\n             (\n                // sprite at atlas index 1\n                x: 93, \n                y: 108, \n                w: 32, \n                h: 31\n            ),\n            // ...\n        ]\n    )\n    ```\n  \n## Examples\n\n* `minimal.rs`\n\n    Loads a texture atlas and cycles through its textures. Run with\n    ```\n    cargo run --example minimal\n    ```\n\n* `example.rs` \n\n    Example of loading and displaying a texture atlas. Run with\n    ```\n    cargo run --example example\n    ```\n\n `two.rs` \n\n    Another example of loading and displaying texture atlases. Run with\n    ```\n    cargo run --example example\n    ```\n\n* `bevy_asset_loader.rs`\n\n    Example using `bevy_asset_loader` to manage loading. Run with\n    ```\n    cargo run --example bevy_asset_loader\n    ```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fickshonpe%2Fbevy_heterogeneous_texture_atlas_loader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fickshonpe%2Fbevy_heterogeneous_texture_atlas_loader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fickshonpe%2Fbevy_heterogeneous_texture_atlas_loader/lists"}