2 Commits

Author SHA1 Message Date
zxq5 e303ecf5a4 fixed merge commit tomfoolery. 2025-02-24 15:14:21 +00:00
zxq5 2f08835d69 merge commit. probably broken tbh 2025-02-24 15:10:58 +00:00
6 changed files with 52 additions and 0 deletions
+1
View File
@@ -54,6 +54,7 @@ impl Stream for ScancodeStream {
return Poll::Ready(Some(scancode));
}
WAKER.register(cx.waker());
WAKER.register(cx.waker());
queue.pop().map_or(Poll::Pending, |scancode| {
+1
View File
@@ -5,6 +5,7 @@ pub mod ibm_vga_8x16;
pub static FONT_SPLEEN_8X16: Font = Font(include_font!(
"./libk/resources/font/spleen-8x16.psf"
));
pub static FONT_CP850_8X16: Font = Font(include_font!(
"./libk/resources/font/cp850-8x16.psf"
));
+2
View File
@@ -1,5 +1,7 @@
use crate::prelude::*;
mod frame;
mod render;
mod window;
pub trait Application {
+19
View File
@@ -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)
}
}
+23
View File
@@ -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,
}
+6
View File
@@ -1,5 +1,7 @@
use crate::{prelude::*, std::maths::geometry::Vec2};
use super::render::{ColouredChar, RenderError};
pub struct Window {
dimensions: 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 {
self.bordered
}