From d6c01c7309c974341e50ab0df1ec219f7f96eefd Mon Sep 17 00:00:00 2001 From: Ryan Kennedy Date: Tue, 24 Mar 2020 17:54:09 -0500 Subject: [PATCH] updated readme --- README.md | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4ad8ec0..4efb9e8 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ this crate to work properly. **Note: This crate is currently experimental and subject to change since it's in active development.** -## Usage +## Text Mode ```rust use vga::colors::{Color16, TextModeColor}; use vga::writers::{ScreenCharacter, TextWriter, Text80x25}; @@ -22,3 +22,21 @@ text_mode.set_mode(); text_mode.clear_screen(); text_mode.write_character(0, 0, screen_character); ``` + +## Graphics Mode +```rust +use vga::colors::Color16; +use vga::writers::{Graphics640x480x16, GraphicsWriter}; + +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); +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 "Hello World!".chars().enumerate() { + mode.draw_character(270 + offset * 8, 72, character, Color16::White) +} +```