yum install ncurses-devel
phpize --clean
phpize
./configure
(./configure --with-php-config=/usr/bin/php-config --enable-ncursesw=autodetect --with-ncurses)
make
make install

ls /usr/lib/php/modules/ncurses.so
nano /etc/php.d/ncurses.ini
extension=ncurses.so
php -m | grep ncurses
<?php

require('vendor/autoload.php');

$Ncurses = new \wapmorgan\NcursesObjects\Ncurses();

$Ncurses
 ->setEchoState(false)
 ->setNewLineTranslationState(true)
 ->setCursorState(\wapmorgan\NcursesObjects\Ncurses::CURSOR_INVISIBLE)
 ->refresh();

$MainWindow = new \wapmorgan\NcursesObjects\Window();
$MainWindow->border()->title('Hello! Today is '.date('d.m.Y'))->refresh();


$Window = \wapmorgan\NcursesObjects\Window::createCenteredOf($MainWindow, 6, 6);
$Window
 ->border()
 ->moveCursor(3, 4)
 ->drawStringHere('OK!')
 ->refresh();

while (true) {
 $ch = $Ncurses->getCh();
 $Ncurses->refresh();
 $MainWindow->erase()->border()->refresh();
 $Window->erase()
 ->border()
 ->moveCursor(3, 4)
 ->drawStringHere('OK!')
 ->refresh();
 echo $ch;
usleep(100000);
}

unset($Ncurses);

Добавить комментарий

Ваш e-mail не будет опубликован. Обязательные поля помечены *