From 3ad62c9428e2ca9411f7b993909ce52207871e2d Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Fri, 12 Mar 2021 13:04:28 -0500 Subject: wait for a key instead of sleeping in examples --- examples/basic.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'examples/basic.rs') diff --git a/examples/basic.rs b/examples/basic.rs index fb13d89..18d86a9 100644 --- a/examples/basic.rs +++ b/examples/basic.rs @@ -2,12 +2,13 @@ use textmode::Textmode as _; fn main() { let mut tm = textmode::blocking::Output::new().unwrap(); + let mut input = textmode::blocking::Input::new().unwrap(); tm.move_to(5, 5); tm.write_str("foo"); - std::thread::sleep(std::time::Duration::from_secs(2)); + input.read_key().unwrap(); tm.refresh().unwrap(); - std::thread::sleep(std::time::Duration::from_secs(2)); + input.read_key().unwrap(); tm.move_to(8, 8); tm.set_fgcolor(textmode::color::GREEN); @@ -15,7 +16,7 @@ fn main() { tm.move_to(11, 11); tm.set_fgcolor(vt100::Color::Default); tm.write_str("baz"); - std::thread::sleep(std::time::Duration::from_secs(2)); + input.read_key().unwrap(); tm.refresh().unwrap(); - std::thread::sleep(std::time::Duration::from_secs(2)); + input.read_key().unwrap(); } -- cgit v1.2.3-54-g00ecf