updating apps to work with new API, working on new terminal app. a lot of stuff is broken rn :/
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
use alloc::string::String;
|
||||
use core::fmt;
|
||||
use lazy_static::lazy_static;
|
||||
use spin::Mutex;
|
||||
@@ -5,6 +6,7 @@ use volatile::Volatile;
|
||||
|
||||
use alloc::vec;
|
||||
use alloc::vec::Vec;
|
||||
use crate::serial_println;
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
@@ -62,6 +64,14 @@ impl ScreenChar {
|
||||
colour: ColorCode::new(Color::White, Color::Black),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn blank() -> ScreenChar {
|
||||
ScreenChar {
|
||||
character: ' ' as u8,
|
||||
colour: ColorCode::new(Color::White, Color::Black),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn white(mut character: u8) -> ScreenChar {
|
||||
if let Some(c) = special_char(character as char) {
|
||||
character = c;
|
||||
@@ -113,15 +123,17 @@ lazy_static! {
|
||||
impl Renderer {
|
||||
// EXTERNAL API : for use by standard library and other parts of the kernel
|
||||
pub fn render_frame(&mut self, mut frame: [[ScreenChar; BUFFER_WIDTH]; BUFFER_HEIGHT]) { // renders the given frame to the app buffer
|
||||
|
||||
for (i, row) in frame.iter_mut().enumerate() {
|
||||
for (j, col) in row.iter_mut().enumerate() {
|
||||
if col.character == 0u8 { continue; }
|
||||
if let Some(c) = special_char(col.character as char) {
|
||||
col.character = c as u8;
|
||||
}
|
||||
|
||||
self.app_buffer[i][j] = *col;
|
||||
}
|
||||
}
|
||||
|
||||
self.app_buffer = frame;
|
||||
self.internal_render();
|
||||
}
|
||||
|
||||
@@ -361,4 +373,4 @@ pub fn write(args: fmt::Arguments, cols: (Color, Color)) {
|
||||
writer.write_fmt(args).unwrap();
|
||||
writer.reset_colour();
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user