SIGN IN SIGN UP
bevyengine / bevy UNCLAIMED

A refreshingly simple data-driven game engine built in Rust

0 0 59 Rust

feat(bevy_image): Support tileset grids to be created through the ImageArrayLayout (#24132)

# Objective

- [This issue](https://github.com/bevyengine/bevy/issues/23492) explains
how it's not possible to construct a tileset that has tiles arranged in
a grid. Currently it's only possible to construct a tileset using a
single column of vertical layers.

Fixes #23492.

## Solution

- This PR fixes that by giving the user the ability to pass the number
of rows / columns in an image/tileset OR the pixel width/height of each
tile in the image, and then applying a transformation step to the image
data to have it ordered correctly in the texture data Vector.

Eg:

```rust
    let tileset_handle = asset_server
        .load_builder()
        .with_settings::<ImageLoaderSettings>(|s| {
            s.array_layout = Some(ImageArrayLayout::GridCount {
                columns: 5,
                rows: 5,
            })
        })
        .load("tilesets/my_tileset.png");
```

or

```rust
    let tileset_handle = asset_server
        .load_builder()
        .with_settings::<ImageLoaderSettings>(|s| {
            s.array_layout = Some(ImageArrayLayout::GridSize {
                tile_width_pixels: 16,
                tile_height_pixels: 16,
            })
        })
        .load("tilesets/my_tileset.png");
```

## Testing

- Both enum varients tested with a grid based tileset and working on
Macos.

---

This PR could be expanded upon by supporting padding on tilesets or gaps
between tiles.

This is my first contribution to open source 🫣

---------

Co-authored-by: Blue <whatsup@bluepc.me>
B
Blue Pilkinton-Ching committed
a5a0a0b7059c3fb96f3587bb2bc44343754dface
Parent: ae2fcc0
Committed by GitHub <noreply@github.com> on 5/8/2026, 1:35:16 PM