示例#1
0
文件: Mouse.php 项目: ck99/kurses
 function __construct(callable $eventCallback)
 {
     ncurses_mousemask(NCURSES_ALL_MOUSE_EVENTS, $oldMask);
     if (!is_callable($eventCallback)) {
         throw new \Exception("Mouse handler cannot be constructed without a valid callback");
     }
     $this->callback = $eventCallback;
 }
示例#2
0
 public function __construct()
 {
     self::$instance = $this;
     ncurses_init();
     // Get access to the mouose events
     $newmask = NCURSES_ALL_MOUSE_EVENTS;
     $oldmask = null;
     $mask = ncurses_mousemask($newmask, $oldmask);
     // Create a new desktop
     $this->desktop = new NcursesDesktop();
     // Hide cursor
     ncurses_curs_set(0);
 }
示例#3
0
文件: cwt.php 项目: noccy80/cherryphp
 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
 }