mirror of
https://codeberg.org/unspeaker/tengri.git
synced 2025-12-06 11:46:42 +01:00
ops: fix Map::east/south with example
This commit is contained in:
parent
2e9ba1b92d
commit
222e10239b
6 changed files with 19 additions and 9 deletions
1
tui/examples/edn14.edn
Normal file
1
tui/examples/edn14.edn
Normal file
|
|
@ -0,0 +1 @@
|
|||
:map-e
|
||||
1
tui/examples/edn15.edn
Normal file
1
tui/examples/edn15.edn
Normal file
|
|
@ -0,0 +1 @@
|
|||
(align/c :map-e)
|
||||
1
tui/examples/edn16.edn
Normal file
1
tui/examples/edn16.edn
Normal file
|
|
@ -0,0 +1 @@
|
|||
:map-s
|
||||
1
tui/examples/edn17.edn
Normal file
1
tui/examples/edn17.edn
Normal file
|
|
@ -0,0 +1 @@
|
|||
(align/c :map-s)
|
||||
|
|
@ -25,7 +25,11 @@ const EXAMPLES: &'static [&'static str] = &[
|
|||
include_str!("edn10.edn"),
|
||||
include_str!("edn11.edn"),
|
||||
include_str!("edn12.edn"),
|
||||
include_str!("edn13.edn"),
|
||||
//include_str!("edn13.edn"),
|
||||
include_str!("edn14.edn"),
|
||||
include_str!("edn15.edn"),
|
||||
include_str!("edn16.edn"),
|
||||
include_str!("edn17.edn"),
|
||||
];
|
||||
|
||||
handle!(TuiIn: |self: Example, input|{
|
||||
|
|
@ -58,7 +62,7 @@ atom_command!(ExampleCommand: |app: Example| {
|
|||
view!(TuiOut: |self: Example|{
|
||||
let index = self.0 + 1;
|
||||
let wh = self.1.wh();
|
||||
let src = EXAMPLES[self.0];
|
||||
let src = EXAMPLES.get(self.0).unwrap_or(&"");
|
||||
let heading = format!("Example {}/{} in {:?}", index, EXAMPLES.len(), &wh);
|
||||
let title = Tui::bg(Color::Rgb(60, 10, 10), Push::y(1, Align::n(heading)));
|
||||
let code = Tui::bg(Color::Rgb(10, 60, 10), Push::y(2, Align::n(format!("{}", src))));
|
||||
|
|
@ -69,7 +73,9 @@ view!(TuiOut: |self: Example|{
|
|||
":code" => Tui::bg(Color::Rgb(10, 60, 10), Push::y(2, Align::n(format!("{}", EXAMPLES[self.0])))).boxed(),
|
||||
":hello" => Tui::bg(Color::Rgb(10, 100, 10), "Hello").boxed(),
|
||||
":world" => Tui::bg(Color::Rgb(100, 10, 10), "world").boxed(),
|
||||
":hello-world" => "Hello world!".boxed()
|
||||
":hello-world" => "Hello world!".boxed(),
|
||||
":map-e" => Map::east(5u16, ||0..5u16, |n, i|format!("{n}")).boxed(),
|
||||
":map-s" => Map::south(5u16, ||0..5u16, |n, i|format!("{n}")).boxed(),
|
||||
});
|
||||
|
||||
expose! {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue