Deps update

This commit is contained in:
Piotr Siuszko 2025-05-07 11:01:32 +02:00
parent 39a9d89d68
commit 8a0751ac4f
7 changed files with 50 additions and 14 deletions

View File

@ -16,3 +16,7 @@ strip = true
# Optimize all dependencies even in debug builds:
[profile.dev.package."*"]
opt-level = 2
[workspace.dependencies]
texture_packer = { version = "0.30", features = ["common"] }
image = { version = "0.25", features = ["jpeg", "png"] }

View File

@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.2.0] - 2025-05-07
### Added
- `RpackAtlasAssetLoaderSettings` for asset loading
### Changed
- Updated to Bevy 0.16
## [0.1.2] - 2025-01-27
### Added

View File

@ -1,7 +1,7 @@
[package]
name = "bevy_rpack"
description = "Bevy plugin with rpack atlas support"
version = "0.1.2"
version = "0.2.0"
edition = "2021"
repository = "https://github.com/Leinnan/rpack.git"
homepage = "https://github.com/Leinnan/rpack"
@ -15,18 +15,18 @@ default = ["bevy"]
bevy = ["dep:bevy"]
[dependencies]
bevy = { version = "0.15", optional = true, default-features = false, features = [
bevy = { version = "0.16", optional = true, default-features = false, features = [
"bevy_asset",
"bevy_sprite",
"bevy_image",
"bevy_ui",
"bevy_ui"
] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1"
thiserror = "2"
[dev-dependencies]
bevy = { version = "0.15", default-features = false, features = [
bevy = { version = "0.16", default-features = false, features = [
"bevy_asset",
"bevy_core_pipeline",
"bevy_render",

View File

@ -112,4 +112,5 @@ fn atlas_loaded(
Bevy version | Crate version
--- | ---
0.16 | 0.2
0.15 | 0.1

View File

@ -2,7 +2,8 @@ use crate::{AtlasAsset, SerializableRect};
use bevy::asset::{AssetLoader, AsyncReadExt};
use bevy::ecs::system::SystemParam;
use bevy::image::ImageSampler;
use bevy::{prelude::*, utils::HashMap};
use bevy::prelude::*;
use bevy::platform::collections::HashMap;
use thiserror::Error;
/// Errors that can occur while accessing and creating components from [`RpackAtlasAsset`].
@ -193,13 +194,33 @@ impl From<bevy::asset::LoadDirectError> for RpackAtlasAssetError {
}
}
/// Configuration settings for the `RpackAtlasAssetLoaderSettings`.
#[derive(Debug, serde::Deserialize, serde::Serialize)]
pub struct RpackAtlasAssetLoaderSettings {
/// The [`ImageSampler`] to use during font image rendering. Determines
/// how the font's texture is sampled when scaling or transforming it.
///
/// The default is `nearest`, which scales the image without blurring,
/// preserving a crisp, pixelated appearance. This is usually ideal for
/// pixel-art.
pub image_sampler: ImageSampler,
}
impl Default for RpackAtlasAssetLoaderSettings {
fn default() -> Self {
Self {
image_sampler: ImageSampler::Descriptor(bevy::image::ImageSamplerDescriptor::nearest()),
}
}
}
/// The loader responsible for loading `RpackAtlasAsset` files from `.rpack.json` files.
#[derive(Default)]
pub struct RpackAtlasAssetLoader;
impl AssetLoader for RpackAtlasAssetLoader {
type Asset = RpackAtlasAsset;
type Settings = ();
type Settings = RpackAtlasAssetLoaderSettings;
type Error = RpackAtlasAssetError;
fn extensions(&self) -> &[&str] {
@ -209,7 +230,7 @@ impl AssetLoader for RpackAtlasAssetLoader {
async fn load(
&self,
reader: &mut dyn bevy::asset::io::Reader,
_settings: &(),
settings: &RpackAtlasAssetLoaderSettings,
load_context: &mut bevy::asset::LoadContext<'_>,
) -> Result<Self::Asset, Self::Error> {
let mut file = String::new();
@ -233,7 +254,7 @@ impl AssetLoader for RpackAtlasAssetLoader {
.ok_or(RpackAtlasAssetError::LoadingImageAsset(
"failed to load image asset, does it exist".to_string(),
))?;
image.sampler = ImageSampler::nearest();
image.sampler = settings.image_sampler.clone();
let mut layout = TextureAtlasLayout::new_empty(UVec2::new(asset.size[0], asset.size[1]));
let mut files = HashMap::new();

View File

@ -5,7 +5,7 @@ description = "CLI application for generating rpack atlases"
repository = "https://github.com/Leinnan/rpack.git"
homepage = "https://github.com/Leinnan/rpack"
license = "MIT OR Apache-2.0"
version = "0.1.1"
version = "0.2.0"
edition = "2021"
[features]
@ -15,10 +15,10 @@ basis = ["dep:basis-universal"]
dds = ["dep:image_dds"]
[dependencies]
bevy_rpack = { default-features = false, path = "../bevy_rpack", version = "0.1" }
bevy_rpack = { default-features = false, path = "../bevy_rpack", version = "0.2" }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
texture_packer = { version = "0.29", features = ["common"] }
texture_packer = { workspace = true }
image = { version = "0.25", features = ["jpeg", "png"] }
thiserror = "2"

View File

@ -19,13 +19,13 @@ eframe = { version = "0.30", default-features = false, features = [
] }
log = "0.4"
egui_json_tree = "0.10"
rpack_cli = { default-features = false, path = "../rpack_cli", version = "0.1" }
rpack_cli = { default-features = false, path = "../rpack_cli", version = "0.2" }
# You only need serde if you want app persistence:
serde = { version = "1", features = ["derive"] }
serde_json = "1"
texture_packer = { version = "0.29", features = ["common"] }
image = { version = "0.25", features = ["jpeg", "png"] }
texture_packer = { workspace = true }
image = { workspace = true }
egui_extras = { version = "0.30", features = ["all_loaders"] }
rfd = { version = "0.15", features = [] }
wasm-bindgen-futures = "0.4"