Skip to content

Commit 9f1d961

Browse files
committed
aligning public apis of Time,Timer and Stopwatch
1 parent 7495d68 commit 9f1d961

File tree

118 files changed

+380
-370
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+380
-370
lines changed

crates/bevy_animation/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1005,7 +1005,7 @@ pub fn advance_animations(
10051005
animation_graphs: Res<Assets<AnimationGraph>>,
10061006
mut players: Query<(&mut AnimationPlayer, &AnimationGraphHandle)>,
10071007
) {
1008-
let delta_seconds = time.delta_seconds();
1008+
let delta_seconds = time.delta_secs();
10091009
players
10101010
.par_iter_mut()
10111011
.for_each(|(mut player, graph_handle)| {

crates/bevy_animation/src/transition.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ pub fn advance_transitions(
122122
for transition in &mut animation_transitions.transitions.iter_mut().rev() {
123123
// Decrease weight.
124124
transition.current_weight = (transition.current_weight
125-
- transition.weight_decline_per_sec * time.delta_seconds())
125+
- transition.weight_decline_per_sec * time.delta_secs())
126126
.max(0.0);
127127

128128
// Update weight.

crates/bevy_diagnostic/src/frame_time_diagnostics_plugin.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ impl FrameTimeDiagnosticsPlugin {
3333
) {
3434
diagnostics.add_measurement(&Self::FRAME_COUNT, || frame_count.0 as f64);
3535

36-
let delta_seconds = time.delta_seconds_f64();
36+
let delta_seconds = time.delta_secs_f64();
3737
if delta_seconds == 0.0 {
3838
return;
3939
}

crates/bevy_render/src/globals.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ fn prepare_globals_buffer(
7474
frame_count: Res<FrameCount>,
7575
) {
7676
let buffer = globals_buffer.buffer.get_mut();
77-
buffer.time = time.elapsed_seconds_wrapped();
78-
buffer.delta_time = time.delta_seconds();
77+
buffer.time = time.elapsed_secs_wrapped();
78+
buffer.delta_time = time.delta_secs();
7979
buffer.frame_count = frame_count.0;
8080

8181
globals_buffer

crates/bevy_time/src/stopwatch.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ use bevy_utils::Duration;
2121
/// assert_eq!(stopwatch.elapsed_secs(), 1.0);
2222
///
2323
/// stopwatch.reset(); // reset the stopwatch
24-
/// assert!(stopwatch.paused());
24+
/// assert!(stopwatch.is_paused());
2525
/// assert_eq!(stopwatch.elapsed_secs(), 0.0);
2626
/// ```
2727
#[derive(Clone, Debug, Default, PartialEq, Eq)]
2828
#[cfg_attr(feature = "serialize", derive(serde::Deserialize, serde::Serialize))]
2929
#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Default))]
3030
pub struct Stopwatch {
3131
elapsed: Duration,
32-
paused: bool,
32+
is_paused: bool,
3333
}
3434

3535
impl Stopwatch {
@@ -40,7 +40,7 @@ impl Stopwatch {
4040
/// # use bevy_time::*;
4141
/// let stopwatch = Stopwatch::new();
4242
/// assert_eq!(stopwatch.elapsed_secs(), 0.0);
43-
/// assert_eq!(stopwatch.paused(), false);
43+
/// assert_eq!(stopwatch.is_paused(), false);
4444
/// ```
4545
pub fn new() -> Self {
4646
Default::default()
@@ -128,7 +128,7 @@ impl Stopwatch {
128128
/// assert_eq!(stopwatch.elapsed_secs(), 1.5);
129129
/// ```
130130
pub fn tick(&mut self, delta: Duration) -> &Self {
131-
if !self.paused() {
131+
if !self.is_paused() {
132132
self.elapsed = self.elapsed.saturating_add(delta);
133133
}
134134
self
@@ -144,12 +144,12 @@ impl Stopwatch {
144144
/// let mut stopwatch = Stopwatch::new();
145145
/// stopwatch.pause();
146146
/// stopwatch.tick(Duration::from_secs_f32(1.5));
147-
/// assert!(stopwatch.paused());
147+
/// assert!(stopwatch.is_paused());
148148
/// assert_eq!(stopwatch.elapsed_secs(), 0.0);
149149
/// ```
150150
#[inline]
151151
pub fn pause(&mut self) {
152-
self.paused = true;
152+
self.is_paused = true;
153153
}
154154

155155
/// Unpauses the stopwatch. Resume the effect of ticking on elapsed time.
@@ -163,12 +163,12 @@ impl Stopwatch {
163163
/// stopwatch.tick(Duration::from_secs_f32(1.0));
164164
/// stopwatch.unpause();
165165
/// stopwatch.tick(Duration::from_secs_f32(1.0));
166-
/// assert!(!stopwatch.paused());
166+
/// assert!(!stopwatch.is_paused());
167167
/// assert_eq!(stopwatch.elapsed_secs(), 1.0);
168168
/// ```
169169
#[inline]
170170
pub fn unpause(&mut self) {
171-
self.paused = false;
171+
self.is_paused = false;
172172
}
173173

174174
/// Returns `true` if the stopwatch is paused.
@@ -177,15 +177,15 @@ impl Stopwatch {
177177
/// ```
178178
/// # use bevy_time::*;
179179
/// let mut stopwatch = Stopwatch::new();
180-
/// assert!(!stopwatch.paused());
180+
/// assert!(!stopwatch.is_paused());
181181
/// stopwatch.pause();
182-
/// assert!(stopwatch.paused());
182+
/// assert!(stopwatch.is_paused());
183183
/// stopwatch.unpause();
184-
/// assert!(!stopwatch.paused());
184+
/// assert!(!stopwatch.is_paused());
185185
/// ```
186186
#[inline]
187-
pub fn paused(&self) -> bool {
188-
self.paused
187+
pub fn is_paused(&self) -> bool {
188+
self.is_paused
189189
}
190190

191191
/// Resets the stopwatch. The reset doesn't affect the paused state of the stopwatch.

0 commit comments

Comments
 (0)