Beispiel #1
0
<?php

namespace AScreen;

require_once 'loader.php';
$s = new Screen();
$s->add_layer(new Chaff(20, 80, ['character' => '*']));
$b = $s->add_layer();
$b->map->write(2, 4, '[ this text will be partially obscured by dots ]');
$d = $s->add_layer(new BendDexter(20, 40, ['start_column' => 4]));
//$d->map->show();
//$s->add_layer(new Chaff(20,40,['character'=>'.']));
$s->add_layer(new Chaff(30, 60, ['character' => '.']));
$text = $s->add_layer(null, ['transparent' => '~', 'blank' => '~']);
$text->map->write(4, 4, '[  this text will appear over everything else on the screen  ]');
//$s->add_layer(new BendDexter(20,40,['start_column'=>10]));
//$s->add_layer(Generate::bend_sinister(20,40,10));
$s->show();
Beispiel #2
0
<?php

namespace AScreen;

require_once 'loader.php';
$s = new Screen();
$s->add_layer(new Chaff(5, 80, ['character' => '*']));
$b = $s->add_layer(null, ['transparent' => '~', 'blank' => '~']);
$b->map->write(2, 4, '[ this text will be partially obscured by dots ]');
$s->add_layer(new Chaff(30, 10, ['character' => '.']));
$b1 = $s->add_layer(new BendSinister(30, 80, ['start_column' => 5]));
$d1 = $s->add_layer(new BendDexter(30, 80, ['start_column' => 8]));
$b2 = $s->add_layer(new BendSinister(30, 80, ['start_column' => 7]));
$text = $s->add_layer(null, ['transparent' => '~', 'blank' => '~']);
$text->map->write(4, 4, '[  this text will appear over everything else on the screen  ]');
$message = <<<MESSAGE
 This is a message that will get printed to the center of the screen. 

It can have multiple lines, and the script will deal with that
just fine. It doesn't do anything with justification, though.
MESSAGE;
foreach (explode("\n", $message) as $offset => $line) {
    $text->map->write($offset + 10, 4, $line);
}
//$s->add_layer(new BendDexter(20,40,['start_column'=>10]));
//$s->add_layer(Generate::bend_sinister(20,40,10));
while (1) {
    $s->show();
    $b1->map->options['start_column'] = rand(0, 4) + 10;
    $b2->map->options['start_column'] = rand(0, 2) + 15;
    $d1->map->options['start_column'] = rand(0, 2) + 5;