hello/hello.rs
1// Prevents a spare console from being created attached to our program on
2// windows, but only if we're running in release mode.
3#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
4
5// Enabling macro_use allows the `colorpair!` macro, though you can also use
6// `ColorPair::new(Color,Color)` if you don't want the macro.
7extern crate easycurses;
8
9use easycurses::Color::*;
10use easycurses::*;
11
12fn main() {
13 // Initialize the system
14 let mut easy = EasyCurses::initialize_system().unwrap();
15
16 // don't show the cursor
17 easy.set_cursor_visibility(CursorVisibility::Invisible);
18
19 // don't echo the user's input
20 easy.set_echo(false);
21
22 // we'll print this in green text.
23 easy.set_color_pair(colorpair!(Green on Black));
24
25 // Print this string from the current position. The default cursor position
26 // is rc(0,0)
27 easy.print("Hello world.");
28
29 // Ensure that the user has the latest view of things.
30 easy.refresh();
31
32 // Get one input from the user. This is just so that they have a chance to
33 // see the message and press a key, otherwise the program would end faster
34 // than they could read it.
35 easy.get_input();
36}