merge commit. probably broken tbh
This commit is contained in:
@@ -17,6 +17,7 @@ static WAKER: AtomicWaker = AtomicWaker::new();
|
|||||||
|
|
||||||
pub fn add_scancode(scancode: u8) {
|
pub fn add_scancode(scancode: u8) {
|
||||||
if let Some(queue) = KBD_QUEUE.get() {
|
if let Some(queue) = KBD_QUEUE.get() {
|
||||||
|
if queue.push(scancode).is_err() {
|
||||||
if queue.push(scancode).is_err() {
|
if queue.push(scancode).is_err() {
|
||||||
println!("WARNING: scancode queue full; dropping keyboard input");
|
println!("WARNING: scancode queue full; dropping keyboard input");
|
||||||
} else {
|
} else {
|
||||||
@@ -54,6 +55,7 @@ impl Stream for ScancodeStream {
|
|||||||
return Poll::Ready(Some(scancode));
|
return Poll::Ready(Some(scancode));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WAKER.register(cx.waker());
|
||||||
WAKER.register(cx.waker());
|
WAKER.register(cx.waker());
|
||||||
|
|
||||||
queue.pop().map_or(Poll::Pending, |scancode| {
|
queue.pop().map_or(Poll::Pending, |scancode| {
|
||||||
|
|||||||
@@ -127,6 +127,12 @@ impl TaskWaker {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for Executor {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::new()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Wake for TaskWaker {
|
impl Wake for TaskWaker {
|
||||||
fn wake(self: Arc<Self>) {
|
fn wake(self: Arc<Self>) {
|
||||||
self.wake_task();
|
self.wake_task();
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ pub mod ibm_vga_8x16;
|
|||||||
pub static FONT_SPLEEN_8X16: Font = Font(include_font!(
|
pub static FONT_SPLEEN_8X16: Font = Font(include_font!(
|
||||||
"./libk/resources/font/spleen-8x16.psf"
|
"./libk/resources/font/spleen-8x16.psf"
|
||||||
));
|
));
|
||||||
|
|
||||||
pub static FONT_CP850_8X16: Font = Font(include_font!(
|
pub static FONT_CP850_8X16: Font = Font(include_font!(
|
||||||
"./libk/resources/font/cp850-8x16.psf"
|
"./libk/resources/font/cp850-8x16.psf"
|
||||||
));
|
));
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
use super::{
|
||||||
|
render::{ColouredChar, RenderError},
|
||||||
|
window::Window,
|
||||||
|
};
|
||||||
|
use alloc::vec::Vec;
|
||||||
|
|
||||||
|
pub struct Frame<'f> {
|
||||||
|
data: Vec<Vec<ColouredChar>>,
|
||||||
|
window: &'f Window,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Frame<'_> {
|
||||||
|
pub fn render(&self) -> Result<(), RenderError> {
|
||||||
|
let data: Vec<&[ColouredChar]> = self.data.iter().map(|v| v.as_slice()).collect::<Vec<_>>();
|
||||||
|
self.window
|
||||||
|
.render(data.as_slice())
|
||||||
|
.map_err(|_| RenderError::Generic)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
use core::fmt::Display;
|
||||||
|
|
||||||
|
use crate::drivers::io::framebuffer::colour::Colour;
|
||||||
|
|
||||||
|
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||||
|
pub enum RenderError {
|
||||||
|
Generic,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Display for RenderError {
|
||||||
|
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||||
|
match self {
|
||||||
|
Self::Generic => write!(f, "Generic render error"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl core::error::Error for RenderError {}
|
||||||
|
|
||||||
|
pub struct ColouredChar {
|
||||||
|
ch: u8,
|
||||||
|
colour: Colour,
|
||||||
|
}
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
use crate::{prelude::*, std::maths::geometry::Vec2};
|
use crate::{prelude::*, std::maths::geometry::Vec2};
|
||||||
|
|
||||||
|
use super::render::{ColouredChar, RenderError};
|
||||||
|
|
||||||
pub struct Window {
|
pub struct Window {
|
||||||
dimensions: Vec2<usize>,
|
dimensions: Vec2<usize>,
|
||||||
position: Vec2<usize>,
|
position: Vec2<usize>,
|
||||||
@@ -19,6 +21,10 @@ impl Window {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn render(&self, _data: &[&[ColouredChar]]) -> Result<(), RenderError> {
|
||||||
|
todo!();
|
||||||
|
}
|
||||||
|
|
||||||
pub const fn is_bordered(&self) -> bool {
|
pub const fn is_bordered(&self) -> bool {
|
||||||
self.bordered
|
self.bordered
|
||||||
}
|
}
|
||||||
@@ -78,3 +84,9 @@ impl Drop for Window {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for Window {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::new()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user