mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-10-31 15:20:13 +00:00
rust: add example poc-cjkscroll
This commit is contained in:
parent
bf7f5de745
commit
c07b68f783
31
rust/examples/poc-cjkscroll.rs
Normal file
31
rust/examples/poc-cjkscroll.rs
Normal file
@ -0,0 +1,31 @@
|
||||
//! based on the proof of concept at ../../src/poc/cjkscroll.c
|
||||
|
||||
use libnotcurses_sys::*;
|
||||
|
||||
fn main() {
|
||||
|
||||
let nc = Notcurses::new();
|
||||
let plane = nc.stdplane();
|
||||
plane.set_scrolling(true);
|
||||
|
||||
let mut wc = '\u{4e00}'; // '一';
|
||||
|
||||
loop {
|
||||
sleep![1];
|
||||
|
||||
if plane.putchar(wc) == NCRESULT_ERR {
|
||||
break;
|
||||
}
|
||||
|
||||
wc = core::char::from_u32(wc as u32 + 1).expect("invalid char");
|
||||
|
||||
if wc == '\u{9fa5}' { // 龣
|
||||
wc = '\u{4e00}';
|
||||
}
|
||||
|
||||
if nc.render() == NCRESULT_ERR {
|
||||
break;
|
||||
}
|
||||
}
|
||||
nc.stop();
|
||||
}
|
Loading…
Reference in New Issue
Block a user