From bc0e5a406a0179fdbc7a5e298d108e966bcb3ed0 Mon Sep 17 00:00:00 2001 From: Agathe Porte Date: Sun, 23 Feb 2020 10:30:17 +0100 Subject: add goto functions --- src/lib.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/lib.rs') diff --git a/src/lib.rs b/src/lib.rs index 5679f60..b573b1a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -287,6 +287,18 @@ where pub fn large_font(&mut self) -> std::io::Result<()> { write_simple_code!(self, SpecialCode::LargeFont) } + + pub fn gotoxy(&mut self, x: u32, y: u32) -> std::io::Result<()> { + write_simple_code!(self, SpecialCode::GotoXY(Some(x), Some(y))) + } + + pub fn gotox(&mut self, x: u32) -> std::io::Result<()> { + write_simple_code!(self, SpecialCode::GotoXY(Some(x), None)) + } + + pub fn gotoy(&mut self, y: u32) -> std::io::Result<()> { + write_simple_code!(self, SpecialCode::GotoXY(None, Some(y))) + } } // Reimplement Write trait for Screen, so that user can call the write and -- cgit v1.2.3