forked from AbleOS/ableos
25 lines
985 B
Rust
25 lines
985 B
Rust
|
// TODO: Reorganize and make part of this into a limine agnostic API for general purpose graphics
|
||
|
use crate::kmain::FRAMEBUFFER;
|
||
|
pub fn clear_screen() {
|
||
|
{
|
||
|
// TODO: setup a proper framebuffer handler
|
||
|
let fb_response = FRAMEBUFFER.get_response().get().unwrap();
|
||
|
for fb in fb_response.framebuffers().unwrap() {
|
||
|
trace!("Framebuffer {}x{}", fb.width, fb.height);
|
||
|
trace!("{}", fb.memory_model);
|
||
|
trace!("{}", fb.bpp);
|
||
|
let mut count = 0;
|
||
|
let total = fb.width * fb.height * 3;
|
||
|
while count != total {
|
||
|
unsafe {
|
||
|
let fb_ptr = fb.address.as_mut_ptr().unwrap();
|
||
|
*fb_ptr.offset((count).try_into().unwrap()) = 0x00;
|
||
|
*fb_ptr.offset((count + 1).try_into().unwrap()) = 0x00;
|
||
|
*fb_ptr.offset((count + 2).try_into().unwrap()) = 0x00;
|
||
|
}
|
||
|
count += 3;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|