mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'fix-duration-rust-nightly' into 'master'
fix duration rust nightly See merge request veloren/fresh!13 Former-commit-id: 5a289fa8e867c2d6d4dd0338e9023f666a3efc2f
This commit is contained in:
commit
257042ec6f
12
README.md
12
README.md
@ -1,3 +1,13 @@
|
||||
# Fresh
|
||||
|
||||
An experiment
|
||||
An experiment
|
||||
|
||||
## Compile
|
||||
|
||||
```
|
||||
git clone https://gitlab.com/veloren/fresh.git
|
||||
cd fresh
|
||||
git submodule update --init --recursive
|
||||
rustup default nightly
|
||||
cargo build
|
||||
```
|
||||
|
@ -25,7 +25,7 @@ impl Clock {
|
||||
|
||||
pub fn get_last_delta(&self) -> Duration { self.last_delta.unwrap_or(Duration::new(0, 0)) }
|
||||
|
||||
pub fn get_avg_delta(&self) -> Duration { Duration::from_float_secs(self.running_tps_average) }
|
||||
pub fn get_avg_delta(&self) -> Duration { Duration::from_secs_f64(self.running_tps_average) }
|
||||
|
||||
pub fn tick(&mut self, tgt: Duration) {
|
||||
let delta = SystemTime::now()
|
||||
@ -45,6 +45,6 @@ impl Clock {
|
||||
self.last_delta = Some(delta);
|
||||
self.running_tps_average =
|
||||
CLOCK_SMOOTHING * self.running_tps_average +
|
||||
(1.0 - CLOCK_SMOOTHING) * delta.as_float_secs();
|
||||
(1.0 - CLOCK_SMOOTHING) * delta.as_secs_f64();
|
||||
}
|
||||
}
|
||||
|
@ -168,11 +168,11 @@ impl State {
|
||||
/// Execute a single tick, simulating the game state by the given duration.
|
||||
pub fn tick(&mut self, dt: Duration) {
|
||||
// Change the time accordingly
|
||||
self.ecs_world.write_resource::<TimeOfDay>().0 += dt.as_float_secs() * DAY_CYCLE_FACTOR;
|
||||
self.ecs_world.write_resource::<Time>().0 += dt.as_float_secs();
|
||||
self.ecs_world.write_resource::<TimeOfDay>().0 += dt.as_secs_f64() * DAY_CYCLE_FACTOR;
|
||||
self.ecs_world.write_resource::<Time>().0 += dt.as_secs_f64();
|
||||
|
||||
// Run systems to update the world
|
||||
self.ecs_world.write_resource::<DeltaTime>().0 = dt.as_float_secs();
|
||||
self.ecs_world.write_resource::<DeltaTime>().0 = dt.as_secs_f64();
|
||||
|
||||
// Create and run dispatcher for ecs systems
|
||||
let mut dispatch_builder = DispatcherBuilder::new();
|
||||
|
Loading…
Reference in New Issue
Block a user