From 1a92ec2638b433f95a94d68adbd2df459bc54562 Mon Sep 17 00:00:00 2001 From: Marcus Buffett Date: Thu, 12 Nov 2020 18:03:03 -0800 Subject: [PATCH] Make Timer.tick return &Self (#820) Make Timer::tick return &Self --- crates/bevy_core/src/time/timer.rs | 3 ++- .../src/print_diagnostics_plugin.rs | 6 ++---- examples/app/plugin.rs | 3 +-- examples/ecs/event.rs | 3 +-- examples/ui/font_atlas_debug.rs | 14 ++++++++------ 5 files changed, 14 insertions(+), 15 deletions(-) diff --git a/crates/bevy_core/src/time/timer.rs b/crates/bevy_core/src/time/timer.rs index 4a9df0da96662..8671ab53b81d2 100644 --- a/crates/bevy_core/src/time/timer.rs +++ b/crates/bevy_core/src/time/timer.rs @@ -35,7 +35,7 @@ impl Timer { } /// Advances the timer by `delta` seconds. - pub fn tick(&mut self, delta: f32) { + pub fn tick(&mut self, delta: f32) -> &Self { let prev_finished = self.elapsed >= self.duration; if !prev_finished { self.elapsed += delta; @@ -47,6 +47,7 @@ impl Timer { if self.repeating && self.finished { self.elapsed %= self.duration; } + self } pub fn reset(&mut self) { diff --git a/crates/bevy_diagnostic/src/print_diagnostics_plugin.rs b/crates/bevy_diagnostic/src/print_diagnostics_plugin.rs index 62bd855a95caa..cefc750bf68f3 100644 --- a/crates/bevy_diagnostic/src/print_diagnostics_plugin.rs +++ b/crates/bevy_diagnostic/src/print_diagnostics_plugin.rs @@ -69,8 +69,7 @@ impl PrintDiagnosticsPlugin { time: Res