improve v0.1, and add docs
This commit is contained in:
@@ -29,7 +29,7 @@ struct PrometeuApp {
|
||||
|
||||
input_signals: InputSignals,
|
||||
|
||||
frame_dt: Duration,
|
||||
frame_target_dt: Duration,
|
||||
next_frame: Instant,
|
||||
}
|
||||
|
||||
@@ -38,10 +38,12 @@ impl PrometeuApp {
|
||||
Self {
|
||||
window: None,
|
||||
pixels: None,
|
||||
input_signals: InputSignals::default(),
|
||||
|
||||
machine: Machine::new(),
|
||||
|
||||
frame_dt: Duration::from_nanos(1_000_000_000 / 60),
|
||||
input_signals: InputSignals::default(),
|
||||
|
||||
frame_target_dt: Duration::from_nanos(1_000_000_000 / 60),
|
||||
next_frame: Instant::now(),
|
||||
}
|
||||
}
|
||||
@@ -67,7 +69,7 @@ impl PrometeuApp {
|
||||
}
|
||||
}
|
||||
|
||||
impl ApplicationHandler for PrometeuApp {
|
||||
impl ApplicationHandler for PrometeuApp {
|
||||
fn resumed(&mut self, event_loop: &ActiveEventLoop) {
|
||||
let attrs = WindowAttributes::default()
|
||||
.with_title("PROMETEU - host_desktop")
|
||||
@@ -181,7 +183,7 @@ impl ApplicationHandler for PrometeuApp {
|
||||
let now = Instant::now();
|
||||
|
||||
if now >= self.next_frame {
|
||||
self.next_frame += self.frame_dt;
|
||||
self.next_frame += self.frame_target_dt;
|
||||
|
||||
// executa 1 frame do PROMETEU
|
||||
self.machine.step_frame(&self.input_signals);
|
||||
|
||||
Reference in New Issue
Block a user