mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 06:17:49 +00:00
Shift lines up instead of clearing the screen when full
This commit is contained in:
@@ -45,6 +45,12 @@ impl Writer {
|
|||||||
self.buffer.fill(0);
|
self.buffer.fill(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn shift_lines_up(&mut self) {
|
||||||
|
let offset = self.info.stride * self.info.bytes_per_pixel * 8;
|
||||||
|
self.buffer.copy_within(offset.., 0);
|
||||||
|
self.y_pos -= 8;
|
||||||
|
}
|
||||||
|
|
||||||
fn width(&self) -> usize {
|
fn width(&self) -> usize {
|
||||||
self.info.horizontal_resolution
|
self.info.horizontal_resolution
|
||||||
}
|
}
|
||||||
@@ -61,8 +67,8 @@ impl Writer {
|
|||||||
if self.x_pos >= self.width() {
|
if self.x_pos >= self.width() {
|
||||||
self.newline();
|
self.newline();
|
||||||
}
|
}
|
||||||
if self.y_pos >= (self.height() - 8) {
|
while self.y_pos >= (self.height() - 8) {
|
||||||
self.clear();
|
self.shift_lines_up();
|
||||||
}
|
}
|
||||||
let rendered = font8x8::BASIC_FONTS
|
let rendered = font8x8::BASIC_FONTS
|
||||||
.get(c)
|
.get(c)
|
||||||
|
|||||||
Reference in New Issue
Block a user