当前位置: 首页>>代码示例>>PHP>>正文


PHP ncurses_init函数代码示例

本文整理汇总了PHP中ncurses_init函数的典型用法代码示例。如果您正苦于以下问题:PHP ncurses_init函数的具体用法?PHP ncurses_init怎么用?PHP ncurses_init使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ncurses_init函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: display

 public function display()
 {
     ncurses_init();
     $this->initScreen();
     if ((int) $this->width === 0 || (int) $this->height === 0) {
         // auto-detect required height & width based on text
         $this->width = $this->height = 0;
         $text = str_replace("\n", "|", $this->text);
         // decode any linebreaks
         $lines = explode("|", $text);
         foreach ($lines as $line) {
             $len = strlen($line);
             if ($len > $this->width) {
                 $this->width = $len;
             }
             $this->height++;
         }
     }
     // open a dialog box window
     $width = max([$this->width, $this->minWidth]);
     $cord = $this->getCoordinates($this->height, $width, self::COORD_X_CENTER, self::COORD_Y_MIDDLE);
     $this->nwin = $this->createDialogWindow($cord['y'], $cord['x'], $this->height + 2, $width, true, 2);
     $this->strokePara($this->nwin, $this->text, $this->height, $width, 'center', false);
     ncurses_wrefresh($this->nwin);
 }
开发者ID:vsychov,项目名称:php_ncurses,代码行数:25,代码来源:NcursesNotice.php

示例2: __construct

 public function __construct(EventLoop $loop = null)
 {
     if ($loop === null) {
         $loop = \Kurses\EventLoopFactory::select();
     }
     $this->loop = $loop;
     ncurses_init();
     ncurses_cbreak();
     ncurses_noecho();
     $this->panels = [];
     if (ncurses_has_colors()) {
         ncurses_start_color();
         ncurses_init_pair(1, NCURSES_COLOR_RED, NCURSES_COLOR_BLACK);
     }
     $this->cursor = new Cursor(null, null, false);
     $this->screen = new Screen();
     $onKeyboardEvent = function (KeyboardEvent $keyboardEvent) {
         $this->handleKeyboardEvent($keyboardEvent);
     };
     $onMouseEvent = function (MouseEvent $mouseEvent) {
         $this->handleMouseEvent($mouseEvent);
     };
     $refreshScreen = function () {
         $this->refreshScreen();
     };
     $this->keyboard = new Keyboard($onKeyboardEvent);
     $this->mouse = new Mouse($onMouseEvent);
     $this->loop->every($refreshScreen, 200);
     stream_set_blocking(STDIN, FALSE);
     $this->loop->attachStreamHandler(STDIN, function () {
         $this->handleStdIn();
     });
 }
开发者ID:ck99,项目名称:kurses,代码行数:33,代码来源:Application.php

示例3: __construct

 /**
  * Create a new NCurses based VMOutput.
  *
  * @param $vm VM to display.
  */
 function __construct($vm)
 {
     parent::__construct($vm);
     // Init Display
     $ths->nc = ncurses_init();
     $this->refreshAll();
     $this->update();
 }
开发者ID:ShaneMcC,项目名称:synacor-challenge,代码行数:13,代码来源:VMOutput_ncurses.php

示例4: __construct

 public function __construct()
 {
     parent::__construct();
     $this->setFormatter(new OutputFormatter());
     ncurses_init();
     //ncurses_mvaddstr(55,1,"My first ncurses application");
     $this->window = ncurses_newwin(40, 30, 0, 0);
     ncurses_wborder($this->window, 0, 0, 0, 0, 0, 0, 0, 0);
 }
开发者ID:jean-pasqualini,项目名称:ia,代码行数:9,代码来源:NCursesOutput.php

示例5: __construct

 public function __construct($prompt)
 {
     ncurses_init();
     // Create a full-screen window
     $this->window = ncurses_newwin(0, 0, 0, 0);
     $this->prompt = $prompt;
     // Disable echoing the characters without our control
     ncurses_noecho();
     $this->drawPrompt();
 }
开发者ID:swos-,项目名称:ncurses,代码行数:10,代码来源:example2.php

示例6: __construct

 public function __construct(Linfo $linfo)
 {
     $this->linfo = $linfo;
     // We obviously need this
     if (!extension_loaded('ncurses')) {
         $this->loaded = false;
         throw new LinfoFatalException('ncurses extension not loaded');
     }
     // Start ncurses
     ncurses_init();
     ncurses_timeout(0);
 }
