mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-18 03:25:55 +00:00
4673a86ea2
- rename EGC to Egc, EGCBackstop to EgcBackstop and ChannelPair to Channels. - make the original type aliased structs non-public (e.g. ncdirect, ncalign…) - fix and improve documentation for several types. - revert renaming crate to nc on use. - directly import the used types at the beginning of the module. Now the rustdoc generated documentation is much cleaner.
32 lines
761 B
Rust
32 lines
761 B
Rust
use cstr_core::CString;
|
|
|
|
use libnotcurses_sys as nc;
|
|
|
|
fn main() {
|
|
unsafe {
|
|
let ncd = nc::ncdirect_new();
|
|
|
|
render_image(&mut *ncd, nc::NCBLIT_1x1);
|
|
render_image(&mut *ncd, nc::NCBLIT_2x1);
|
|
render_image(&mut *ncd, nc::NCBLIT_BRAILLE);
|
|
|
|
nc::ncdirect_stop(ncd);
|
|
}
|
|
}
|
|
|
|
fn render_image(ncd: &mut nc::NcDirect, blit: nc::NcBlitter) {
|
|
unsafe {
|
|
if nc::ncdirect_render_image(
|
|
ncd,
|
|
CString::new("image-16x16.png").unwrap().as_ptr(),
|
|
nc::NCALIGN_CENTER,
|
|
blit,
|
|
nc::NCSCALE_NONE,
|
|
) != 0
|
|
{
|
|
panic!("ERR: ncdirect_render_image. \
|
|
Make sure you are running this example from the examples folder");
|
|
}
|
|
}
|
|
}
|