Fixed console frontend after host trait changes

This commit is contained in:
transistor 2023-05-07 10:29:34 -07:00
parent 527f65c69b
commit 6f871a3b0b

View File

@ -1,26 +1,26 @@
use moa_core::Error;
use moa_core::host::{Host, Tty, WindowUpdater, ControllerDevice, ControllerUpdater, Audio, DummyAudio};
use moa_core::host::{Host, Tty, ControllerEvent, Audio, DummyAudio, FrameReceiver, EventSender};
pub struct ConsoleFrontend;
impl Host for ConsoleFrontend {
fn create_pty(&self) -> Result<Box<dyn Tty>, Error> {
fn add_pty(&self) -> Result<Box<dyn Tty>, Error> {
use moa_common::tty::SimplePty;
Ok(Box::new(SimplePty::open()?))
}
fn add_window(&mut self, _updater: Box<dyn WindowUpdater>) -> Result<(), Error> {
fn add_video_source(&mut self, _receiver: FrameReceiver) -> Result<(), Error> {
println!("console: add_window() is not supported from the console; ignoring request...");
Ok(())
}
fn register_controller(&mut self, _device: ControllerDevice, _input: Box<dyn ControllerUpdater>) -> Result<(), Error> {
fn register_controllers(&mut self, _sender: EventSender<ControllerEvent>) -> Result<(), Error> {
println!("console: register_controller() is not supported from the console; ignoring request...");
Ok(())
}
fn create_audio_source(&mut self) -> Result<Box<dyn Audio>, Error> {
fn add_audio_source(&mut self) -> Result<Box<dyn Audio>, Error> {
println!("console: create_audio_source() is not supported from the console; returning dummy device...");
Ok(Box::new(DummyAudio()))
}