Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - docs(bones_lib): add missing Rust API documentation. #55

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/animation.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Animation utilities and systems.

#[cfg(feature = "serde")]
use serde::{Deserialize, Deserializer, Serialize, Serializer};

Expand All @@ -9,6 +11,7 @@ pub(crate) mod prelude {
pub use super::AnimatedSprite;
}

/// Install animation utilities into the given [`SystemStages`].
pub fn install(stages: &mut SystemStages) {
stages
.add_system_to_stage(CoreStage::Last, update_animation_banks)
Expand All @@ -20,11 +23,16 @@ pub fn install(stages: &mut SystemStages) {
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
#[ulid = "01GNZRPWKAHKP33V1KKRVAMVS7"]
pub struct AnimatedSprite {
/// The starting frame of the animation.
pub start: usize,
/// The ending frame of the animation.
pub end: usize,
/// The frames per second to play the animation at.
pub fps: f32,
/// The amount of time the current frame has been playing
#[cfg_attr(feature = "serde", serde(default))]
pub timer: f32,
/// Whether or not to repeat the animation
#[cfg_attr(feature = "serde", serde(default = "default_true"))]
pub repeat: bool,
}
Expand All @@ -34,6 +42,11 @@ fn default_true() -> bool {
true
}

/// Component that may be added to an [`AtlasSprite`] to control which animation, out of a set of
/// animations, is playing.
///
/// This is great for players or other sprites that will change through different, named animations
/// at different times.
#[derive(Clone, TypeUlid, Debug)]
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
#[ulid = "01GP4EM4BGJPX22HYAMGYKKSAV"]
Expand Down
5 changes: 5 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
//! Opinionated game meta-engine built on Bevy.

#![warn(missing_docs)]
// This cfg_attr is needed because `rustdoc::all` includes lints not supported on stable
#![cfg_attr(doc, allow(unknown_lints))]
#![deny(rustdoc::all)]

#[doc(inline)]
pub use {bones_asset as asset, bones_ecs as ecs, bones_input as input, bones_render as render};

Expand Down