-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.php
More file actions
81 lines (65 loc) · 2.61 KB
/
main.php
File metadata and controls
81 lines (65 loc) · 2.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?php
/**
* main.php
* @author ciaran
* @author Fabian 'zetaron' Stegemann
* @date 31.10.2014 19:16
*/
require_once './vendor/autoload.php';
/**
* @var \Kurses\EventLoop
*/
$eventLoop = \Kurses\EventLoopFactory::select();
$screen = new \Kurses\Screen($eventLoop);
$main = $screen->addPanel([]);
$hPanels = $screen->hSplitPanel($main, [1,10]);
$vPanels = $screen->vSplitPanel($hPanels[0], [2,2,1]);
/** @var \Kurses\ScrollingList $scroller */
$scroller = $screen->replacePanelWithType($vPanels[1], 'Kurses\ScrollingList');
$scroller->border();
$scroller->setTitle('Scroller');
$eventLoop->every(function()use($scroller) {
$scroller->addLine(sprintf("[%03d] %s",mt_rand(0,100),time()));
}, 1200);
/** @var \Kurses\ScrollingList $scroller */
$fastScroller = $screen->replacePanelWithType($vPanels[2], 'Kurses\ScrollingList');
$fastScroller->border();
$fastScroller->setTitle('FastScroller');
$eventLoop->every(function()use($fastScroller) {
$fastScroller->addLine(sprintf("[%03d] %s",mt_rand(0,100),time()));
}, 200);
/** @var \Kurses\ScrollingList $scroller */
$reallyFastScroller = $screen->replacePanelWithType($vPanels[0], 'Kurses\ScrollingList');
$reallyFastScroller->border();
$reallyFastScroller->setTitle('ReallyFastScroller');
$eventLoop->every(function()use($reallyFastScroller) {
$reallyFastScroller->addLine(sprintf("[%03d] %s",mt_rand(0,100),time()));
}, 20);
//$main->border();
//$main->setTitle('Main Screen');
//
//$vPanels = $screen->vSplitPanel($main, [4,1]);
//$hPanels = $screen->hSplitPanel($vPanels[1], [1,1,1,1,1,1,1,1]);
$eventLoop->start();
//$screen->vSplitPanel('left', 'left1', 'right1');
//list($topLeft, $bottomLeft) = $screen->hSplitPanel('left', 'leftTop', 'leftBottom');
//list($bottomLeftLeft, $bottomLeftRight) = $screen->vSplitPanel('leftBottom', 'leftBottomLeft', 'rightBottomLeft');
//$screen->addPanel('leftTop', ['panel' => $topLeft]);
//$screen->addPanel('leftBottom', ['panel' => $bottomLeft]);
//
//list($rightTopLeft, $rightBottomLeft) = $right->hSplit(0.25);
//$screen->addPanel('rightTop', ['panel' => $rightTopLeft]);
//$screen->addPanel('rightBottom', ['panel' => $rightBottomLeft]);
//$main->getMaxYX($y, $x);
//$window1 = new \Kurses\Panel($y - 2, ($x / 2), 1, 1);
//$window2 = new \Kurses\Panel($y - 2 , ($x / 2) - 2, 1, ($x / 2) + 2);
//
//$main->border();
//$window1->border();
//$window2->border();
//
//$main->setTitle('JimmyBot');
//
//$window2->setTitle("hello world");
//$window2->addText(['hello', 'how are you', 'x: '.$window2->getMaxX(),'y: '.$window2->getMaxY(),]);
//$window1->addText(['window 1', 'x: '.$window1->getMaxX(),'y: '.$window1->getMaxY(),]);