minicrossterm/examples/examples.rs

41 lines
826 B
Rust
Raw Normal View History

//! This bin folder can be used to try the examples out located in the examples directory.
//!
//! All you need to do is:
//!
//! - Download the crossterm source code.
//! - Run program with: `cargo run --example examples`
extern crate crossterm;
// modules that could be test
//mod terminal;
mod color;
mod cursor;
mod some_types;
mod input;
2018-08-22 02:05:53 +10:00
use std::io::Write;
2018-08-22 05:17:53 +10:00
use std::{thread,time};
use crossterm::style::{style, Color, DisplayableObject};
use crossterm::terminal::terminal;
use crossterm::Screen;
use crossterm::output::TerminalOutput;
2018-09-22 06:22:25 +10:00
use crossterm::cursor::TerminalCursor;
2018-08-22 02:05:53 +10:00
fn main()
{
let screen = Screen::default();
2018-09-22 06:22:25 +10:00
let cursor = TerminalCursor::new(&screen.stdout);
2018-09-22 06:22:25 +10:00
cursor.goto(5, 5);
let (x, y) = cursor.pos();
assert_eq!(x, 5);
assert_eq!(y, 5);
println!("x: {} y: {}", x,y);
}