コード例 #1
0
function TwatchShowTime(&$socket, $delay = -1)
{
    setlocale(LC_ALL, 'nl_NL.UTF8');
    $time[1] = '                    ';
    $time[2] = strftime('%d %B %Y');
    $len = strlen($time[2]);
    $time[2] = AlignRow($time[2], 'center');
    $day3 = strftime('%A');
    $time3 = strftime('%R');
    $spacer = $len - strlen($day3 . $time3);
    $time[3] = $day3 . str_pad('', $spacer, ' ') . $time3;
    $time[3] = AlignRow($time[3], 'center');
    $time[4] = $time[1];
    TwatchPrintRows($socket, $time, $delay, 'center');
    if ($delay != -1) {
        sleep($delay);
    }
}
コード例 #2
0
$preprint = "TwatchPrint() now...";
$print = "TwatchPrint() will print text to whatever position to cursor is at.";
$preprintrows = "TwatchPrintRows is a bit smarter...";
$printrows1[1] = "TwatchPrintRows()";
$printrows1[2] = "Takes an array of";
$printrows1[3] = "4 values and prints";
$printrows1[4] = "one on each line";
$printrows2[1] = "Lines will be padded";
$printrows2[2] = "times and aligned as";
$printrows2[3] = "you want them";
$printrows2[4] = "to be";
$print = "TwatchPrintRows() an array of 4 elementes to be printed on the will print text to whatever position to cursor is at.";
$align[1] = AlignRow("AlignRow() will pad", 'left');
$align[2] = AlignRow("and align left", 'left');
$align[3] = AlignRow("align center", 'center');
$align[4] = AlignRow("or align right", 'right');
$scrollpage = "TwatchScrollPage() will scroll text upwards. You know, like at the end of a movie?";
$pagepage = "TwatchPagePage() is similar, but will move upwards in blocks of four lines instead of line by line.";
$scrollrows[1] = "TwatchScrollRows()";
$scrollrows[2] = "TwatchScrollRows() takes a 4 value array and scrolls those lines that are longer then 20 chars. The others are just displayed statically";
$scrollrows[3] = "Oh, and also:";
$scrollrows[4] = "It will repeat shorter lines untill the longest is scrolled";
$showtime = "TwatchShowTime() does this...";
$scrollascii = "And finally, there is TwatchScrollAscii...";
$feedback[1] = "Get the PHP lib at ";
$feedback[2] = "decock.org/twatch";
$feedback[3] = "Send feedback to";
$feedback[4] = "*****@*****.**";
TwatchConnect($socket);
TwatchBacklightOff($socket);
TwatchClearSCreen($socket);