_kbhit()) { $result = self::$ffi->_getch(); self::$ffi->_ungetch($result); return $result; } return -1; } return self::$ffi->cinPeek(); } public function getch(): int { return self::$ffi->_getch(); } public function ungetch(string|int $char): int { if (is_string($char)) { $char = ord($char[0]); } return self::$ffi->_ungetch($char); } }