removed function ungetchString

This commit is contained in:
R. Eric Wheeler 2021-03-01 10:48:18 -08:00
parent aa72be226d
commit 2ed1abf0fc
2 changed files with 2 additions and 26 deletions

View File

@ -31,12 +31,3 @@ if (!function_exists('ungetch')) {
return $g->ungetch($char); return $g->ungetch($char);
} }
} }
if (!function_exists('ungetchString')) {
function ungetchString(string $string, string $linuxLibrary = null): bool
{
$g = new Getch($linuxLibrary);
return $g->ungetchString($string);
}
}

View File

@ -88,8 +88,8 @@ final class Getch
public function peek(): int public function peek(): int
{ {
if(PHP_OS_FAMILY === 'Windows') { if (PHP_OS_FAMILY === 'Windows') {
if($ffi->_kbhit()) { if ($ffi->_kbhit()) {
$result = $ffi->_getch(); $result = $ffi->_getch();
$ffi->_ungetch($result); $ffi->_ungetch($result);
return $result; return $result;
@ -98,21 +98,6 @@ final class Getch
} }
return $ffi->cinPeek(); return $ffi->cinPeek();
} }
/* public function keyCode(string $device): array
{
$arrayType = \FFI::arrayType(self::$ffi->type('int'), [3]);
$res = \FFI::new($arrayType);
$arrayType = self::$ffi->keyCode($device);
return [
'type' => $arrayType[0],
'code' => $arrayType[1],
'value' => $arrayType[2],
'keyCode' => $arrayType[3],
];
}*/
public function getch(): int public function getch(): int
{ {