mirror of
https://github.com/iceHtwoO/novaOS.git
synced 2026-04-16 20:22:26 +00:00
Print String
This commit is contained in:
@@ -201,8 +201,25 @@ impl FrameBuffer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn draw_letter(&self, x: u32, y: u32, scale: u32) {
|
//TODO: Scale in pixels
|
||||||
for (y_offset, row) in (&BASIC_LEGACY[0x70]).iter().enumerate() {
|
pub fn draw_string(&self, string: &str, x: u32, mut y: u32, scale: u32) {
|
||||||
|
let mut offset = 0;
|
||||||
|
for c in string.bytes() {
|
||||||
|
match c {
|
||||||
|
b'\n' => {
|
||||||
|
y += 8 * scale;
|
||||||
|
offset = 0;
|
||||||
|
}
|
||||||
|
_ => {
|
||||||
|
self.draw_ascii(x + (offset as u32 * 8 * scale), y, c as usize, scale);
|
||||||
|
offset += 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn draw_ascii(&self, x: u32, y: u32, char: usize, scale: u32) {
|
||||||
|
for (y_offset, row) in (&BASIC_LEGACY[char]).iter().enumerate() {
|
||||||
for bit in 0..8 {
|
for bit in 0..8 {
|
||||||
match row & (1 << bit) {
|
match row & (1 << bit) {
|
||||||
0 => {}
|
0 => {}
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ pub extern "C" fn kernel_main() -> ! {
|
|||||||
fb.draw_square_fill(800, 800, 900, 900);
|
fb.draw_square_fill(800, 800, 900, 900);
|
||||||
fb.draw_square_fill(1000, 800, 1200, 700);
|
fb.draw_square_fill(1000, 800, 1200, 700);
|
||||||
fb.draw_square_fill(900, 100, 800, 150);
|
fb.draw_square_fill(900, 100, 800, 150);
|
||||||
fb.draw_letter(500, 5, 4);
|
fb.draw_string("Hello World! :D\nTest next Line", 500, 5, 3);
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
let temp = read_soc_temp();
|
let temp = read_soc_temp();
|
||||||
|
|||||||
Reference in New Issue
Block a user