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


PHP ncurses_newwin函数代码示例

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


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

示例1: init

 /**
  * Initiate our NCurses panels.
  */
 private function init()
 {
     // Get Sizes
     $top = $right = $bottom = $left = 0;
     ncurses_getmaxyx(STDSCR, $bottom, $right);
     $this->lastBottom = $bottom;
     $this->lastRight = $right;
     // Panel Layouts
     $traceWidth = min($right / 2, 55);
     $traceHeight = $bottom;
     $debugWidth = $right - $traceWidth;
     $debugHeight = 8;
     $inputWidth = $debugWidth;
     $inputHeight = 3;
     $outputWidth = $debugWidth;
     $outputHeight = $bottom - $debugHeight - $inputHeight;
     $this->panels['trace'] = ncurses_newwin($traceHeight, $traceWidth, $top, $right - $traceWidth);
     ncurses_wborder($this->panels['trace'], 0, 0, 0, 0, 0, 0, 0, 0);
     ncurses_mvwaddstr($this->panels['trace'], 0, 2, "[ Logging ]");
     ncurses_wmove($this->panels['trace'], 2, 2);
     $this->panels['debug'] = ncurses_newwin($debugHeight, $debugWidth, $bottom - $debugHeight, $left);
     $this->panels['input'] = ncurses_newwin($inputHeight, $inputWidth, $bottom - $debugHeight - $inputHeight, $left);
     $this->panels['output'] = ncurses_newwin($outputHeight, $outputWidth, $top, $left);
     ncurses_wborder($this->panels['output'], 0, 0, 0, 0, 0, 0, 0, 0);
     ncurses_mvwaddstr($this->panels['output'], 0, 2, "[ Output ]");
     ncurses_wmove($this->panels['output'], 2, 2);
     ncurses_curs_set(0);
     ncurses_cbreak();
     ncurses_noecho();
     $this->redrawAll();
 }
开发者ID:ShaneMcC,项目名称:synacor-challenge,代码行数:34,代码来源:VMOutput_ncurses.php

示例2: __construct

 /**
  * Create window
  *
  * @param int $rows
  * @param int $cols
  * @param int $y
  * @param int $x
  * @return void
  */
 public function __construct($rows = 0, $cols = 0, $y = 0, $x = 0)
 {
     $this->window = ncurses_newwin($rows, $cols, $y, $x);
     $this->cols = $this->getMaxX();
     $this->rows = $this->getMaxY();
     $this->x = $x;
     $this->y = $y;
     $this->maxLines = $this->getMaxY() - $y - 2;
 }
开发者ID:ck99,项目名称:kurses,代码行数:18,代码来源:Window.php

示例3: __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

示例4: ncurses_show_screen

function ncurses_show_screen($showHelp)
{
    // basic settings
    ncurses_noecho();
    ncurses_curs_set(0);
    // set app title
    $title = "Red Ventures Selenium Runner";
    // commands to be listed in help
    $commands = array('q' => 'quit', 'r' => 'run selected tests', 'space' => 'toggle test selection', 'enter' => 'run highlighted tests', 'up' => 'move up', 'down' => 'move down', 'pgUp' => 'scroll description up', 'pgDown' => 'scroll description down', '?/h' => 'show this help panel');
    // create a fullscreen window
    $fullscreen = ncurses_newwin(0, 0, 0, 0);
    ncurses_getmaxyx($fullscreen, $max_y, $max_x);
    // enter the main event loop
    $do_loop = 1;
    while ($do_loop) {
        // calculate width of help window columns
        $c = $t = 0;
        foreach ($commands as $cmd => $txt) {
            $c = strlen($cmd) > $c ? strlen($cmd) : $c;
            $t = strlen($txt) > $t ? strlen($txt) : $t;
        }
        $h = count($commands);
        // calculate the help windows height
        if ($showHelp) {
            if (!empty($helpWin)) {
                ncurses_delwin($helpWin);
            }
            $helpWin = ncurses_newwin($h + 4, $c + $t + 5, ($max_y - $h - 4) / 2, ($max_x - $c - $t - 5) / 2);
            ncurses_wborder($helpWin, 0, 0, 0, 0, 0, 0, 0, 0);
            $i = 0;
            foreach ($commands as $cmd => $txt) {
                ncurses_mvwaddstr($helpWin, 2 + $i, 2, $cmd);
                ncurses_mvwaddstr($helpWin, 2 + $i, 2 + $c + 1, $txt);
            }
            if (!empty($helpWin)) {
                ncurses_wrefresh($helpWin);
            } else {
                ncurses_refresh();
            }
        }
        if (empty($helpWin)) {
            $key = ncurses_getch();
        } else {
            $key = ncurses_wgetch($helpWin);
        }
        switch ($key) {
            case 27:
                ncurses_flushinp();
                $do_loop = 0;
                break;
            default:
                $showHelp = $showHelp === true ? false : true;
                ncurses_show_screen($showHelp);
        }
    }
}
开发者ID:jean-pasqualini,项目名称:ia,代码行数:56,代码来源:test.php

