-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Workspace refactor and tutorials
- Loading branch information
1 parent
965313b
commit c0fadc2
Showing
21 changed files
with
739 additions
and
426 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,67 @@ | ||
[package] | ||
name = "bevy_rand" | ||
version = "0.4.0" | ||
edition = "2021" | ||
[workspace] | ||
members = ["bevy_prng"] | ||
resolver = "2" | ||
|
||
[workspace.package] | ||
authors = ["Gonçalo Rica Pais da Silva <[email protected]>"] | ||
description = "A plugin to integrate rand for ECS optimised RNG for the Bevy game engine." | ||
edition = "2021" | ||
repository = "https://github.com/Bluefinger/bevy_rand" | ||
license = "MIT OR Apache-2.0" | ||
version = "0.5.0" | ||
rust-version = "1.76.0" | ||
|
||
[workspace.dependencies] | ||
bevy = { version = "0.13", default-features = false } | ||
serde = "1" | ||
serde_derive = "1" | ||
rand_core = { version = "0.6", features = ["std"] } | ||
rand_chacha = "0.3" | ||
wyrand = "0.1" | ||
rand_pcg = "0.3" | ||
rand_xoshiro = "0.6" | ||
|
||
[package] | ||
name = "bevy_rand" | ||
version = { workspace = true } | ||
edition = { workspace = true } | ||
authors = { workspace = true } | ||
description = "A plugin to integrate rand for ECS optimised RNG for the Bevy game engine." | ||
repository = { workspace = true } | ||
license = { workspace = true } | ||
keywords = ["game", "bevy", "rand", "rng"] | ||
categories = ["game-engines", "algorithms"] | ||
exclude = ["/.*"] | ||
resolver = "2" | ||
rust-version = "1.70.0" | ||
rust-version = { workspace = true } | ||
|
||
[features] | ||
default = ["serialize", "thread_local_entropy"] | ||
thread_local_entropy = ["dep:rand_chacha"] | ||
serialize = ["dep:serde", "rand_core/serde1"] | ||
serialize = ["dep:serde", "dep:serde_derive", "rand_core/serde1"] | ||
rand_chacha = ["bevy_prng/rand_chacha"] | ||
rand_pcg = ["bevy_prng/rand_pcg"] | ||
rand_xoshiro = ["bevy_prng/rand_xoshiro"] | ||
wyrand = ["bevy_prng/wyrand"] | ||
|
||
[workspace] | ||
members = ["bevy_prng"] | ||
|
||
[dependencies] | ||
# bevy | ||
bevy = { version = "0.12.0", default-features = false } | ||
bevy_prng = { path = "bevy_prng", version = "0.2" } | ||
bevy.workspace = true | ||
bevy_prng = { path = "bevy_prng", version = "0.5" } | ||
|
||
# others | ||
serde = { version = "1.0", features = ["derive"], optional = true } | ||
rand_core = { version = "0.6", features = ["std"] } | ||
rand_chacha = { version = "0.3", optional = true } | ||
rand_core.workspace = true | ||
rand_chacha = { workspace = true, optional = true } | ||
serde = { workspace = true, optional = true } | ||
serde_derive = { workspace = true, optional = true } | ||
|
||
# This cfg cannot be enabled, but it forces Cargo to keep bevy_prng's | ||
# version in lockstep with bevy_rand, so that even minor versions | ||
# cannot be out of step with bevy_rand due to dependencies on traits | ||
# and implementations between the two crates. | ||
[target.'cfg(any())'.dependencies] | ||
bevy_prng = { path = "bevy_prng", version = "=0.2" } | ||
bevy_prng = { path = "bevy_prng", version = "=0.5" } | ||
|
||
[dev-dependencies] | ||
bevy_prng = { path = "bevy_prng", version = "0.2", features = ["rand_chacha", "wyrand"] } | ||
bevy_prng = { path = "bevy_prng", version = "0.5", features = ["rand_chacha", "wyrand"] } | ||
rand = "0.8" | ||
ron = { version = "0.8.0", features = ["integer128"] } | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
[package] | ||
name = "bevy_prng" | ||
version = "0.2.0" | ||
edition = "2021" | ||
authors = ["Gonçalo Rica Pais da Silva <[email protected]>"] | ||
version = { workspace = true } | ||
edition = { workspace = true } | ||
authors = { workspace = true } | ||
description = "A crate providing newtyped RNGs for integration into Bevy." | ||
repository = "https://github.com/Bluefinger/bevy_rand" | ||
license = "MIT OR Apache-2.0" | ||
repository = { workspace = true } | ||
license = { workspace = true } | ||
keywords = ["game", "bevy", "rand", "rng"] | ||
categories = ["game-engines", "algorithms"] | ||
exclude = ["/.*"] | ||
resolver = "2" | ||
rust-version = "1.70.0" | ||
rust-version = { workspace = true } | ||
|
||
[features] | ||
default = ["serialize"] | ||
serialize = [ | ||
"dep:serde", | ||
"dep:serde_derive", | ||
"rand_core/serde1", | ||
"rand_chacha?/serde1", | ||
"rand_pcg?/serde1", | ||
|
@@ -24,13 +24,14 @@ serialize = [ | |
] | ||
|
||
[dependencies] | ||
bevy = { version = "0.12.0", default-features = false } | ||
rand_core = { version = "0.6", features = ["std"] } | ||
serde = { version = "1.0", features = ["derive"], optional = true } | ||
rand_chacha = { version = "0.3", optional = true } | ||
wyrand = { version = "0.1", optional = true } | ||
rand_pcg = { version = "0.3", optional = true } | ||
rand_xoshiro = { version = "0.6", optional = true } | ||
bevy.workspace = true | ||
rand_core.workspace = true | ||
serde = { workspace = true, optional = true } | ||
serde_derive = { workspace = true, optional = true } | ||
rand_chacha = { workspace = true, optional = true } | ||
wyrand = { workspace = true, optional = true } | ||
rand_pcg = { workspace = true, optional = true } | ||
rand_xoshiro = { workspace = true, optional = true } | ||
|
||
[package.metadata.docs.rs] | ||
all-features = true | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
use crate::{newtype::newtype_prng, SeedableEntropySource}; | ||
|
||
use bevy::prelude::{Reflect, ReflectFromReflect}; | ||
use rand_core::{RngCore, SeedableRng}; | ||
|
||
#[cfg(feature = "serialize")] | ||
use bevy::prelude::{ReflectDeserialize, ReflectSerialize}; | ||
|
||
newtype_prng!( | ||
ChaCha8Rng, | ||
::rand_chacha::ChaCha8Rng, | ||
[u8; 32], | ||
"A newtyped [`rand_chacha::ChaCha8Rng`] RNG", | ||
"rand_chacha" | ||
); | ||
|
||
newtype_prng!( | ||
ChaCha12Rng, | ||
::rand_chacha::ChaCha12Rng, | ||
[u8; 32], | ||
"A newtyped [`rand_chacha::ChaCha12Rng`] RNG", | ||
"rand_chacha" | ||
); | ||
|
||
newtype_prng!( | ||
ChaCha20Rng, | ||
::rand_chacha::ChaCha20Rng, | ||
[u8; 32], | ||
"A newtyped [`rand_chacha::ChaCha20Rng`] RNG", | ||
"rand_chacha" | ||
); |
Oops, something went wrong.