mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-06 03:20:26 +00:00
b12abeddc9
- change Option return type for NcResult when appropriate. - make NcDirect constructors return NcResult. - rename NcError::new() to with_msg() and simplify new(). - refactor examples: - rename direct-image.rs to direct-image-c.rs - recreate using rust methods, as direct-image-rust.rs - differentiate more throughly between both styles. - remove the sys namespace on both examples.
26 lines
506 B
Rust
26 lines
506 B
Rust
//! based on the proof of concept at ../../src/poc/kittyzapper.c
|
|
|
|
use libnotcurses_sys::*;
|
|
|
|
fn main() -> NcResult<()> {
|
|
let ncd = NcDirect::new()?;
|
|
|
|
ncd.fg_rgb8(100, 100, 100)?;
|
|
ncd.bg_rgb8(0xff, 0xff, 0xff)?;
|
|
printf!("a");
|
|
ncd.bg_rgb8(0, 0, 0)?;
|
|
printf!("b");
|
|
printf!(" ");
|
|
printf!(" ");
|
|
ncd.bg_rgb8(0, 0, 1)?;
|
|
printf!("c");
|
|
printf!(" ");
|
|
printf!(" ");
|
|
ncd.bg_rgb8(0xff, 0xff, 0xff)?;
|
|
printf!("d");
|
|
printf!("\n");
|
|
ncd.stop()?;
|
|
|
|
Ok(())
|
|
}
|