示例5: getWindow

 public function getWindow()
 {
     if (!$this->window) {
         $this->window = ncurses_newwin(0, 0, 0, 0);
         ncurses_getmaxyx($this->window, $y, $x);
         $this->rows = $y;
         $this->cols = $x;
     }
     return $this->window;
 }
开发者ID:ck99,项目名称:kurses,代码行数:10,代码来源:Screen.php

示例6: __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

示例7: __construct

 /**
  * Create a window
  *
  * @param int $columns
  * @param int $rows
  * @param int $x
  * @param int $y
  */
 public function __construct($columns = 0, $rows = 0, $x = 0, $y = 0)
 {
     $this->x = $x;
     $this->y = $y;
     $this->windowResource = ncurses_newwin($rows, $columns, $y, $x);
     if ($rows == 0 || $columns == 0) {
         $this->getSize($columns, $rows);
     }
     $this->columns = $columns;
     $this->rows = $rows;
 }
开发者ID:wapmorgan,项目名称:ncursesobjects,代码行数:19,代码来源:Window.php

示例8: __construct

 /**
  *
  */
 function __construct($x, $y, $w, $h, $title, $text)
 {
     $this->_x = $x;
     $this->_y = $y;
     $this->_w = $w;
     $this->_h = $h;
     $this->_title = $title;
     $this->_text = $text;
     $this->_wh = ncurses_newwin($this->_h, $this->_w, $this->_y, $this->_x);
     Console::debug("Created window with handle %xd", $this->_wh);
 }
开发者ID:noccy80,项目名称:lepton-ng,代码行数:14,代码来源:dialog.php

示例9: __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

示例10: __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

示例11: onCreate

 public function onCreate()
 {
     list($w, $h) = $this->onMeasure();
     $ctx = Context::getInstance();
     list($dw, $dh) = $ctx->getDimensions();
     \debug("Dialog::onCreate() measured to %dx%d", $w, $h);
     \debug("Dialog::onCreate() display size is %dx%d", $dw, $h);
     $this->setPosition(($dw - $w) / 2, ($dh - $h) / 2);
     $this->setSize($w, $h);
     list($x, $y) = $this->getPosition();
     list($w, $h) = $this->getSize();
     $this->window = \ncurses_newwin($h, $w, $y, $x);
     parent::onCreate();
 }
开发者ID:noccy80,项目名称:cherryphp,代码行数:14,代码来源:dialog.php

示例12: wnd

 protected function wnd($renew = false)
 {
     if ($renew) {
         if ($this->window) {
             ncurses_delwin($this->window);
         }
         $this->window = null;
     }
     if (!$this->window) {
         $this->window = ncurses_newwin($this->height, $this->width, $this->top, $this->left);
         \Cherry\debug('New window: %dx%d+%d+%d', $this->left, $this->top, $this->width, $this->height);
     }
     return $this->window;
 }
开发者ID:noccy80,项目名称:cherryphp,代码行数:14,代码来源:widget.php

示例13: 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

示例14: __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

示例15: __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


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