Much awesome, very Wow!
* Import native PHP code as callable functions (load) * Include other scripts (include) * Multitude of fixes
This commit is contained in:
16
examples/boxdraw.ftm
Normal file
16
examples/boxdraw.ftm
Normal file
@ -0,0 +1,16 @@
|
||||
set terminal 80x25
|
||||
|
||||
load boxdraw.php
|
||||
|
||||
writefile boxdraw.ftm
|
||||
|
||||
drawhline 5 0 70
|
||||
drawvline 5 0 5
|
||||
|
||||
drawbox 22 3 40 14
|
||||
|
||||
write <sgr fg:white bg:blue>
|
||||
drawfilledbox 37 5 30 8
|
||||
write <sgr>
|
||||
|
||||
savepng boxdraw.png
|
77
examples/boxdraw.php
Normal file
77
examples/boxdraw.php
Normal file
@ -0,0 +1,77 @@
|
||||
<?php return [
|
||||
|
||||
/**
|
||||
* Draw a box frame
|
||||
*/
|
||||
'drawbox' => function ($term, $column, $line, $width, $height) {
|
||||
fprintf(STDERR, "drawbox: {%d,%d}+[%d,%d]\n", $column, $line, $width, $height);
|
||||
$oldpos = $term->getCursorPosition();
|
||||
|
||||
$term->setCursor($line, $column);
|
||||
$term->write("\u{250c}" . str_repeat("\u{2500}", $width - 2) . "\u{2510}");
|
||||
|
||||
$term->setCursor($line + $height, $column);
|
||||
$term->write("\u{2514}" . str_repeat("\u{2500}", $width - 2) . "\u{2518}");
|
||||
|
||||
for ($l = $line + 1; $l < $line + $height; $l++) {
|
||||
$term->setCursor($l, $column);
|
||||
$term->write("\u{2502}");
|
||||
$term->setCursor($l, $column + $width - 1);
|
||||
$term->write("\u{2502}");
|
||||
}
|
||||
|
||||
$term->setCursor($oldpos[0], $oldpos[1]);
|
||||
},
|
||||
|
||||
/**
|
||||
* Draw a box and fill it
|
||||
*/
|
||||
'drawfilledbox' => function ($term, $column, $line, $width, $height) {
|
||||
fprintf(STDERR, "drawbox: {%d,%d}+[%d,%d]\n", $column, $line, $width, $height);
|
||||
$oldpos = $term->getCursorPosition();
|
||||
|
||||
$term->setCursor($line, $column);
|
||||
$term->write("\u{250c}" . str_repeat("\u{2500}", $width - 2) . "\u{2510}");
|
||||
|
||||
$term->setCursor($line + $height, $column);
|
||||
$term->write("\u{2514}" . str_repeat("\u{2500}", $width - 2) . "\u{2518}");
|
||||
|
||||
for ($l = $line + 1; $l < $line + $height; $l++) {
|
||||
$term->setCursor($l, $column);
|
||||
$term->write("\u{2502}" . str_repeat(" ", $width - 2) . "\u{2502}");
|
||||
}
|
||||
|
||||
$term->setCursor($oldpos[0], $oldpos[1]);
|
||||
},
|
||||
|
||||
/**
|
||||
* Draw a horizontal line
|
||||
*/
|
||||
'drawhline' => function ($term, $line, $fromCol, $toCol) {
|
||||
|
||||
$oldpos = $term->getCursorPosition();
|
||||
|
||||
$term->setCursor($line, $fromCol);
|
||||
$term->write(str_repeat("\u{2500}", ($toCol-$fromCol)));
|
||||
|
||||
$term->setCursor($oldpos[0], $oldpos[1]);
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Draw a vertical line
|
||||
*/
|
||||
'drawvline' => function ($term, $column, $fromLine, $toLine) {
|
||||
|
||||
$oldpos = $term->getCursorPosition();
|
||||
|
||||
for ($l = $fromLine; $l <= $toLine; $l++) {
|
||||
$term->setCursor($l, $column);
|
||||
$term->write("\u{2502}");
|
||||
}
|
||||
|
||||
$term->setCursor($oldpos[0], $oldpos[1]);
|
||||
|
||||
}
|
||||
|
||||
];
|
BIN
examples/boxdraw.png
Normal file
BIN
examples/boxdraw.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
@ -1,5 +1,5 @@
|
||||
set terminal 80x5
|
||||
set typedelay 250
|
||||
set terminal 80x10
|
||||
set typedelay 100
|
||||
set fps 30
|
||||
|
||||
sub prompt
|
||||
@ -7,33 +7,93 @@ sub prompt
|
||||
delay 500
|
||||
endsub
|
||||
|
||||
write <sgr bold> "dd" <sgr> " - convert and copy a file" <return>
|
||||
write u{2500} *80 <return>
|
||||
|
||||
mark %top
|
||||
|
||||
|
||||
|
||||
write <sgr fg:cyan bold> Example 1: <sgr fg:cyan> " Creating a disk image" <sgr> <return> <return>
|
||||
prompt "~"
|
||||
|
||||
type "dd "
|
||||
|
||||
delay 1000
|
||||
|
||||
mark dd-if
|
||||
type "if=/dev/sdb "
|
||||
annotate @dd-if "Input" at dd-if
|
||||
annotate @dd-if "Input file\n(Source)" at dd-if
|
||||
annotatelength @dd-if 11
|
||||
delay 2000
|
||||
|
||||
mark dd-of
|
||||
type "of=image.img "
|
||||
annotate @dd-of "Output" at dd-of
|
||||
annotate @dd-of "Output file\n(Destination)" at dd-of
|
||||
annotatelength @dd-of 12
|
||||
delay 2000
|
||||
|
||||
mark dd-bs
|
||||
type "bs=16M "
|
||||
annotate @dd-bs "Block\nsize" at dd-bs
|
||||
annotatelength @dd-bs 6
|
||||
delay 2000
|
||||
|
||||
mark dd-status
|
||||
type "status=progress "
|
||||
annotate @dd-status "Show progress" at dd-status
|
||||
annotatelength @dd-status 15
|
||||
delay 2000
|
||||
|
||||
write <return>
|
||||
|
||||
prompt "~"
|
||||
|
||||
delay 2000
|
||||
|
||||
clearannotate
|
||||
moveto %top
|
||||
clear to-bottom
|
||||
delay 500
|
||||
|
||||
|
||||
delay 500
|
||||
write <sgr fg:cyan bold> Example 2: <sgr fg:cyan> " Create a file with empty data" <sgr> <return> <return>
|
||||
prompt "~"
|
||||
|
||||
type "dd "
|
||||
|
||||
delay 1000
|
||||
|
||||
mark dd-if
|
||||
type "if=/dev/zero "
|
||||
annotate @dd-if "Reading from\n/dev/zero will\nreturn '0'\nindefinitely" at dd-if
|
||||
annotatelength @dd-if 12
|
||||
delay 2000
|
||||
|
||||
mark dd-bs
|
||||
type "bs=1M "
|
||||
annotate @dd-bs "Block\nsize" at dd-bs
|
||||
annotatelength @dd-bs 5
|
||||
delay 2000
|
||||
|
||||
mark dd-count
|
||||
type "count=100 "
|
||||
annotate @dd-count "Number of\nblocks to\ncopy:\n100*1M=100MB" at dd-count
|
||||
annotatelength @dd-count 9
|
||||
delay 2000
|
||||
|
||||
mark dd-of
|
||||
type "> "
|
||||
annotate @dd-of "Without of= the output\nwill go to standard output,\nwhich can be redirected" at dd-of
|
||||
annotatelength @dd-of 1
|
||||
delay 2000
|
||||
|
||||
type "empty.img"
|
||||
|
||||
write <return>
|
||||
|
||||
delay 2000
|
||||
|
||||
clearannotate
|
||||
moveto %top
|
||||
clear to-bottom
|
||||
delay 500
|
||||
|
||||
|
BIN
examples/dd.gif
BIN
examples/dd.gif
Binary file not shown.
Before Width: | Height: | Size: 107 KiB After Width: | Height: | Size: 1.0 MiB |
BIN
examples/dd.mp4
Normal file
BIN
examples/dd.mp4
Normal file
Binary file not shown.
5
examples/keys.ftm
Normal file
5
examples/keys.ftm
Normal file
@ -0,0 +1,5 @@
|
||||
set terminal 80x25
|
||||
|
||||
showkeys ctrl alt shift F4 up up down down left right left right B A
|
||||
|
||||
savepng keys.png
|
BIN
examples/keys.png
Normal file
BIN
examples/keys.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.4 KiB |
Reference in New Issue
Block a user