Exemplo n.º 1
0
def _pycall_path_dest_only(x1: int, y1: int, x2: int, y2: int,
                           handle: Any) -> float:
    """A TDL function which samples the dest coordinate only."""
    return ffi.from_handle(handle)(x2, y2)  # type: ignore
Exemplo n.º 2
0
def _pycall_path_swap_src_dest(x1: int, y1: int, x2: int, y2: int,
                               handle: Any) -> float:
    """A TDL function dest comes first to match up with a dest only call."""
    return ffi.from_handle(handle)(x2, y2, x1, y1)  # type: ignore
Exemplo n.º 3
0
def _pycall_path_old(x1: int, y1: int, x2: int, y2: int, handle: Any) -> float:
    """libtcodpy style callback, needs to preserve the old userData issue."""
    func, userData = ffi.from_handle(handle)
    return func(x1, y1, x2, y2, userData)  # type: ignore
Exemplo n.º 4
0
def _pycall_path_simple(x1: int, y1: int, x2: int, y2: int,
                        handle: Any) -> float:
    """Does less and should run faster, just calls the handle function."""
    return ffi.from_handle(handle)(x1, y1, x2, y2)  # type: ignore
Exemplo n.º 5
0
def _pycall_cli_output(catch_reference: Any, output: Any) -> None:
    """Callback for the libtcod context CLI.  Catches the CLI output."""
    catch = ffi.from_handle(catch_reference)  # type: List[str]
    catch.append(ffi.string(output).decode("utf-8"))