-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Open
Labels
A-TimeInvolves time keeping and reportingInvolves time keeping and reportingC-UsabilityA targeted quality-of-life change that makes Bevy easier to useA targeted quality-of-life change that makes Bevy easier to useD-StraightforwardSimple bug fixes and API improvements, docs, test and examplesSimple bug fixes and API improvements, docs, test and examplesS-Needs-DesignThis issue requires design work to think about how it would best be accomplishedThis issue requires design work to think about how it would best be accomplishedX-UncontroversialThis work is generally agreed uponThis work is generally agreed upon
Description
What problem does this solve or what need does it fill?
I want to have an easy way to create a repeated Timer that fires immediately in the next tick, and then fires periodically.
So rather than
<---wait 10s--->FIRE<---wait 10s--->FIRE
I want
FIRE<---wait 10s--->FIRE<---wait 10s--->FIRE
What solution would you like?
An ergonomic API like:
let timer = Timer::from_seconds(10.0, TimerMode::Repeating).with_finish_immediately();The actual function name can be discussed.
What alternative(s) have you considered?
Now I use this, which takes 3 lines rather than 1:
let timer = {
let mut timer = Timer::from_seconds(10.0, TimerMode::Repeating);
timer.tick(Duration::from_secs_f32(10.0 - EPSILON));
timer
};BTW, I've also tried this which doesn't work:
let timer = {
let mut timer = Timer::from_seconds(10.0, TimerMode::Repeating);
timer.finish();
timer
};Metadata
Metadata
Assignees
Labels
A-TimeInvolves time keeping and reportingInvolves time keeping and reportingC-UsabilityA targeted quality-of-life change that makes Bevy easier to useA targeted quality-of-life change that makes Bevy easier to useD-StraightforwardSimple bug fixes and API improvements, docs, test and examplesSimple bug fixes and API improvements, docs, test and examplesS-Needs-DesignThis issue requires design work to think about how it would best be accomplishedThis issue requires design work to think about how it would best be accomplishedX-UncontroversialThis work is generally agreed uponThis work is generally agreed upon