[kbd] Implement keyboard and adapter

This commit is contained in:
2024-03-05 18:37:57 +05:30
parent d1b3cff7eb
commit be03b5aff2
6 changed files with 138 additions and 12 deletions

View File

@@ -1,6 +1,8 @@
use std::sync::mpsc::SendError;
use std::sync::PoisonError;
use sdl2::IntegerOrSdlError;
use sdl2::video::WindowBuildError;
use crate::device::keyboard::KeyboardEvent;
pub type EmulatorResult<T> = Result<T, EmulatorError>;
@@ -43,3 +45,9 @@ impl<T> From<PoisonError<T>> for EmulatorError{
Self::MutexInvalidState(value.to_string())
}
}
impl From<SendError<KeyboardEvent>> for EmulatorError{
fn from(value: SendError<KeyboardEvent>) -> Self {
Self::IOError(format!("Failed to communicate keyboard stats to main thread: {}",value))
}
}