开发者ID:ChristophWurst,项目名称:pimcore,代码行数:12,代码来源:class.LinfoNcurses.php

示例7: __construct

 public function __construct($rows, $cols, $x, $y)
 {
     if (!static::$init) {
         static::$nCurse = ncurses_init();
         ncurses_refresh();
     }
     static::$nCount++;
     $this->resource = ncurses_newwin($rows, $cols, $x, $y);
     $this->reset();
     ncurses_wborder($this->resource, 0, 0, 0, 0, 0, 0, 0, 0);
     ncurses_wrefresh($this->resource);
 }
开发者ID:EsterniTY,项目名称:dfl860e-logger,代码行数:12,代码来源:ncurse.php

示例8: __construct

 public function __construct()
 {
     // We obviously need this
     if (!extension_loaded('ncurses')) {
         echo "ncurses extension not loaded\n";
         $this->loaded = false;
         exit(1);
     }
     // Start ncurses
     ncurses_init();
     ncurses_timeout(0);
 }
开发者ID:impelling,项目名称:VegaDNS,代码行数:12,代码来源:class.out_ncurses.php

示例9: __construct

 /**
  *
  */
 function __construct()
 {
     ncurses_init();
     if (ncurses_has_colors()) {
         ncurses_start_color();
         ncurses_init_pair(NCC_FRAME, NCURSES_COLOR_BLACK, NCURSES_COLOR_BLUE);
         ncurses_init_pair(NCC_TEXT, NCURSES_COLOR_WHITE, NCURSES_COLOR_BLUE);
         ncurses_init_pair(NCC_TITLE, NCURSES_COLOR_YELLOW, NCURSES_COLOR_BLUE);
         ncurses_init_pair(NCC_MORE, NCURSES_COLOR_WHITE, NCURSES_COLOR_BLUE);
         ncurses_curs_set(0);
     }
     $this->workspace = ncurses_newwin(0, 0, 0, 0);
 }
开发者ID:noccy80,项目名称:lepton-ng,代码行数:16,代码来源:application.php

示例10: __construct

 public function __construct(Linfo $linfo)
 {
     $this->linfo = $linfo;
     // We obviously need this
     if (!extension_loaded('ncurses')) {
         $this->loaded = false;
         throw new FatalException("PHP ncurses extension not loaded.\nRefer to http://php.net/manual/en/ncurses.installation.php for details.");
     }
     // Start ncurses
     ncurses_init();
     ncurses_start_color();
     ncurses_init_pair(1, NCURSES_COLOR_YELLOW, NCURSES_COLOR_BLUE);
     ncurses_timeout(0);
 }
开发者ID:Ermile,项目名称:Saloos-Addons,代码行数:14,代码来源:Ncurses.php

示例11: init

 public function init($title = 'AcePHProxy')
 {
     // начинаем с инициализации библиотеки
     $ncurse = ncurses_init();
     // используем весь экран
     $this->windows['main'] = ncurses_newwin(0, 0, 0, 0);
     // рисуем рамку вокруг окна
     ncurses_border(0, 0, 0, 0, 0, 0, 0, 0);
     ncurses_getmaxyx($this->windows['main'], $y, $x);
     // save current main window size
     $this->cur_x = $x;
     $this->cur_y = $y;
     // создаём второе окно для лога
     $rows = floor($y / 2);
     $cols = $x;
     $sy = $y - $rows;
     $sx = 0;
     $this->windows['log'] = ncurses_newwin($rows, $cols, $sy, $sx);
     // и окно для статистики (остальное пространство)
     $rows = $y - $rows - 1;
     $cols = $x;
     $sy = 1;
     $sx = 0;
     // еще -1 чтобы границы не перекрывались
     $this->windows['stat'] = ncurses_newwin($rows, $cols, $sy, $sx);
     if (ncurses_has_colors()) {
         ncurses_start_color();
         // colors http://php.net/manual/en/ncurses.colorconsts.php
         ncurses_init_pair(self::CLR_ERROR, NCURSES_COLOR_RED, NCURSES_COLOR_BLACK);
         ncurses_init_pair(self::CLR_GREEN, NCURSES_COLOR_GREEN, NCURSES_COLOR_BLACK);
         ncurses_init_pair(self::CLR_YELLOW, NCURSES_COLOR_YELLOW, NCURSES_COLOR_BLACK);
         ncurses_init_pair(self::CLR_SPEC1, NCURSES_COLOR_RED, NCURSES_COLOR_WHITE);
         ncurses_init_pair(5, NCURSES_COLOR_MAGENTA, NCURSES_COLOR_BLACK);
         ncurses_init_pair(6, NCURSES_COLOR_CYAN, NCURSES_COLOR_BLACK);
         ncurses_init_pair(self::CLR_DEFAULT, NCURSES_COLOR_WHITE, NCURSES_COLOR_BLACK);
         $this->log('Init colors', self::CLR_GREEN);
     }
     // рамка для него
     ncurses_wborder($this->windows['log'], 0, 0, 0, 0, 0, 0, 0, 0);
     ncurses_wborder($this->windows['stat'], 0, 0, 0, 0, 0, 0, 0, 0);
     $this->outputTitle($title);
     ncurses_nl();
     ncurses_curs_set(0);
     // visibility
     ncurses_refresh();
     // рисуем окна
     // обновляем маленькое окно для вывода строки
     ncurses_wrefresh($this->windows['log']);
 }
开发者ID:svgorbunov,项目名称:AcePHProxy,代码行数:49,代码来源:class.ncurses_ui.php

示例12: __construct

 public function __construct()
 {
     $this->nc = ncurses_init();
     if (!ncurses_has_colors()) {
         $this->onTerminate();
         echo "No color support.\n";
     }
     ncurses_start_color();
     $this->screen = ncurses_newwin(0, 0, 0, 0);
     $this->setCursorVisible(false);
     assert($this->screen);
     ncurses_init_pair(Widget\Widget::COLOR_DIALOGBG, NCURSES_COLOR_YELLOW, NCURSES_COLOR_BLUE);
     ncurses_init_pair(Widget\Widget::COLOR_DIALOGTEXT, NCURSES_COLOR_WHITE, NCURSES_COLOR_BLUE);
     ncurses_refresh();
 }
开发者ID:noccy80,项目名称:cherryphp,代码行数:15,代码来源:context.php

示例13: __construct

 public function __construct(EventLoop $loop)
 {
     $this->loop = $loop;
     ncurses_init();
     ncurses_cbreak();
     ncurses_noecho();
     $this->panels = [];
     if (ncurses_has_colors()) {
         ncurses_start_color();
     }
     $this->cursor = new Cursor(null, null, false);
     $this->loop->every([$this, 'refresh'], 200);
     stream_set_blocking(STDIN, FALSE);
     $this->loop->attachStreamHandler(STDIN, [$this, 'handleStdIn']);
 }
开发者ID:ck99,项目名称:kurses,代码行数:15,代码来源:Screen.php

示例14: __construct

 public function __construct()
 {
     $ncurse = ncurses_init();
     $this->fullscreen = ncurses_newwin(0, 0, 0, 0);
     ncurses_noecho();
     ncurses_border(0, 0, 0, 0, 0, 0, 0, 0);
     $this->small = ncurses_newwin(10, 30, 7, 25);
     ncurses_wborder($this->small, 0, 0, 0, 0, 0, 0, 0, 0);
     ncurses_refresh();
     ncurses_attron(NCURSES_A_REVERSE);
     ncurses_mvaddstr(0, 10, "---Sample Title---");
     ncurses_attroff(NCURSES_A_REVERSE);
     ncurses_mvwaddstr($this->small, 5, 5, "Initial screen");
     ncurses_wrefresh($this->small);
 }
开发者ID:swos-,项目名称:ncurses,代码行数:15,代码来源:Ncurses.php

示例15: InitialiseTerminal

 public function InitialiseTerminal()
 {
     $this->ncursesess = ncurses_init();
     ncurses_noecho();
     // turn off echo to screen
     ncurses_start_color();
     // initialise colour
     //ncurses_cbreak(); // turn off buffering
     ncurses_curs_set(0);
     /*
      * Initialise the colour pairs that we'll use. First param is a define so we don't have to use
      * magic numbers all through the app.
      */
     ncurses_init_pair(NC_PAIR_IRCOUT, NCURSES_COLOR_WHITE, NCURSES_COLOR_BLACK);
     ncurses_init_pair(NC_PAIR_INPUT, NCURSES_COLOR_WHITE, NCURSES_COLOR_BLUE);
     ncurses_init_pair(NC_PAIR_INPUT_ACTIVE, NCURSES_COLOR_RED, NCURSES_COLOR_BLUE);
 }
开发者ID:rburchell,项目名称:ircc,代码行数:17,代码来源:ncurse.class.php


注:本文中的ncurses_init函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。