clean up
This commit is contained in:
parent
bcc5930f65
commit
3fd2574be7
@ -10,7 +10,8 @@ pub struct LogicalHardware {
|
|||||||
pub audio: Audio,
|
pub audio: Audio,
|
||||||
pub pad: Pad,
|
pub pad: Pad,
|
||||||
pub touch: Touch,
|
pub touch: Touch,
|
||||||
pub frame_index: u64,
|
pub tick_index: u64,
|
||||||
|
pub logical_frame_index: u64,
|
||||||
pub last_frame_cpu_time_us: u64,
|
pub last_frame_cpu_time_us: u64,
|
||||||
pub vm: VirtualMachine,
|
pub vm: VirtualMachine,
|
||||||
pub cartridge: Option<Cartridge>,
|
pub cartridge: Option<Cartridge>,
|
||||||
@ -35,7 +36,8 @@ impl LogicalHardware {
|
|||||||
audio: Audio::new(),
|
audio: Audio::new(),
|
||||||
pad: Pad::default(),
|
pad: Pad::default(),
|
||||||
touch: Touch::default(),
|
touch: Touch::default(),
|
||||||
frame_index: 0,
|
tick_index: 0,
|
||||||
|
logical_frame_index: 0,
|
||||||
last_frame_cpu_time_us: 0,
|
last_frame_cpu_time_us: 0,
|
||||||
vm: VirtualMachine::default(),
|
vm: VirtualMachine::default(),
|
||||||
cartridge: None,
|
cartridge: None,
|
||||||
@ -116,6 +118,7 @@ impl LogicalHardware {
|
|||||||
/// O Host controla tempo/event loop; o Core define a sequência do frame.
|
/// O Host controla tempo/event loop; o Core define a sequência do frame.
|
||||||
pub fn step_frame(&mut self, signals: &InputSignals) {
|
pub fn step_frame(&mut self, signals: &InputSignals) {
|
||||||
let start = std::time::Instant::now();
|
let start = std::time::Instant::now();
|
||||||
|
self.tick_index += 1; // não importa o frame lógico, o tick sempre incrementa
|
||||||
|
|
||||||
// Se um frame logica estiver aberto evita limpar o input
|
// Se um frame logica estiver aberto evita limpar o input
|
||||||
if !self.logical_frame_open {
|
if !self.logical_frame_open {
|
||||||
@ -134,7 +137,7 @@ impl LogicalHardware {
|
|||||||
if run.reason == crate::vm::LogicalFrameEndingReason::FrameSync {
|
if run.reason == crate::vm::LogicalFrameEndingReason::FrameSync {
|
||||||
self.gfx.render_all();
|
self.gfx.render_all();
|
||||||
self.end_frame();
|
self.end_frame();
|
||||||
self.frame_index += 1; // conta frames lógicos apresentados
|
self.logical_frame_index += 1; // conta frames lógicos apresentados
|
||||||
self.logical_frame_open = false;
|
self.logical_frame_open = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -147,7 +147,9 @@ impl PrometeuApp {
|
|||||||
impl ApplicationHandler for PrometeuApp {
|
impl ApplicationHandler for PrometeuApp {
|
||||||
fn resumed(&mut self, event_loop: &ActiveEventLoop) {
|
fn resumed(&mut self, event_loop: &ActiveEventLoop) {
|
||||||
let attrs = WindowAttributes::default()
|
let attrs = WindowAttributes::default()
|
||||||
.with_title(format!("PROMETEU | GFX: {:.1} KB | FPS: {:.1} | Load: {}% | Frame: {}", 0.0, 0.0, 0.0, 0))
|
.with_title(format!(
|
||||||
|
"PROMETEU | GFX: {:.1} KB | FPS: {:.1} | Load: {:.1}% (C) + {:.1}% (A) | Frame: tick {} logical {}",
|
||||||
|
0.0, 0.0, 0.0, 0, 0, 0))
|
||||||
.with_inner_size(LogicalSize::new(960.0, 540.0))
|
.with_inner_size(LogicalSize::new(960.0, 540.0))
|
||||||
.with_min_inner_size(LogicalSize::new(320.0, 180.0));
|
.with_min_inner_size(LogicalSize::new(320.0, 180.0));
|
||||||
|
|
||||||
@ -308,8 +310,8 @@ impl ApplicationHandler for PrometeuApp {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let title = format!(
|
let title = format!(
|
||||||
"PROMETEU | GFX: {:.1} KB | FPS: {:.1} | Load: {:.1}% (C) + {:.1}% (A) | Frame: {}",
|
"PROMETEU | GFX: {:.1} KB | FPS: {:.1} | Load: {:.1}% (C) + {:.1}% (A) | Frame: tick {} logical {}",
|
||||||
kb, fps, cpu_load_core, cpu_load_audio, self.logical_hardware.frame_index
|
kb, fps, cpu_load_core, cpu_load_audio, self.logical_hardware.tick_index, self.logical_hardware.logical_frame_index
|
||||||
);
|
);
|
||||||
window.set_title(&title);
|
window.set_title(&title);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user