• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP ncurses_init函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: display

 /**
  * @return bool
  */
 public function display()
 {
     ncurses_init();
     $this->initScreen();
     //open a dialog box window
     $cord = $this->getCoordinates($this->height, $this->width, self::COORD_X_CENTER, self::COORD_Y_MIDDLE);
     $win = $this->createDialogWindow($cord['y'], $cord['x'], $this->height, $this->width, true);
     //output dialog text
     $this->strokePara($win, $this->text, $this->height, $this->width, 'center', true);
     //ok button
     $this->configureButtons();
     //wait for input
     do {
         $this->strokeAllButtons($win);
         ncurses_wrefresh($win);
         //get keyboard input
         $status = $this->getButtonInput($win);
     } while ($status === null);
     return true;
 }
开发者ID:vsychov,项目名称:php_ncurses,代码行数:23,代码来源:NcursesMsgbox.php


示例17: openCLI

 public function openCLI($title = NULL)
 {
     // 1. initiate ncurses
     ncurses_init();
     // Create a full-screen window
     $this->window = ncurses_newwin(0, 0, 0, 0);
     // Disable echoing the characters without our control
     ncurses_noecho();
     // let ncurses know we wish to use the whole screen
     $screen = ncurses_newwin(0, 0, 0, 0);
     // get screen size
     ncurses_getmaxyx($screen, $this->rows, $this->cols);
     // draw a border around the whole thing.
     ncurses_border(0, 0, 0, 0, 0, 0, 0, 0);
     // set the application title
     if (!is_null($title)) {
         ncurses_mvaddstr(0, 2, " " . $title . " ");
     }
     // paint window
     ncurses_refresh();
 }
开发者ID:MaloufSleep,项目名称:obray,代码行数:21,代码来源:oCLI.php


示例18: display

 /**
  * @return mixed
  */
 public function display()
 {
     ncurses_init();
     $this->initScreen();
     // open a dialog box window
     $cord = $this->getCoordinates($this->height, $this->width, self::COORD_X_CENTER, self::COORD_Y_MIDDLE);
     $win = $this->createDialogWindow($cord['y'], $cord['x'], $this->height, $this->width, true);
     // Create menu sub-window
     // Controls alignment of menu title
     $para_offset_y = $this->strokePara($win, $this->text, $this->height, $this->width, 'center', true);
     $cord_x = $this->inputIndentation;
     //ORIGINAL CODE CENTERED INPUT FIELDS.
     //$para_offset_y = $this->_stroke_para($win,$this->text,$this->height,$this->width,"center",true);
     //$cord_x = round(($this->width/2) - ($this->length/2) );
     foreach ($this->fields as $key => $val) {
         $cord_y = $para_offset_y + $key * 2;
         // output dialog text
         $this->addInputBox($win, $this->fields[$key]['name'], $this->fields[$key]['label'], $cord_y, $cord_x, $this->fields[$key]['length'], $this->fields[$key]['value']);
     }
     // configure buttons
     $this->configureButtons();
     // wait for input
     do {
         $this->strokeAllButtons($win);
         //THIS IS WHERE THE INPUT BOXES ARE POSITIONED
         $this->strokeInputBoxes($win);
         ncurses_wrefresh($win);
         // get keyboard input
         if ($this->focusCat() === 'B') {
             $status = $this->getButtonInput($win);
         } else {
             $status = $this->getTextboxInput($win);
         }
     } while ($status === null);
     if (isset($status['val'])) {
         $status = $status['val'];
     }
     return $status;
 }
开发者ID:vsychov,项目名称:php_ncurses,代码行数:42,代码来源:NcursesInputBox.php


示例19: display

 /**
  * @return mixed
  */
 public function display()
 {
     ncurses_init();
     $this->initScreen();
     // open a dialog box window
     $cord = $this->getCoordinates($this->getHeight(), $this->getWidth(), self::COORD_X_CENTER, self::COORD_Y_MIDDLE);
     $mainWindow = $this->createDialogWindow($cord['y'], $cord['x'], $this->getHeight(), $this->getWidth(), true);
     // output dialog text
     $paraOffsetY = $this->strokePara($mainWindow, $this->getText(), $this->getHeight(), $this->getWidth(), 'center', true);
     // Create menu sub-window
     $menuSubWindow = $this->createMenuSubWindow($mainWindow, $this->getHeight(), $this->getWidth(), $paraOffsetY);
     $this->configureButtons();
     // wait for input
     do {
         $this->strokeAllButtons($mainWindow);
         $this->strokeAllMenuItems($menuSubWindow);
         ncurses_wrefresh($mainWindow);
         ncurses_wrefresh($menuSubWindow);
         //get keyboard input
         $status = $this->getMenuInput($mainWindow);
     } while ($status === null);
     return $status;
 }
开发者ID:vsychov,项目名称:php_ncurses,代码行数:26,代码来源:NcursesChecklist.php


示例20: __construct

 function __construct()
 {
     if (!self::$cwt) {
         self::$cwt = $this;
     }
     $this->buffer = new \Data\FifoQueue(50);
     if (!function_exists('\\ncurses_init')) {
         die("This application requires ncurses to work.");
     }
     \ncurses_init();
     if (ncurses_has_colors()) {
         $this->initColors();
     }
     ncurses_curs_set(0);
     ncurses_noecho();
     ncurses_mousemask(NCURSES_ALL_MOUSE_EVENTS);
     $oldmask = null;
     $newmask = NCURSES_BUTTON1_CLICKED | NCURSES_BUTTON1_RELEASED | NCURSES_BUTTON1_PRESSED | NCURSES_BUTTON2_CLICKED | NCURSES_BUTTON2_RELEASED | NCURSES_BUTTON1_PRESSED | NCURSES_BUTTON3_CLICKED | NCURSES_BUTTON3_RELEASED | NCURSES_BUTTON1_PRESSED | NCURSES_BUTTON4_CLICKED | NCURSES_BUTTON4_RELEASED | NCURSES_BUTTON1_PRESSED;
     $mask = ncurses_mousemask($newmask, $oldmask);
     $this->fpin = fopen("php://stdin", "r");
     //open direct input stream for reading
     stream_set_blocking($this->fpin, 0);
     //set non-blocking mode
 }
开发者ID:noccy80,项目名称:cherryphp,代码行数:24,代码来源:cwt.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP ncurses_mvwaddstr函数代码示例发布时间:2022-05-15
下一篇:
PHP ncurses_getmaxyx函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap