public function runDesktop() { c::set("cwt:messagequeue", new FifoQueue()); $running = true; while ($running) { $this->cwtDesktop->onTick(); $this->cwtDesktop->onDraw(); $time = date(\DateTime::RFC822); \Cherry\Expm\Cwt\Context::getInstance()->textAt(2, 2, "Hello World! {$time}"); ncurses_refresh(); \usleep(10000); } }
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(); }
public function onCreate() { $this->setPosition(0, 0); list($w, $h) = Context::getInstance()->getDimensions(); $this->setSize($w, $h); }