From 42c70e05335f00dfe720860917819135f8a207b9 Mon Sep 17 00:00:00 2001 From: tomsmeding Date: Sun, 10 Feb 2019 14:44:27 +0100 Subject: Make API more uniform --- src/lib.rs | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 15cd5ff..7a17a0f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -37,12 +37,6 @@ pub const KEY_ALT: i32 = bindings::KEY_ALT as i32; pub const KEY_CTRLALT: i32 = bindings::KEY_CTRLALT as i32; pub const KEY_CTRLSHIFT: i32 = bindings::KEY_CTRLSHIFT as i32; -#[derive(Debug, Copy, Clone)] -pub struct Size { - pub w: u32, - pub h: u32, -} - #[derive(Debug, Copy, Clone)] pub struct Style { pub fg: u8, // 0-7, 9 @@ -79,9 +73,9 @@ pub fn clear_screen() { unsafe { bindings::clearscreen(); } } -pub fn get_term_size() -> Size { +pub fn get_term_size() -> (u32, u32) { let sz = unsafe { bindings::gettermsize() }; - Size { w: sz.w as u32, h: sz.h as u32 } + (sz.w as u32, sz.h as u32) } pub fn set_style(style: Style) { @@ -120,7 +114,7 @@ pub fn print(s: &str) { s.as_bytes().as_ptr() as *const i8); } } -pub fn fillrect(lefttop: (u32, u32), size: (u32, u32), c: char) { +pub fn fill_rect(lefttop: (u32, u32), size: (u32, u32), c: char) { unsafe { bindings::fillrect( lefttop.0 as i32, lefttop.1 as i32, size.0 as i32, size.1 as i32, -- cgit v1.2.3-70-g09d2