MCPcopy Create free account
hub / github.com/DeadlockCode/n-body / main

Function main

src/main.rs:21–49  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

19pub const START_SEED: u64 = 3;
20
21fn main() {
22 let config = quarkstrom::Config {
23 window_mode: quarkstrom::WindowMode::Windowed(900, 900),
24 };
25
26 let mut simulation = Simulation::new(START_SEED);
27
28 let mut loop_limiter: Option<LoopLimiter> = Some(LoopLimiter::new(1000000.0));
29 thread::spawn(move || {
30 loop {
31 simulation.update();
32 *BODIES.lock() = Some(simulation.bodies.clone());
33 TICK.fetch_add(1, Ordering::Relaxed);
34
35 if let Some(seed) = SEED.lock().take() {
36 simulation = Simulation::new(seed);
37 }
38
39 // Cap tps
40 loop_limiter.check();
41
42 while PAUSED.load(Ordering::Relaxed) {
43 thread::sleep(Duration::from_millis(16));
44 }
45 }
46 });
47
48 quarkstrom::run::<Renderer>(config);
49}

Callers

nothing calls this directly

Calls 2

checkMethod · 0.80
updateMethod · 0.45

Tested by

no test coverage detected