forked from koniifer/ableos
73 lines
1.8 KiB
Rust
73 lines
1.8 KiB
Rust
use alloc::string::String;
|
|
|
|
use vga::{
|
|
colors::Color16,
|
|
writers::{Graphics640x480x16, GraphicsWriter},
|
|
};
|
|
|
|
pub fn test_it_fucko() {
|
|
let mode = Graphics640x480x16::new();
|
|
mode.set_mode();
|
|
mode.clear_screen(Color16::Black);
|
|
|
|
mode.draw_line((80, 60), (80, 420), Color16::White);
|
|
mode.draw_line((80, 60), (540, 60), Color16::White);
|
|
|
|
{
|
|
let offset = 110;
|
|
mode.draw_character(offset - 15 - 4, 60 + 15 - 4, 'x', Color16::Red);
|
|
|
|
mode.draw_line(
|
|
(offset.try_into().unwrap(), 60),
|
|
(offset.try_into().unwrap(), 90),
|
|
Color16::White,
|
|
);
|
|
}
|
|
|
|
mode.draw_line((80, 420), (540, 420), Color16::White);
|
|
mode.draw_line((540, 420), (540, 60), Color16::White);
|
|
mode.draw_line((80, 90), (540, 90), Color16::White);
|
|
|
|
for (offset, character) in "ableOS".chars().enumerate() {
|
|
mode.draw_character(270 + offset * 8, 72, character, Color16::White)
|
|
}
|
|
|
|
for (offset, character) in "S".chars().enumerate() {
|
|
mode.draw_character(270 + offset * 8, 50, character, Color16::White)
|
|
}
|
|
}
|
|
|
|
pub trait GraphicsAPI {
|
|
fn add_shader() {}
|
|
}
|
|
|
|
pub struct Buffer {
|
|
label: String,
|
|
resolution: (u64, u64),
|
|
// pointer
|
|
}
|
|
pub fn draw_q() {
|
|
let mode = Graphics640x480x16::new();
|
|
mode.set_mode();
|
|
mode.clear_screen(Color16::Black);
|
|
|
|
use ab_glyph::{point, Font, FontRef, Glyph};
|
|
|
|
let font =
|
|
FontRef::try_from_slice(include_bytes!("../../ableos/assets/fonts/Roboto-Black.ttf"))
|
|
.unwrap();
|
|
|
|
// Get a glyph for 'q' with a scale & position.
|
|
let q_glyph: Glyph = font
|
|
.glyph_id('q')
|
|
.with_scale_and_position(24.0, point(100.0, 0.0));
|
|
|
|
// Draw it.
|
|
|
|
if let Some(q) = font.outline_glyph(q_glyph) {
|
|
q.draw(|x, y, _c| {
|
|
mode.set_pixel(x as usize, y as usize, Color16::LightBlue);
|
|
});
|
|
}
|
|
}
|