This commit is contained in:
parent
311755c812
commit
5c3d4ac7a9
30 changed files with 177 additions and 108 deletions
|
|
@ -16,15 +16,16 @@ impl Framebuffer {
|
|||
})
|
||||
}
|
||||
|
||||
fn draw_pixel(&self, row: u32, col: u32, pixel: u32) {
|
||||
fn draw_pixel(&mut self, row: u32, col: u32, pixel: u32) {
|
||||
let index = row * (self.fb_info.pitch as u32 / 4) + col;
|
||||
self.memory_region.mut_slice()[index as usize] = pixel;
|
||||
}
|
||||
|
||||
pub fn draw_glyph(&self, glyph: &[u8], row: u32, col: u32) {
|
||||
pub fn draw_glyph(&mut self, glyph: &[u8], row: u32, col: u32) {
|
||||
let gl_width = 8;
|
||||
let gl_height = 16;
|
||||
|
||||
#[allow(clippy::needless_range_loop)]
|
||||
for r in 0..gl_height {
|
||||
for c in 0..gl_width {
|
||||
if ((glyph[r] >> c) % 2) == 1 {
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ pub struct Psf {
|
|||
|
||||
impl Psf {
|
||||
pub fn new(path: &str) -> Result<Self, ZError> {
|
||||
let file = File::open(&path)?;
|
||||
let file = File::open(path)?;
|
||||
|
||||
let header = file.slice()[0..core::mem::size_of::<PsfHeader>()]
|
||||
.as_ptr()
|
||||
|
|
|
|||
|
|
@ -62,10 +62,8 @@ impl Terminal {
|
|||
}
|
||||
|
||||
fn write_line(&mut self, line: &str) {
|
||||
let mut col = 0;
|
||||
for c in line.chars() {
|
||||
self.console.write_char(c, self.row, col);
|
||||
col += 1;
|
||||
for (col, c) in line.chars().enumerate() {
|
||||
self.console.write_char(c, self.row, col as u32);
|
||||
}
|
||||
|
||||
self.row += 1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue