diff options
author | tomsmeding <tom.smeding@gmail.com> | 2019-02-10 14:44:27 +0100 |
---|---|---|
committer | tomsmeding <tom.smeding@gmail.com> | 2019-02-10 14:44:40 +0100 |
commit | 42c70e05335f00dfe720860917819135f8a207b9 (patch) | |
tree | b6cc72b9e3919c5a0a5c5df3992fe255a9eb5d2a /src | |
parent | cb7748a7b064e1782f9d41ea6dc6b9fb87bdb0d8 (diff) |
Make API more uniform
Diffstat (limited to 'src')
-rw-r--r-- | src/lib.rs | 12 |
1 files changed, 3 insertions, 9 deletions
@@ -38,12 +38,6 @@ 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 pub bg: 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, |