
# Objective - Allow other crates to use `TextureAtlas` and friends without needing to depend on `bevy_sprite`. - Specifically, this allows adding `TextureAtlas` support to custom cursors in https://github.com/bevyengine/bevy/pull/17121 by allowing `bevy_winit` to depend on `bevy_image` instead of `bevy_sprite` which is a [non-starter]. [non-starter]: https://github.com/bevyengine/bevy/pull/17121#discussion_r1904955083 ## Solution - Move `TextureAtlas`, `TextureAtlasBuilder`, `TextureAtlasSources`, `TextureAtlasLayout` and `DynamicTextureAtlasBuilder` into `bevy_image`. - Add a new plugin to `bevy_image` named `TextureAtlasPlugin` which allows us to register `TextureAtlas` and `TextureAtlasLayout` which was previously done in `SpritePlugin`. Since `SpritePlugin` did the registration previously, we just need to make it add `TextureAtlasPlugin`. ## Testing - CI builds it. - I also ran multiple examples which hopefully covered any issues: ``` $ cargo run --example sprite $ cargo run --example text $ cargo run --example ui_texture_atlas $ cargo run --example sprite_animation $ cargo run --example sprite_sheet $ cargo run --example sprite_picking ``` --- ## Migration Guide The following types have been moved from `bevy_sprite` to `bevy_image`: `TextureAtlas`, `TextureAtlasBuilder`, `TextureAtlasSources`, `TextureAtlasLayout` and `DynamicTextureAtlasBuilder`. If you are using the `bevy` crate, and were importing these types directly (e.g. before `use bevy::sprite::TextureAtlas`), be sure to update your import paths (e.g. after `use bevy::image::TextureAtlas`) If you are using the `bevy` prelude to import these types (e.g. `use bevy::prelude::*`), you don't need to change anything. If you are using the `bevy_sprite` subcrate, be sure to add `bevy_image` as a dependency if you do not already have it, and be sure to update your import paths.
82 lines
2.4 KiB
TOML
82 lines
2.4 KiB
TOML
[package]
|
|
name = "bevy_image"
|
|
version = "0.16.0-dev"
|
|
edition = "2021"
|
|
description = "Provides image types for Bevy Engine"
|
|
homepage = "https://bevyengine.org"
|
|
repository = "https://github.com/bevyengine/bevy"
|
|
license = "MIT OR Apache-2.0"
|
|
keywords = ["bevy"]
|
|
|
|
[features]
|
|
# Image formats
|
|
basis-universal = ["dep:basis-universal"]
|
|
bmp = ["image/bmp"]
|
|
dds = ["ddsfile"]
|
|
exr = ["image/exr"]
|
|
ff = ["image/ff"]
|
|
gif = ["image/gif"]
|
|
hdr = ["image/hdr"]
|
|
ktx2 = ["dep:ktx2"]
|
|
ico = ["image/ico"]
|
|
jpeg = ["image/jpeg"]
|
|
png = ["image/png"]
|
|
pnm = ["image/pnm"]
|
|
qoi = ["image/qoi"]
|
|
tga = ["image/tga"]
|
|
tiff = ["image/tiff"]
|
|
webp = ["image/webp"]
|
|
serialize = []
|
|
|
|
# For ktx2 supercompression
|
|
zlib = ["flate2"]
|
|
zstd = ["ruzstd"]
|
|
|
|
[dependencies]
|
|
# bevy
|
|
bevy_app = { path = "../bevy_app", version = "0.16.0-dev" }
|
|
bevy_asset = { path = "../bevy_asset", version = "0.16.0-dev" }
|
|
bevy_color = { path = "../bevy_color", version = "0.16.0-dev", features = [
|
|
"serialize",
|
|
"wgpu-types",
|
|
] }
|
|
bevy_math = { path = "../bevy_math", version = "0.16.0-dev" }
|
|
bevy_reflect = { path = "../bevy_reflect", version = "0.16.0-dev", features = [
|
|
"bevy",
|
|
] }
|
|
bevy_utils = { path = "../bevy_utils", version = "0.16.0-dev" }
|
|
|
|
# rendering
|
|
image = { version = "0.25.2", default-features = false }
|
|
|
|
# misc
|
|
bitflags = { version = "2.3", features = ["serde"] }
|
|
bytemuck = { version = "1.5" }
|
|
wgpu-types = { version = "23", default-features = false }
|
|
# TODO: remove dependency on wgpu once https://github.com/gfx-rs/wgpu/pull/6648, 6649 and 6650 have been released
|
|
wgpu = { version = "23.0.1", default-features = false }
|
|
serde = { version = "1", features = ["derive"] }
|
|
thiserror = { version = "2", default-features = false }
|
|
futures-lite = "2.0.1"
|
|
guillotiere = "0.6.0"
|
|
rectangle-pack = "0.4"
|
|
ddsfile = { version = "0.5.2", optional = true }
|
|
ktx2 = { version = "0.3.0", optional = true }
|
|
# For ktx2 supercompression
|
|
flate2 = { version = "1.0.22", optional = true }
|
|
ruzstd = { version = "0.7.0", optional = true }
|
|
# For transcoding of UASTC/ETC1S universal formats, and for .basis file support
|
|
basis-universal = { version = "0.3.0", optional = true }
|
|
tracing = { version = "0.1", default-features = false, features = ["std"] }
|
|
|
|
[dev-dependencies]
|
|
bevy_ecs = { path = "../bevy_ecs", version = "0.16.0-dev" }
|
|
bevy_sprite = { path = "../bevy_sprite", version = "0.16.0-dev" }
|
|
|
|
[lints]
|
|
workspace = true
|
|
|
|
[package.metadata.docs.rs]
|
|
rustdoc-args = ["-Zunstable-options", "--generate-link-to-definition"]
|
|
all-features = true
|