added sprite and draw

This commit is contained in:
2026-03-24 13:40:09 +00:00
parent 13169698cf
commit c718d36fe2
5 changed files with 154 additions and 30 deletions
+16 -2
View File
@@ -69,10 +69,10 @@ 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")
.with_title(format!("PROMETEU - host_desktop | GFX Mem: {:.2} KB | Frame: {}", 0.0, 0))
.with_inner_size(LogicalSize::new(960.0, 540.0))
.with_min_inner_size(LogicalSize::new(320.0, 180.0));
@@ -188,6 +188,20 @@ impl ApplicationHandler for PrometeuApp {
// executa 1 frame do PROMETEU
self.machine.step_frame(&self.input_signals);
// temp: atualiza o título da janela a cada 1 segundo (60 frames)
if self.machine.frame_index % 60 == 0 {
if let Some(window) = self.window {
let usage_bytes = self.machine.gfx.memory_usage_bytes();
let kb = usage_bytes as f64 / 1024.0;
let title = format!(
"PROMETEU - host_desktop | GFX Mem: {:.2} KB | Frame: {}",
kb,
self.machine.frame_index);
window.set_title(&title);
}
}
// pede redraw
self.request_redraw();
} else {