function _configBaseQuery() { $args = func_get_args(); if (count($args) == 1) { return _configBaseGet($args[0]); } _configBaseSet($args[0], $args[1]); }
function _screenHandleShowGridChar() { $ch = _gridBaseGetChar(_configBaseGet("cursorx") - 1, _configBaseGet("cursory") - 1); print $ch; $cy = _cursorBaseGetY(); $cx = _cursorBaseGetX(); system("tput cup {$cy} {$cx}"); }
function _clockBaseTrigger($key) { $rate = "{$key}Rate"; $last = "{$key}Last"; if (_configBaseGet($rate) === NULL) { return false; } if (_configBaseGet($last) === NULL) { _configBaseSet($last, _configBaseGet("apptime") + _configBaseGet($rate)); return false; } if (_configBaseGet("apptime") > _configBaseGet($last)) { _configBaseSet($last, _configBaseGet("apptime") + _configBaseGet($rate)); return true; } return false; }
function _keyboardBaseHandleMovement() { $byte = _keyboardBasePullInput(); if (chr($byte) == 'j') { if (_configBaseGet("cursorx") > 1) { _cursorBaseLeft(); } return true; } if (chr($byte) == 'k') { if (_configBaseGet("cursorx") < _configBaseGet("screenwidth") - 2) { _cursorBaseRight(); } return true; } if (chr($byte) == 'd') { if (_configBaseGet("cursory") > 1) { _cursorBaseUp(); } return true; } if (chr($byte) == 'f') { if (_configBaseGet("cursory") < _configBaseGet("screenheight") - 2) { _cursorBaseDown(); } return true; } _keyboardBasePushInput($byte); return false; }
function _screenBaseDebug() { print _configBaseGet("screenwidth") . " x " . _configBaseGet("screenheight"); }
function _appBaseLoop() { _appBaseSetFrame(_appBaseGetFrame() + 1); _appHandleInput(); _clockBaseSetAppTime(); _screenBaseUpdate(); _cursorBaseUpdate(); _appBaseSave(); usleep(_configBaseGet("appsleepdelay")); if (_keyboardBaseHandleQuit() && _appBaseGetMode() == "command") { return false; } return true; }
function _cursorBaseLoadFromConfig() { $config = _configBaseGet("config"); //_logBaseWrite($config); if (isset($config['cursor'])) { _configBaseSet("cursorx", $config['cursor']['x']); _configBaseSet("cursory", $config['cursor']['y']); } }
function _gridBaseSample() { $grid = _configBaseGet("grid"); $gx = 1; $gy = 2; $str = date('l jS \\of F Y h:i:s A'); $strLen = strlen($str); for ($i = 0; $i < $strLen; $i++) { $grid[$gx + $i][$gy] = ord($str[$i]); } //_logBaseWrite($grid[$gx]);exit; _configBaseSet("grid", $grid); }