-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Allow timers to be paused #914
Conversation
I dig it. I generally like having "one way" to do things where possible. If we're going to expose the I think encapsulation is good in this case, so can we make pause private and add resume? Haha and then while you're at it, can you fix my "visibility mistakes" by encapsulating everything else? Ex: elapsed / finished / just_finished have no right being publicly editable. And at that point we might as well encapsulate everything for consistency. |
Got it, sounds like a good idea |
I do want feedback on the function names, and this is a breaking change that would break a lot of code so that sucks :(. At least we're getting it out of the way now :) Sorry that this PR's comment history and stuff is all messed up, I had to rewrite git history after realizing I messed up :( |
could you add setters for the fields case could be also made for field |
Seems reasonable, I'll add them in. Thank you! |
I merged my code with the timer changes on master, I haven't written an example yet because I just want the final sign-off on the changes before I write an example :D |
hey there
maybe its a good idea to harmonize the types as well
here we can see that we use f32 for the vec3
https://docs.rs/bevy/0.3.0/bevy/math/f32/struct.Vec3.html
and here we use f64 for the seconds_since_startup
https://docs.rs/bevy/0.3.0/bevy/prelude/struct.Time.html
so when doing calculation with transformation vec3 and seconds_since_startup i always
need to cast
hey it's nitpicking i know :) but if casting is bad performance wise (doing
it in a system every frame) it maybe would make sense to change ```seconds_since_startup``` type also to f32?
|
Floating point operations appear to be accelerated by the CPU so I doubt its horrible performance wise. Probably still worth looking into. |
I'm pretty sure I chose f64 for seconds_since_startup because f32 will start losing valuable precision if your app runs for days. Thats a bit of an exception to the rule. In general we should be using f32 |
I'm going to merge this now. Feel free to follow up with an example if you want 😄 |
@amberkowalski @cart Wait! Is this really done? Shouldn't pausing the timer...actually pause the timer? |
I'm going to open up a PR. There were a couple other inconsistencies I noticed as well. BTW, thanks for doing this, @amberkowalski -- when I initially opened up my other Timer PR I had no idea this was ongoing, or I would have brought up that issue here. |
Haha oops. Sounds like I shotgunned this one in too early. |
Should be fixed in #931 |
This allows timers to be paused.
(Note: the git history for this is horrible but its getting squashed so that's okay :) )