implements PLN-0048 minimal system hub pipeline
This commit is contained in:
@@ -1,15 +1,21 @@
|
||||
use crate::VirtualMachineRuntime;
|
||||
use crate::programs::prometeu_hub::window_manager::WindowManager;
|
||||
use prometeu_hal::HardwareBridge;
|
||||
use crate::{CrashReport, VirtualMachineRuntime};
|
||||
use prometeu_hal::color::Color;
|
||||
use prometeu_hal::log::{LogLevel, LogSource};
|
||||
use prometeu_hal::window::Rect;
|
||||
use prometeu_hal::{HardwareBridge, InputSignals};
|
||||
use prometeu_vm::VirtualMachine;
|
||||
|
||||
/// PrometeuHub: Launcher and system UI environment.
|
||||
pub struct PrometeuHub {
|
||||
pub window_manager: WindowManager,
|
||||
}
|
||||
|
||||
pub struct SystemProfileUpdate {
|
||||
pub crash: Option<CrashReport>,
|
||||
pub focused_window_active: bool,
|
||||
}
|
||||
|
||||
impl Default for PrometeuHub {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
@@ -75,4 +81,29 @@ impl PrometeuHub {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn update_system_profile(
|
||||
&mut self,
|
||||
os: &mut VirtualMachineRuntime,
|
||||
vm: &mut VirtualMachine,
|
||||
signals: &InputSignals,
|
||||
hw: &mut dyn HardwareBridge,
|
||||
) -> SystemProfileUpdate {
|
||||
let mut crash = None;
|
||||
|
||||
self.gui_update(os, hw);
|
||||
|
||||
if let Some(focused_id) = self.window_manager.focused {
|
||||
if hw.pad().start().down {
|
||||
self.window_manager.remove_window(focused_id);
|
||||
} else {
|
||||
crash = os.tick(vm, signals, hw);
|
||||
}
|
||||
}
|
||||
|
||||
self.render(os, hw);
|
||||
hw.gfx_mut().present();
|
||||
|
||||
SystemProfileUpdate { crash, focused_window_active: self.window_manager.focused.is_some() }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user