[rust] update example #1699

pull/1706/head
joseLuís 3 years ago
parent 9c370806c5
commit 47c794050a

@ -3,11 +3,11 @@
use libnotcurses_sys::*;
const W: u32 = 16;
const H: u32 = 8;
const W: u32 = 32;
const H: u32 = 32;
fn main() -> NcResult<()> {
let nc = Notcurses::without_altscreen()?;
let nc = Notcurses::new()?;
println!("pixel support: {:?}", nc.check_pixel_support());
@ -21,19 +21,16 @@ fn main() -> NcResult<()> {
buffer.push(255);
}
// BUG: when using from_bgra() it will draw vertical stripes
let vframe1 = NcVisual::from_bgra(&buffer, H, W * 4, W)?;
// from_rgba() does work well!
// let vframe1 = NcVisual::from_rgba(&buffer, H, W * 4, W)?;
let voptions = NcVisualOptions::without_plane(0, 0, 0, 0, H, W, NCBLIT_1x1, 0, 0);
// BUG: nothing gets drawn when using NCBLIT_PIXEL
// let voptions = NcVisualOptions::without_plane(0, 0, 0, 0, H, W, NCBLIT_PIXEL, 0, 0);
// let voptions = NcVisualOptions::without_plane(0, 0, 0, 0, H, W, NCBLIT_1x1, 0, 0);
let voptions = NcVisualOptions::without_plane(0, 0, 0, 0, H, W, NCBLIT_PIXEL, 0, 0);
vframe1.render(nc, &voptions)?;
nc.render()?;
sleep![2];
vframe1.destroy();
nc.stop()?;
Ok(())

Loading…
Cancel
Save