Game stats that reset every frame, inspired by immediate mode GUI.
gamedev bevy stats
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Minor documentation improvements.

+11 -12
+1 -2
README.md
··· 1 1 # Immediate Stats 2 2 3 3 Game stats that reset every frame. Inspired by immediate mode rendering. 4 - 5 - == Todo Info about derive macro. 4 + Includes a derive macro which propagates stat resets to any stat fields. 6 5 7 6 ```rust 8 7 #[derive(StatContainer)]
+1 -1
immediate_stats/Cargo.toml
··· 2 2 name = "immediate_stats" 3 3 version = "0.1.0" 4 4 edition = "2024" 5 - description = "A crate for making immediate-mode stats." 5 + description = "Game stats that reset every frame. Inspired by immediate mode rendering." 6 6 categories = ["game-development", "data-structures"] 7 7 keywords = ["game", "gamedev", "bevy", "stats", "proc-macro"] 8 8 repository = "https://github.com/AlephCubed/immediate_stats"
+1 -2
immediate_stats/README.md
··· 1 1 # Immediate Stats 2 2 3 3 Game stats that reset every frame. Inspired by immediate mode rendering. 4 - 5 - == Todo Info about derive macro. 4 + Includes a derive macro which propagates stat resets to any stat fields. 6 5 7 6 ```rust 8 7 #[derive(StatContainer)]
+7 -6
immediate_stats/src/lib.rs
··· 1 1 //! Game stats that reset every frame. 2 2 //! Inspired by immediate mode rendering. 3 3 //! 4 - //! == Todo Info about derive macro. 4 + //! Includes a [derive macro](macro@StatContainer) which propagates stat resets to any stat fields. 5 + //! 5 6 //! ```rust no_run 6 7 //! # use immediate_stats::*; 7 8 //! #[derive(StatContainer)] ··· 16 17 //! // The order does not matter. Bonuses are always applied before multipliers. 17 18 //! assert_eq!(speed.0.total(), 30); // (10 + 5) * 2 = 30 18 19 //! 19 - //! speed.reset_modifiers(); // Reset bonus and multiplier, so speed is back to 10. 20 + //! speed.reset_modifiers(); // Reset speed back to 10. 20 21 //! } 21 22 //! } 22 23 //! ``` ··· 25 26 //! 26 27 //! There is build-in integration with the [Bevy Engine](https://bevyengine.org) 27 28 //! via the `bevy` feature flag. 28 - //! This adds systems for resetting `StatContainer` components and resources. 29 + //! This adds systems for resetting [`StatContainer`] components and resources. 29 30 //! 30 31 #![cfg_attr(not(feature = "bevy"), doc = "```rust ignore")] 31 32 #![cfg_attr(feature = "bevy", doc = "```rust")] ··· 77 78 pub mod stat; 78 79 79 80 /// Implements [`reset_modifiers`](StatContainer::reset_modifiers) 80 - /// by passing on the call to any sub-stats. 81 + /// by propagating the call down to any `StatContainer` fields. 81 82 /// ```rust 82 83 /// # use immediate_stats::*; 83 84 /// #[derive(StatContainer, Default, Debug, PartialEq)] ··· 110 111 /// #[derive(StatContainer)] 111 112 /// struct PartialReset { 112 113 /// #[stat] 113 - /// custom: Health, 114 + /// custom: Health, // Will get reset. 114 115 /// #[stat_ignore] 115 - /// ignored: Stat, 116 + /// ignored: Stat, // Will not get reset. 116 117 /// } 117 118 /// 118 119 /// fn main () {
+1 -1
immediate_stats_macros/Cargo.toml
··· 2 2 name = "immediate_stats_macros" 3 3 version = "0.1.0" 4 4 edition = "2024" 5 - description = "A crate for making immediate-mode stats." 5 + description = "Game stats that reset every frame. Inspired by immediate mode rendering." 6 6 categories = ["game-development", "data-structures"] 7 7 keywords = ["game", "gamedev", "bevy", "stats", "proc-macro"] 8 8 repository = "https://github.com/AlephCubed/immediate_stats"