Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e303ecf5a4 | |||
| 2f08835d69 |
@@ -54,6 +54,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| {
|
||||||
|
|||||||
@@ -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"
|
||||||
));
|
));
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
use crate::prelude::*;
|
use crate::prelude::*;
|
||||||
|
|
||||||
|
mod frame;
|
||||||
|
mod render;
|
||||||
mod window;
|
mod window;
|
||||||
|
|
||||||
pub trait Application {
|
pub trait Application {
|
||||||
|
|||||||
@@ -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
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user