1
0
Fork 0
forked from koniifer/ableos
ableos-framebuffer/ableos/src/vga_e.rs

40 lines
979 B
Rust
Raw Normal View History

use vga::{
colors::Color16,
writers::{Graphics640x480x16, GraphicsWriter},
2022-01-13 08:54:33 -06:00
};
2022-01-07 10:31:47 -06:00
2022-01-16 14:55:58 -06:00
lazy_static::lazy_static! {
pub static ref VGAE: spin::Mutex<Graphics640x480x16> = {
let xyz = Graphics640x480x16::new();
xyz.set_mode();
spin::Mutex::new(xyz)
};
2022-01-18 06:15:51 -06:00
pub static ref VGAE_BUFF_OFFSET_X: spin::Mutex<u8> = spin::Mutex::new(0);
pub static ref VGAE_BUFF_OFFSET_Y: spin::Mutex<u8> = spin::Mutex::new(0);
2022-01-16 14:55:58 -06:00
}
2022-01-18 06:15:51 -06:00
2022-01-26 22:06:04 -06:00
/// Converts a number to ... i forgor 💀
2022-01-18 08:30:09 -06:00
pub fn num_to_vga16(num: u8) -> Color16 {
2022-02-18 12:25:54 -06:00
use Color16::*;
match num {
0 => Black,
1 => Blue,
2 => Green,
3 => Cyan,
4 => Red,
5 => Magenta,
6 => Brown,
7 => LightGrey,
8 => DarkGrey,
9 => LightBlue,
10 => LightGreen,
11 => LightCyan,
12 => LightRed,
13 => Pink,
14 => Yellow,
15 => White,
// NOTE: Leasve the in
_ => Color16::Pink,
}
2022-01-18 08:30:09 -06:00
}