id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
9,200
libtcod/python-tcod
tcod/libtcodpy.py
console_fill_char
def console_fill_char(con: tcod.console.Console, arr: Sequence[int]) -> None: """Fill the character tiles of a console with an array. `arr` is an array of integers with a length of the consoles width and height. .. deprecated:: 8.4 You should assign to :any:`tcod.console.Console.ch` instead. ...
python
def console_fill_char(con: tcod.console.Console, arr: Sequence[int]) -> None: """Fill the character tiles of a console with an array. `arr` is an array of integers with a length of the consoles width and height. .. deprecated:: 8.4 You should assign to :any:`tcod.console.Console.ch` instead. ...
[ "def", "console_fill_char", "(", "con", ":", "tcod", ".", "console", ".", "Console", ",", "arr", ":", "Sequence", "[", "int", "]", ")", "->", "None", ":", "if", "isinstance", "(", "arr", ",", "np", ".", "ndarray", ")", ":", "# numpy arrays, use numpy's c...
Fill the character tiles of a console with an array. `arr` is an array of integers with a length of the consoles width and height. .. deprecated:: 8.4 You should assign to :any:`tcod.console.Console.ch` instead.
[ "Fill", "the", "character", "tiles", "of", "a", "console", "with", "an", "array", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1857-L1874
9,201
libtcod/python-tcod
tcod/libtcodpy.py
console_load_asc
def console_load_asc(con: tcod.console.Console, filename: str) -> bool: """Update a console from a non-delimited ASCII `.asc` file.""" return bool( lib.TCOD_console_load_asc(_console(con), filename.encode("utf-8")) )
python
def console_load_asc(con: tcod.console.Console, filename: str) -> bool: """Update a console from a non-delimited ASCII `.asc` file.""" return bool( lib.TCOD_console_load_asc(_console(con), filename.encode("utf-8")) )
[ "def", "console_load_asc", "(", "con", ":", "tcod", ".", "console", ".", "Console", ",", "filename", ":", "str", ")", "->", "bool", ":", "return", "bool", "(", "lib", ".", "TCOD_console_load_asc", "(", "_console", "(", "con", ")", ",", "filename", ".", ...
Update a console from a non-delimited ASCII `.asc` file.
[ "Update", "a", "console", "from", "a", "non", "-", "delimited", "ASCII", ".", "asc", "file", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1878-L1882
9,202
libtcod/python-tcod
tcod/libtcodpy.py
console_save_asc
def console_save_asc(con: tcod.console.Console, filename: str) -> bool: """Save a console to a non-delimited ASCII `.asc` file.""" return bool( lib.TCOD_console_save_asc(_console(con), filename.encode("utf-8")) )
python
def console_save_asc(con: tcod.console.Console, filename: str) -> bool: """Save a console to a non-delimited ASCII `.asc` file.""" return bool( lib.TCOD_console_save_asc(_console(con), filename.encode("utf-8")) )
[ "def", "console_save_asc", "(", "con", ":", "tcod", ".", "console", ".", "Console", ",", "filename", ":", "str", ")", "->", "bool", ":", "return", "bool", "(", "lib", ".", "TCOD_console_save_asc", "(", "_console", "(", "con", ")", ",", "filename", ".", ...
Save a console to a non-delimited ASCII `.asc` file.
[ "Save", "a", "console", "to", "a", "non", "-", "delimited", "ASCII", ".", "asc", "file", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1886-L1890
9,203
libtcod/python-tcod
tcod/libtcodpy.py
console_load_apf
def console_load_apf(con: tcod.console.Console, filename: str) -> bool: """Update a console from an ASCII Paint `.apf` file.""" return bool( lib.TCOD_console_load_apf(_console(con), filename.encode("utf-8")) )
python
def console_load_apf(con: tcod.console.Console, filename: str) -> bool: """Update a console from an ASCII Paint `.apf` file.""" return bool( lib.TCOD_console_load_apf(_console(con), filename.encode("utf-8")) )
[ "def", "console_load_apf", "(", "con", ":", "tcod", ".", "console", ".", "Console", ",", "filename", ":", "str", ")", "->", "bool", ":", "return", "bool", "(", "lib", ".", "TCOD_console_load_apf", "(", "_console", "(", "con", ")", ",", "filename", ".", ...
Update a console from an ASCII Paint `.apf` file.
[ "Update", "a", "console", "from", "an", "ASCII", "Paint", ".", "apf", "file", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1894-L1898
9,204
libtcod/python-tcod
tcod/libtcodpy.py
console_save_apf
def console_save_apf(con: tcod.console.Console, filename: str) -> bool: """Save a console to an ASCII Paint `.apf` file.""" return bool( lib.TCOD_console_save_apf(_console(con), filename.encode("utf-8")) )
python
def console_save_apf(con: tcod.console.Console, filename: str) -> bool: """Save a console to an ASCII Paint `.apf` file.""" return bool( lib.TCOD_console_save_apf(_console(con), filename.encode("utf-8")) )
[ "def", "console_save_apf", "(", "con", ":", "tcod", ".", "console", ".", "Console", ",", "filename", ":", "str", ")", "->", "bool", ":", "return", "bool", "(", "lib", ".", "TCOD_console_save_apf", "(", "_console", "(", "con", ")", ",", "filename", ".", ...
Save a console to an ASCII Paint `.apf` file.
[ "Save", "a", "console", "to", "an", "ASCII", "Paint", ".", "apf", "file", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1902-L1906
9,205
libtcod/python-tcod
tcod/libtcodpy.py
console_load_xp
def console_load_xp(con: tcod.console.Console, filename: str) -> bool: """Update a console from a REXPaint `.xp` file.""" return bool( lib.TCOD_console_load_xp(_console(con), filename.encode("utf-8")) )
python
def console_load_xp(con: tcod.console.Console, filename: str) -> bool: """Update a console from a REXPaint `.xp` file.""" return bool( lib.TCOD_console_load_xp(_console(con), filename.encode("utf-8")) )
[ "def", "console_load_xp", "(", "con", ":", "tcod", ".", "console", ".", "Console", ",", "filename", ":", "str", ")", "->", "bool", ":", "return", "bool", "(", "lib", ".", "TCOD_console_load_xp", "(", "_console", "(", "con", ")", ",", "filename", ".", "...
Update a console from a REXPaint `.xp` file.
[ "Update", "a", "console", "from", "a", "REXPaint", ".", "xp", "file", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1909-L1913
9,206
libtcod/python-tcod
tcod/libtcodpy.py
console_save_xp
def console_save_xp( con: tcod.console.Console, filename: str, compress_level: int = 9 ) -> bool: """Save a console to a REXPaint `.xp` file.""" return bool( lib.TCOD_console_save_xp( _console(con), filename.encode("utf-8"), compress_level ) )
python
def console_save_xp( con: tcod.console.Console, filename: str, compress_level: int = 9 ) -> bool: """Save a console to a REXPaint `.xp` file.""" return bool( lib.TCOD_console_save_xp( _console(con), filename.encode("utf-8"), compress_level ) )
[ "def", "console_save_xp", "(", "con", ":", "tcod", ".", "console", ".", "Console", ",", "filename", ":", "str", ",", "compress_level", ":", "int", "=", "9", ")", "->", "bool", ":", "return", "bool", "(", "lib", ".", "TCOD_console_save_xp", "(", "_console...
Save a console to a REXPaint `.xp` file.
[ "Save", "a", "console", "to", "a", "REXPaint", ".", "xp", "file", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1916-L1924
9,207
libtcod/python-tcod
tcod/libtcodpy.py
console_from_xp
def console_from_xp(filename: str) -> tcod.console.Console: """Return a single console from a REXPaint `.xp` file.""" return tcod.console.Console._from_cdata( lib.TCOD_console_from_xp(filename.encode("utf-8")) )
python
def console_from_xp(filename: str) -> tcod.console.Console: """Return a single console from a REXPaint `.xp` file.""" return tcod.console.Console._from_cdata( lib.TCOD_console_from_xp(filename.encode("utf-8")) )
[ "def", "console_from_xp", "(", "filename", ":", "str", ")", "->", "tcod", ".", "console", ".", "Console", ":", "return", "tcod", ".", "console", ".", "Console", ".", "_from_cdata", "(", "lib", ".", "TCOD_console_from_xp", "(", "filename", ".", "encode", "(...
Return a single console from a REXPaint `.xp` file.
[ "Return", "a", "single", "console", "from", "a", "REXPaint", ".", "xp", "file", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1927-L1931
9,208
libtcod/python-tcod
tcod/libtcodpy.py
console_list_load_xp
def console_list_load_xp( filename: str ) -> Optional[List[tcod.console.Console]]: """Return a list of consoles from a REXPaint `.xp` file.""" tcod_list = lib.TCOD_console_list_from_xp(filename.encode("utf-8")) if tcod_list == ffi.NULL: return None try: python_list = [] lib.T...
python
def console_list_load_xp( filename: str ) -> Optional[List[tcod.console.Console]]: """Return a list of consoles from a REXPaint `.xp` file.""" tcod_list = lib.TCOD_console_list_from_xp(filename.encode("utf-8")) if tcod_list == ffi.NULL: return None try: python_list = [] lib.T...
[ "def", "console_list_load_xp", "(", "filename", ":", "str", ")", "->", "Optional", "[", "List", "[", "tcod", ".", "console", ".", "Console", "]", "]", ":", "tcod_list", "=", "lib", ".", "TCOD_console_list_from_xp", "(", "filename", ".", "encode", "(", "\"u...
Return a list of consoles from a REXPaint `.xp` file.
[ "Return", "a", "list", "of", "consoles", "from", "a", "REXPaint", ".", "xp", "file", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1934-L1950
9,209
libtcod/python-tcod
tcod/libtcodpy.py
console_list_save_xp
def console_list_save_xp( console_list: Sequence[tcod.console.Console], filename: str, compress_level: int = 9, ) -> bool: """Save a list of consoles to a REXPaint `.xp` file.""" tcod_list = lib.TCOD_list_new() try: for console in console_list: lib.TCOD_list_push(tcod_list, _...
python
def console_list_save_xp( console_list: Sequence[tcod.console.Console], filename: str, compress_level: int = 9, ) -> bool: """Save a list of consoles to a REXPaint `.xp` file.""" tcod_list = lib.TCOD_list_new() try: for console in console_list: lib.TCOD_list_push(tcod_list, _...
[ "def", "console_list_save_xp", "(", "console_list", ":", "Sequence", "[", "tcod", ".", "console", ".", "Console", "]", ",", "filename", ":", "str", ",", "compress_level", ":", "int", "=", "9", ",", ")", "->", "bool", ":", "tcod_list", "=", "lib", ".", ...
Save a list of consoles to a REXPaint `.xp` file.
[ "Save", "a", "list", "of", "consoles", "to", "a", "REXPaint", ".", "xp", "file", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1953-L1969
9,210
libtcod/python-tcod
tcod/libtcodpy.py
path_new_using_map
def path_new_using_map( m: tcod.map.Map, dcost: float = 1.41 ) -> tcod.path.AStar: """Return a new AStar using the given Map. Args: m (Map): A Map instance. dcost (float): The path-finding cost of diagonal movement. Can be set to 0 to disable diagonal movement. Re...
python
def path_new_using_map( m: tcod.map.Map, dcost: float = 1.41 ) -> tcod.path.AStar: """Return a new AStar using the given Map. Args: m (Map): A Map instance. dcost (float): The path-finding cost of diagonal movement. Can be set to 0 to disable diagonal movement. Re...
[ "def", "path_new_using_map", "(", "m", ":", "tcod", ".", "map", ".", "Map", ",", "dcost", ":", "float", "=", "1.41", ")", "->", "tcod", ".", "path", ".", "AStar", ":", "return", "tcod", ".", "path", ".", "AStar", "(", "m", ",", "dcost", ")" ]
Return a new AStar using the given Map. Args: m (Map): A Map instance. dcost (float): The path-finding cost of diagonal movement. Can be set to 0 to disable diagonal movement. Returns: AStar: A new AStar instance.
[ "Return", "a", "new", "AStar", "using", "the", "given", "Map", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1973-L1985
9,211
libtcod/python-tcod
tcod/libtcodpy.py
path_new_using_function
def path_new_using_function( w: int, h: int, func: Callable[[int, int, int, int, Any], float], userData: Any = 0, dcost: float = 1.41, ) -> tcod.path.AStar: """Return a new AStar using the given callable function. Args: w (int): Clipping width. h (int): Clipping height. ...
python
def path_new_using_function( w: int, h: int, func: Callable[[int, int, int, int, Any], float], userData: Any = 0, dcost: float = 1.41, ) -> tcod.path.AStar: """Return a new AStar using the given callable function. Args: w (int): Clipping width. h (int): Clipping height. ...
[ "def", "path_new_using_function", "(", "w", ":", "int", ",", "h", ":", "int", ",", "func", ":", "Callable", "[", "[", "int", ",", "int", ",", "int", ",", "int", ",", "Any", "]", ",", "float", "]", ",", "userData", ":", "Any", "=", "0", ",", "dc...
Return a new AStar using the given callable function. Args: w (int): Clipping width. h (int): Clipping height. func (Callable[[int, int, int, int, Any], float]): userData (Any): dcost (float): A multiplier for the cost of diagonal movement. Can be set ...
[ "Return", "a", "new", "AStar", "using", "the", "given", "callable", "function", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1989-L2010
9,212
libtcod/python-tcod
tcod/libtcodpy.py
path_get_origin
def path_get_origin(p: tcod.path.AStar) -> Tuple[int, int]: """Get the current origin position. This point moves when :any:`path_walk` returns the next x,y step. Args: p (AStar): An AStar instance. Returns: Tuple[int, int]: An (x, y) point. """ x = ffi.new("int *") y = ffi....
python
def path_get_origin(p: tcod.path.AStar) -> Tuple[int, int]: """Get the current origin position. This point moves when :any:`path_walk` returns the next x,y step. Args: p (AStar): An AStar instance. Returns: Tuple[int, int]: An (x, y) point. """ x = ffi.new("int *") y = ffi....
[ "def", "path_get_origin", "(", "p", ":", "tcod", ".", "path", ".", "AStar", ")", "->", "Tuple", "[", "int", ",", "int", "]", ":", "x", "=", "ffi", ".", "new", "(", "\"int *\"", ")", "y", "=", "ffi", ".", "new", "(", "\"int *\"", ")", "lib", "."...
Get the current origin position. This point moves when :any:`path_walk` returns the next x,y step. Args: p (AStar): An AStar instance. Returns: Tuple[int, int]: An (x, y) point.
[ "Get", "the", "current", "origin", "position", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L2032-L2045
9,213
libtcod/python-tcod
tcod/libtcodpy.py
path_get_destination
def path_get_destination(p: tcod.path.AStar) -> Tuple[int, int]: """Get the current destination position. Args: p (AStar): An AStar instance. Returns: Tuple[int, int]: An (x, y) point. """ x = ffi.new("int *") y = ffi.new("int *") lib.TCOD_path_get_destination(p._path_c, x, ...
python
def path_get_destination(p: tcod.path.AStar) -> Tuple[int, int]: """Get the current destination position. Args: p (AStar): An AStar instance. Returns: Tuple[int, int]: An (x, y) point. """ x = ffi.new("int *") y = ffi.new("int *") lib.TCOD_path_get_destination(p._path_c, x, ...
[ "def", "path_get_destination", "(", "p", ":", "tcod", ".", "path", ".", "AStar", ")", "->", "Tuple", "[", "int", ",", "int", "]", ":", "x", "=", "ffi", ".", "new", "(", "\"int *\"", ")", "y", "=", "ffi", ".", "new", "(", "\"int *\"", ")", "lib", ...
Get the current destination position. Args: p (AStar): An AStar instance. Returns: Tuple[int, int]: An (x, y) point.
[ "Get", "the", "current", "destination", "position", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L2049-L2060
9,214
libtcod/python-tcod
tcod/libtcodpy.py
path_size
def path_size(p: tcod.path.AStar) -> int: """Return the current length of the computed path. Args: p (AStar): An AStar instance. Returns: int: Length of the path. """ return int(lib.TCOD_path_size(p._path_c))
python
def path_size(p: tcod.path.AStar) -> int: """Return the current length of the computed path. Args: p (AStar): An AStar instance. Returns: int: Length of the path. """ return int(lib.TCOD_path_size(p._path_c))
[ "def", "path_size", "(", "p", ":", "tcod", ".", "path", ".", "AStar", ")", "->", "int", ":", "return", "int", "(", "lib", ".", "TCOD_path_size", "(", "p", ".", "_path_c", ")", ")" ]
Return the current length of the computed path. Args: p (AStar): An AStar instance. Returns: int: Length of the path.
[ "Return", "the", "current", "length", "of", "the", "computed", "path", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L2064-L2072
9,215
libtcod/python-tcod
tcod/libtcodpy.py
path_get
def path_get(p: tcod.path.AStar, idx: int) -> Tuple[int, int]: """Get a point on a path. Args: p (AStar): An AStar instance. idx (int): Should be in range: 0 <= inx < :any:`path_size` """ x = ffi.new("int *") y = ffi.new("int *") lib.TCOD_path_get(p._path_c, idx, x, y) retur...
python
def path_get(p: tcod.path.AStar, idx: int) -> Tuple[int, int]: """Get a point on a path. Args: p (AStar): An AStar instance. idx (int): Should be in range: 0 <= inx < :any:`path_size` """ x = ffi.new("int *") y = ffi.new("int *") lib.TCOD_path_get(p._path_c, idx, x, y) retur...
[ "def", "path_get", "(", "p", ":", "tcod", ".", "path", ".", "AStar", ",", "idx", ":", "int", ")", "->", "Tuple", "[", "int", ",", "int", "]", ":", "x", "=", "ffi", ".", "new", "(", "\"int *\"", ")", "y", "=", "ffi", ".", "new", "(", "\"int *\...
Get a point on a path. Args: p (AStar): An AStar instance. idx (int): Should be in range: 0 <= inx < :any:`path_size`
[ "Get", "a", "point", "on", "a", "path", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L2088-L2098
9,216
libtcod/python-tcod
tcod/libtcodpy.py
path_is_empty
def path_is_empty(p: tcod.path.AStar) -> bool: """Return True if a path is empty. Args: p (AStar): An AStar instance. Returns: bool: True if a path is empty. Otherwise False. """ return bool(lib.TCOD_path_is_empty(p._path_c))
python
def path_is_empty(p: tcod.path.AStar) -> bool: """Return True if a path is empty. Args: p (AStar): An AStar instance. Returns: bool: True if a path is empty. Otherwise False. """ return bool(lib.TCOD_path_is_empty(p._path_c))
[ "def", "path_is_empty", "(", "p", ":", "tcod", ".", "path", ".", "AStar", ")", "->", "bool", ":", "return", "bool", "(", "lib", ".", "TCOD_path_is_empty", "(", "p", ".", "_path_c", ")", ")" ]
Return True if a path is empty. Args: p (AStar): An AStar instance. Returns: bool: True if a path is empty. Otherwise False.
[ "Return", "True", "if", "a", "path", "is", "empty", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L2102-L2110
9,217
libtcod/python-tcod
tcod/libtcodpy.py
_heightmap_cdata
def _heightmap_cdata(array: np.ndarray) -> ffi.CData: """Return a new TCOD_heightmap_t instance using an array. Formatting is verified during this function. """ if array.flags["F_CONTIGUOUS"]: array = array.transpose() if not array.flags["C_CONTIGUOUS"]: raise ValueError("array must...
python
def _heightmap_cdata(array: np.ndarray) -> ffi.CData: """Return a new TCOD_heightmap_t instance using an array. Formatting is verified during this function. """ if array.flags["F_CONTIGUOUS"]: array = array.transpose() if not array.flags["C_CONTIGUOUS"]: raise ValueError("array must...
[ "def", "_heightmap_cdata", "(", "array", ":", "np", ".", "ndarray", ")", "->", "ffi", ".", "CData", ":", "if", "array", ".", "flags", "[", "\"F_CONTIGUOUS\"", "]", ":", "array", "=", "array", ".", "transpose", "(", ")", "if", "not", "array", ".", "fl...
Return a new TCOD_heightmap_t instance using an array. Formatting is verified during this function.
[ "Return", "a", "new", "TCOD_heightmap_t", "instance", "using", "an", "array", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L2219-L2232
9,218
libtcod/python-tcod
tcod/libtcodpy.py
heightmap_new
def heightmap_new(w: int, h: int, order: str = "C") -> np.ndarray: """Return a new numpy.ndarray formatted for use with heightmap functions. `w` and `h` are the width and height of the array. `order` is given to the new NumPy array, it can be 'C' or 'F'. You can pass a NumPy array to any heightmap fu...
python
def heightmap_new(w: int, h: int, order: str = "C") -> np.ndarray: """Return a new numpy.ndarray formatted for use with heightmap functions. `w` and `h` are the width and height of the array. `order` is given to the new NumPy array, it can be 'C' or 'F'. You can pass a NumPy array to any heightmap fu...
[ "def", "heightmap_new", "(", "w", ":", "int", ",", "h", ":", "int", ",", "order", ":", "str", "=", "\"C\"", ")", "->", "np", ".", "ndarray", ":", "if", "order", "==", "\"C\"", ":", "return", "np", ".", "zeros", "(", "(", "h", ",", "w", ")", "...
Return a new numpy.ndarray formatted for use with heightmap functions. `w` and `h` are the width and height of the array. `order` is given to the new NumPy array, it can be 'C' or 'F'. You can pass a NumPy array to any heightmap function as long as all the following are true:: * The array is 2 di...
[ "Return", "a", "new", "numpy", ".", "ndarray", "formatted", "for", "use", "with", "heightmap", "functions", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L2236-L2259
9,219
libtcod/python-tcod
tcod/libtcodpy.py
heightmap_set_value
def heightmap_set_value(hm: np.ndarray, x: int, y: int, value: float) -> None: """Set the value of a point on a heightmap. .. deprecated:: 2.0 `hm` is a NumPy array, so values should be assigned to it directly. """ if hm.flags["C_CONTIGUOUS"]: warnings.warn( "Assign to this ...
python
def heightmap_set_value(hm: np.ndarray, x: int, y: int, value: float) -> None: """Set the value of a point on a heightmap. .. deprecated:: 2.0 `hm` is a NumPy array, so values should be assigned to it directly. """ if hm.flags["C_CONTIGUOUS"]: warnings.warn( "Assign to this ...
[ "def", "heightmap_set_value", "(", "hm", ":", "np", ".", "ndarray", ",", "x", ":", "int", ",", "y", ":", "int", ",", "value", ":", "float", ")", "->", "None", ":", "if", "hm", ".", "flags", "[", "\"C_CONTIGUOUS\"", "]", ":", "warnings", ".", "warn"...
Set the value of a point on a heightmap. .. deprecated:: 2.0 `hm` is a NumPy array, so values should be assigned to it directly.
[ "Set", "the", "value", "of", "a", "point", "on", "a", "heightmap", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L2263-L2285
9,220
libtcod/python-tcod
tcod/libtcodpy.py
heightmap_clamp
def heightmap_clamp(hm: np.ndarray, mi: float, ma: float) -> None: """Clamp all values on this heightmap between ``mi`` and ``ma`` Args: hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions. mi (float): The lower bound to clamp to. ma (float): The upper bound to clamp t...
python
def heightmap_clamp(hm: np.ndarray, mi: float, ma: float) -> None: """Clamp all values on this heightmap between ``mi`` and ``ma`` Args: hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions. mi (float): The lower bound to clamp to. ma (float): The upper bound to clamp t...
[ "def", "heightmap_clamp", "(", "hm", ":", "np", ".", "ndarray", ",", "mi", ":", "float", ",", "ma", ":", "float", ")", "->", "None", ":", "hm", ".", "clip", "(", "mi", ",", "ma", ")" ]
Clamp all values on this heightmap between ``mi`` and ``ma`` Args: hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions. mi (float): The lower bound to clamp to. ma (float): The upper bound to clamp to. .. deprecated:: 2.0 Do ``hm.clip(mi, ma)`` instead.
[ "Clamp", "all", "values", "on", "this", "heightmap", "between", "mi", "and", "ma" ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L2330-L2341
9,221
libtcod/python-tcod
tcod/libtcodpy.py
heightmap_normalize
def heightmap_normalize( hm: np.ndarray, mi: float = 0.0, ma: float = 1.0 ) -> None: """Normalize heightmap values between ``mi`` and ``ma``. Args: mi (float): The lowest value after normalization. ma (float): The highest value after normalization. """ lib.TCOD_heightmap_normalize(_...
python
def heightmap_normalize( hm: np.ndarray, mi: float = 0.0, ma: float = 1.0 ) -> None: """Normalize heightmap values between ``mi`` and ``ma``. Args: mi (float): The lowest value after normalization. ma (float): The highest value after normalization. """ lib.TCOD_heightmap_normalize(_...
[ "def", "heightmap_normalize", "(", "hm", ":", "np", ".", "ndarray", ",", "mi", ":", "float", "=", "0.0", ",", "ma", ":", "float", "=", "1.0", ")", "->", "None", ":", "lib", ".", "TCOD_heightmap_normalize", "(", "_heightmap_cdata", "(", "hm", ")", ",", ...
Normalize heightmap values between ``mi`` and ``ma``. Args: mi (float): The lowest value after normalization. ma (float): The highest value after normalization.
[ "Normalize", "heightmap", "values", "between", "mi", "and", "ma", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L2359-L2368
9,222
libtcod/python-tcod
tcod/libtcodpy.py
heightmap_lerp_hm
def heightmap_lerp_hm( hm1: np.ndarray, hm2: np.ndarray, hm3: np.ndarray, coef: float ) -> None: """Perform linear interpolation between two heightmaps storing the result in ``hm3``. This is the same as doing ``hm3[:] = hm1[:] + (hm2[:] - hm1[:]) * coef`` Args: hm1 (numpy.ndarray): The fir...
python
def heightmap_lerp_hm( hm1: np.ndarray, hm2: np.ndarray, hm3: np.ndarray, coef: float ) -> None: """Perform linear interpolation between two heightmaps storing the result in ``hm3``. This is the same as doing ``hm3[:] = hm1[:] + (hm2[:] - hm1[:]) * coef`` Args: hm1 (numpy.ndarray): The fir...
[ "def", "heightmap_lerp_hm", "(", "hm1", ":", "np", ".", "ndarray", ",", "hm2", ":", "np", ".", "ndarray", ",", "hm3", ":", "np", ".", "ndarray", ",", "coef", ":", "float", ")", "->", "None", ":", "lib", ".", "TCOD_heightmap_lerp_hm", "(", "_heightmap_c...
Perform linear interpolation between two heightmaps storing the result in ``hm3``. This is the same as doing ``hm3[:] = hm1[:] + (hm2[:] - hm1[:]) * coef`` Args: hm1 (numpy.ndarray): The first heightmap. hm2 (numpy.ndarray): The second heightmap to add to the first. hm3 (numpy.ndar...
[ "Perform", "linear", "interpolation", "between", "two", "heightmaps", "storing", "the", "result", "in", "hm3", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L2372-L2391
9,223
libtcod/python-tcod
tcod/libtcodpy.py
heightmap_add_hm
def heightmap_add_hm( hm1: np.ndarray, hm2: np.ndarray, hm3: np.ndarray ) -> None: """Add two heightmaps together and stores the result in ``hm3``. Args: hm1 (numpy.ndarray): The first heightmap. hm2 (numpy.ndarray): The second heightmap to add to the first. hm3 (numpy.ndarray): A d...
python
def heightmap_add_hm( hm1: np.ndarray, hm2: np.ndarray, hm3: np.ndarray ) -> None: """Add two heightmaps together and stores the result in ``hm3``. Args: hm1 (numpy.ndarray): The first heightmap. hm2 (numpy.ndarray): The second heightmap to add to the first. hm3 (numpy.ndarray): A d...
[ "def", "heightmap_add_hm", "(", "hm1", ":", "np", ".", "ndarray", ",", "hm2", ":", "np", ".", "ndarray", ",", "hm3", ":", "np", ".", "ndarray", ")", "->", "None", ":", "hm3", "[", ":", "]", "=", "hm1", "[", ":", "]", "+", "hm2", "[", ":", "]"...
Add two heightmaps together and stores the result in ``hm3``. Args: hm1 (numpy.ndarray): The first heightmap. hm2 (numpy.ndarray): The second heightmap to add to the first. hm3 (numpy.ndarray): A destination heightmap to store the result. .. deprecated:: 2.0 Do ``hm3[:] = hm1[:...
[ "Add", "two", "heightmaps", "together", "and", "stores", "the", "result", "in", "hm3", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L2395-L2408
9,224
libtcod/python-tcod
tcod/libtcodpy.py
heightmap_multiply_hm
def heightmap_multiply_hm( hm1: np.ndarray, hm2: np.ndarray, hm3: np.ndarray ) -> None: """Multiplies two heightmap's together and stores the result in ``hm3``. Args: hm1 (numpy.ndarray): The first heightmap. hm2 (numpy.ndarray): The second heightmap to multiply with the first. hm3 ...
python
def heightmap_multiply_hm( hm1: np.ndarray, hm2: np.ndarray, hm3: np.ndarray ) -> None: """Multiplies two heightmap's together and stores the result in ``hm3``. Args: hm1 (numpy.ndarray): The first heightmap. hm2 (numpy.ndarray): The second heightmap to multiply with the first. hm3 ...
[ "def", "heightmap_multiply_hm", "(", "hm1", ":", "np", ".", "ndarray", ",", "hm2", ":", "np", ".", "ndarray", ",", "hm3", ":", "np", ".", "ndarray", ")", "->", "None", ":", "hm3", "[", ":", "]", "=", "hm1", "[", ":", "]", "*", "hm2", "[", ":", ...
Multiplies two heightmap's together and stores the result in ``hm3``. Args: hm1 (numpy.ndarray): The first heightmap. hm2 (numpy.ndarray): The second heightmap to multiply with the first. hm3 (numpy.ndarray): A destination heightmap to store the result. .. deprecated:: 2.0 Do `...
[ "Multiplies", "two", "heightmap", "s", "together", "and", "stores", "the", "result", "in", "hm3", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L2412-L2426
9,225
libtcod/python-tcod
tcod/libtcodpy.py
heightmap_rain_erosion
def heightmap_rain_erosion( hm: np.ndarray, nbDrops: int, erosionCoef: float, sedimentationCoef: float, rnd: Optional[tcod.random.Random] = None, ) -> None: """Simulate the effect of rain drops on the terrain, resulting in erosion. ``nbDrops`` should be at least hm.size. Args: ...
python
def heightmap_rain_erosion( hm: np.ndarray, nbDrops: int, erosionCoef: float, sedimentationCoef: float, rnd: Optional[tcod.random.Random] = None, ) -> None: """Simulate the effect of rain drops on the terrain, resulting in erosion. ``nbDrops`` should be at least hm.size. Args: ...
[ "def", "heightmap_rain_erosion", "(", "hm", ":", "np", ".", "ndarray", ",", "nbDrops", ":", "int", ",", "erosionCoef", ":", "float", ",", "sedimentationCoef", ":", "float", ",", "rnd", ":", "Optional", "[", "tcod", ".", "random", ".", "Random", "]", "=",...
Simulate the effect of rain drops on the terrain, resulting in erosion. ``nbDrops`` should be at least hm.size. Args: hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions. nbDrops (int): Number of rain drops to simulate. erosionCoef (float): Amount of ground eroded on ...
[ "Simulate", "the", "effect", "of", "rain", "drops", "on", "the", "terrain", "resulting", "in", "erosion", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L2470-L2495
9,226
libtcod/python-tcod
tcod/libtcodpy.py
heightmap_kernel_transform
def heightmap_kernel_transform( hm: np.ndarray, kernelsize: int, dx: Sequence[int], dy: Sequence[int], weight: Sequence[float], minLevel: float, maxLevel: float, ) -> None: """Apply a generic transformation on the map, so that each resulting cell value is the weighted sum of several ...
python
def heightmap_kernel_transform( hm: np.ndarray, kernelsize: int, dx: Sequence[int], dy: Sequence[int], weight: Sequence[float], minLevel: float, maxLevel: float, ) -> None: """Apply a generic transformation on the map, so that each resulting cell value is the weighted sum of several ...
[ "def", "heightmap_kernel_transform", "(", "hm", ":", "np", ".", "ndarray", ",", "kernelsize", ":", "int", ",", "dx", ":", "Sequence", "[", "int", "]", ",", "dy", ":", "Sequence", "[", "int", "]", ",", "weight", ":", "Sequence", "[", "float", "]", ","...
Apply a generic transformation on the map, so that each resulting cell value is the weighted sum of several neighbour cells. This can be used to smooth/sharpen the map. Args: hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions. kernelsize (int): Should be set to the lengt...
[ "Apply", "a", "generic", "transformation", "on", "the", "map", "so", "that", "each", "resulting", "cell", "value", "is", "the", "weighted", "sum", "of", "several", "neighbour", "cells", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L2499-L2554
9,227
libtcod/python-tcod
tcod/libtcodpy.py
heightmap_add_voronoi
def heightmap_add_voronoi( hm: np.ndarray, nbPoints: Any, nbCoef: int, coef: Sequence[float], rnd: Optional[tcod.random.Random] = None, ) -> None: """Add values from a Voronoi diagram to the heightmap. Args: hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions. ...
python
def heightmap_add_voronoi( hm: np.ndarray, nbPoints: Any, nbCoef: int, coef: Sequence[float], rnd: Optional[tcod.random.Random] = None, ) -> None: """Add values from a Voronoi diagram to the heightmap. Args: hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions. ...
[ "def", "heightmap_add_voronoi", "(", "hm", ":", "np", ".", "ndarray", ",", "nbPoints", ":", "Any", ",", "nbCoef", ":", "int", ",", "coef", ":", "Sequence", "[", "float", "]", ",", "rnd", ":", "Optional", "[", "tcod", ".", "random", ".", "Random", "]"...
Add values from a Voronoi diagram to the heightmap. Args: hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions. nbPoints (Any): Number of Voronoi sites. nbCoef (int): The diagram value is calculated from the nbCoef closest sites. coef (Sequence...
[ "Add", "values", "from", "a", "Voronoi", "diagram", "to", "the", "heightmap", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L2558-L2586
9,228
libtcod/python-tcod
tcod/libtcodpy.py
heightmap_add_fbm
def heightmap_add_fbm( hm: np.ndarray, noise: tcod.noise.Noise, mulx: float, muly: float, addx: float, addy: float, octaves: float, delta: float, scale: float, ) -> None: """Add FBM noise to the heightmap. The noise coordinate for each map cell is `((x + addx) * mulx / w...
python
def heightmap_add_fbm( hm: np.ndarray, noise: tcod.noise.Noise, mulx: float, muly: float, addx: float, addy: float, octaves: float, delta: float, scale: float, ) -> None: """Add FBM noise to the heightmap. The noise coordinate for each map cell is `((x + addx) * mulx / w...
[ "def", "heightmap_add_fbm", "(", "hm", ":", "np", ".", "ndarray", ",", "noise", ":", "tcod", ".", "noise", ".", "Noise", ",", "mulx", ":", "float", ",", "muly", ":", "float", ",", "addx", ":", "float", ",", "addy", ":", "float", ",", "octaves", ":"...
Add FBM noise to the heightmap. The noise coordinate for each map cell is `((x + addx) * mulx / width, (y + addy) * muly / height)`. The value added to the heightmap is `delta + noise * scale`. Args: hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions. noise (Noise):...
[ "Add", "FBM", "noise", "to", "the", "heightmap", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L2590-L2634
9,229
libtcod/python-tcod
tcod/libtcodpy.py
heightmap_dig_bezier
def heightmap_dig_bezier( hm: np.ndarray, px: Tuple[int, int, int, int], py: Tuple[int, int, int, int], startRadius: float, startDepth: float, endRadius: float, endDepth: float, ) -> None: """Carve a path along a cubic Bezier curve. Both radius and depth can vary linearly along the ...
python
def heightmap_dig_bezier( hm: np.ndarray, px: Tuple[int, int, int, int], py: Tuple[int, int, int, int], startRadius: float, startDepth: float, endRadius: float, endDepth: float, ) -> None: """Carve a path along a cubic Bezier curve. Both radius and depth can vary linearly along the ...
[ "def", "heightmap_dig_bezier", "(", "hm", ":", "np", ".", "ndarray", ",", "px", ":", "Tuple", "[", "int", ",", "int", ",", "int", ",", "int", "]", ",", "py", ":", "Tuple", "[", "int", ",", "int", ",", "int", ",", "int", "]", ",", "startRadius", ...
Carve a path along a cubic Bezier curve. Both radius and depth can vary linearly along the path. Args: hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions. px (Sequence[int]): The 4 `x` coordinates of the Bezier curve. py (Sequence[int]): The 4 `y` coordinates of the ...
[ "Carve", "a", "path", "along", "a", "cubic", "Bezier", "curve", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L2681-L2711
9,230
libtcod/python-tcod
tcod/libtcodpy.py
heightmap_get_interpolated_value
def heightmap_get_interpolated_value( hm: np.ndarray, x: float, y: float ) -> float: """Return the interpolated height at non integer coordinates. Args: hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions. x (float): A floating point x coordinate. y (float): A floa...
python
def heightmap_get_interpolated_value( hm: np.ndarray, x: float, y: float ) -> float: """Return the interpolated height at non integer coordinates. Args: hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions. x (float): A floating point x coordinate. y (float): A floa...
[ "def", "heightmap_get_interpolated_value", "(", "hm", ":", "np", ".", "ndarray", ",", "x", ":", "float", ",", "y", ":", "float", ")", "->", "float", ":", "return", "float", "(", "lib", ".", "TCOD_heightmap_get_interpolated_value", "(", "_heightmap_cdata", "(",...
Return the interpolated height at non integer coordinates. Args: hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions. x (float): A floating point x coordinate. y (float): A floating point y coordinate. Returns: float: The value at ``x``, ``y``.
[ "Return", "the", "interpolated", "height", "at", "non", "integer", "coordinates", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L2741-L2756
9,231
libtcod/python-tcod
tcod/libtcodpy.py
heightmap_get_normal
def heightmap_get_normal( hm: np.ndarray, x: float, y: float, waterLevel: float ) -> Tuple[float, float, float]: """Return the map normal at given coordinates. Args: hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions. x (float): The x coordinate. y (float): The y ...
python
def heightmap_get_normal( hm: np.ndarray, x: float, y: float, waterLevel: float ) -> Tuple[float, float, float]: """Return the map normal at given coordinates. Args: hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions. x (float): The x coordinate. y (float): The y ...
[ "def", "heightmap_get_normal", "(", "hm", ":", "np", ".", "ndarray", ",", "x", ":", "float", ",", "y", ":", "float", ",", "waterLevel", ":", "float", ")", "->", "Tuple", "[", "float", ",", "float", ",", "float", "]", ":", "cn", "=", "ffi", ".", "...
Return the map normal at given coordinates. Args: hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions. x (float): The x coordinate. y (float): The y coordinate. waterLevel (float): The heightmap is considered flat below this value. Returns: Tuple[float...
[ "Return", "the", "map", "normal", "at", "given", "coordinates", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L2775-L2791
9,232
libtcod/python-tcod
tcod/libtcodpy.py
heightmap_count_cells
def heightmap_count_cells(hm: np.ndarray, mi: float, ma: float) -> int: """Return the number of map cells which value is between ``mi`` and ``ma``. Args: hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions. mi (float): The lower bound. ma (float): The upper bound. ...
python
def heightmap_count_cells(hm: np.ndarray, mi: float, ma: float) -> int: """Return the number of map cells which value is between ``mi`` and ``ma``. Args: hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions. mi (float): The lower bound. ma (float): The upper bound. ...
[ "def", "heightmap_count_cells", "(", "hm", ":", "np", ".", "ndarray", ",", "mi", ":", "float", ",", "ma", ":", "float", ")", "->", "int", ":", "return", "int", "(", "lib", ".", "TCOD_heightmap_count_cells", "(", "_heightmap_cdata", "(", "hm", ")", ",", ...
Return the number of map cells which value is between ``mi`` and ``ma``. Args: hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions. mi (float): The lower bound. ma (float): The upper bound. Returns: int: The count of values which fall between ``mi`` and ``ma``...
[ "Return", "the", "number", "of", "map", "cells", "which", "value", "is", "between", "mi", "and", "ma", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L2795-L2810
9,233
libtcod/python-tcod
tcod/libtcodpy.py
heightmap_has_land_on_border
def heightmap_has_land_on_border(hm: np.ndarray, waterlevel: float) -> bool: """Returns True if the map edges are below ``waterlevel``, otherwise False. Args: hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions. waterLevel (float): The water level to use. Returns: ...
python
def heightmap_has_land_on_border(hm: np.ndarray, waterlevel: float) -> bool: """Returns True if the map edges are below ``waterlevel``, otherwise False. Args: hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions. waterLevel (float): The water level to use. Returns: ...
[ "def", "heightmap_has_land_on_border", "(", "hm", ":", "np", ".", "ndarray", ",", "waterlevel", ":", "float", ")", "->", "bool", ":", "return", "bool", "(", "lib", ".", "TCOD_heightmap_has_land_on_border", "(", "_heightmap_cdata", "(", "hm", ")", ",", "waterle...
Returns True if the map edges are below ``waterlevel``, otherwise False. Args: hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions. waterLevel (float): The water level to use. Returns: bool: True if the map edges are below ``waterlevel``, otherwise False.
[ "Returns", "True", "if", "the", "map", "edges", "are", "below", "waterlevel", "otherwise", "False", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L2814-L2826
9,234
libtcod/python-tcod
tcod/libtcodpy.py
heightmap_get_minmax
def heightmap_get_minmax(hm: np.ndarray) -> Tuple[float, float]: """Return the min and max values of this heightmap. Args: hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions. Returns: Tuple[float, float]: The (min, max) values. .. deprecated:: 2.0 Use ``hm.m...
python
def heightmap_get_minmax(hm: np.ndarray) -> Tuple[float, float]: """Return the min and max values of this heightmap. Args: hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions. Returns: Tuple[float, float]: The (min, max) values. .. deprecated:: 2.0 Use ``hm.m...
[ "def", "heightmap_get_minmax", "(", "hm", ":", "np", ".", "ndarray", ")", "->", "Tuple", "[", "float", ",", "float", "]", ":", "mi", "=", "ffi", ".", "new", "(", "\"float *\"", ")", "ma", "=", "ffi", ".", "new", "(", "\"float *\"", ")", "lib", ".",...
Return the min and max values of this heightmap. Args: hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions. Returns: Tuple[float, float]: The (min, max) values. .. deprecated:: 2.0 Use ``hm.min()`` or ``hm.max()`` instead.
[ "Return", "the", "min", "and", "max", "values", "of", "this", "heightmap", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L2830-L2845
9,235
libtcod/python-tcod
tcod/libtcodpy.py
image_load
def image_load(filename: str) -> tcod.image.Image: """Load an image file into an Image instance and return it. Args: filename (AnyStr): Path to a .bmp or .png image file. """ return tcod.image.Image._from_cdata( ffi.gc(lib.TCOD_image_load(_bytes(filename)), lib.TCOD_image_delete) )
python
def image_load(filename: str) -> tcod.image.Image: """Load an image file into an Image instance and return it. Args: filename (AnyStr): Path to a .bmp or .png image file. """ return tcod.image.Image._from_cdata( ffi.gc(lib.TCOD_image_load(_bytes(filename)), lib.TCOD_image_delete) )
[ "def", "image_load", "(", "filename", ":", "str", ")", "->", "tcod", ".", "image", ".", "Image", ":", "return", "tcod", ".", "image", ".", "Image", ".", "_from_cdata", "(", "ffi", ".", "gc", "(", "lib", ".", "TCOD_image_load", "(", "_bytes", "(", "fi...
Load an image file into an Image instance and return it. Args: filename (AnyStr): Path to a .bmp or .png image file.
[ "Load", "an", "image", "file", "into", "an", "Image", "instance", "and", "return", "it", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L2914-L2922
9,236
libtcod/python-tcod
tcod/libtcodpy.py
image_from_console
def image_from_console(console: tcod.console.Console) -> tcod.image.Image: """Return an Image with a Consoles pixel data. This effectively takes a screen-shot of the Console. Args: console (Console): Any Console instance. """ return tcod.image.Image._from_cdata( ffi.gc( ...
python
def image_from_console(console: tcod.console.Console) -> tcod.image.Image: """Return an Image with a Consoles pixel data. This effectively takes a screen-shot of the Console. Args: console (Console): Any Console instance. """ return tcod.image.Image._from_cdata( ffi.gc( ...
[ "def", "image_from_console", "(", "console", ":", "tcod", ".", "console", ".", "Console", ")", "->", "tcod", ".", "image", ".", "Image", ":", "return", "tcod", ".", "image", ".", "Image", ".", "_from_cdata", "(", "ffi", ".", "gc", "(", "lib", ".", "T...
Return an Image with a Consoles pixel data. This effectively takes a screen-shot of the Console. Args: console (Console): Any Console instance.
[ "Return", "an", "Image", "with", "a", "Consoles", "pixel", "data", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L2926-L2939
9,237
libtcod/python-tcod
tcod/libtcodpy.py
line_init
def line_init(xo: int, yo: int, xd: int, yd: int) -> None: """Initilize a line whose points will be returned by `line_step`. This function does not return anything on its own. Does not include the origin point. Args: xo (int): X starting point. yo (int): Y starting point. xd (...
python
def line_init(xo: int, yo: int, xd: int, yd: int) -> None: """Initilize a line whose points will be returned by `line_step`. This function does not return anything on its own. Does not include the origin point. Args: xo (int): X starting point. yo (int): Y starting point. xd (...
[ "def", "line_init", "(", "xo", ":", "int", ",", "yo", ":", "int", ",", "xd", ":", "int", ",", "yd", ":", "int", ")", "->", "None", ":", "lib", ".", "TCOD_line_init", "(", "xo", ",", "yo", ",", "xd", ",", "yd", ")" ]
Initilize a line whose points will be returned by `line_step`. This function does not return anything on its own. Does not include the origin point. Args: xo (int): X starting point. yo (int): Y starting point. xd (int): X destination point. yd (int): Y destination point. ...
[ "Initilize", "a", "line", "whose", "points", "will", "be", "returned", "by", "line_step", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L3030-L3046
9,238
libtcod/python-tcod
tcod/libtcodpy.py
line
def line( xo: int, yo: int, xd: int, yd: int, py_callback: Callable[[int, int], bool] ) -> bool: """ Iterate over a line using a callback function. Your callback function will take x and y parameters and return True to continue iteration or False to stop iteration and return. This function include...
python
def line( xo: int, yo: int, xd: int, yd: int, py_callback: Callable[[int, int], bool] ) -> bool: """ Iterate over a line using a callback function. Your callback function will take x and y parameters and return True to continue iteration or False to stop iteration and return. This function include...
[ "def", "line", "(", "xo", ":", "int", ",", "yo", ":", "int", ",", "xd", ":", "int", ",", "yd", ":", "int", ",", "py_callback", ":", "Callable", "[", "[", "int", ",", "int", "]", ",", "bool", "]", ")", "->", "bool", ":", "for", "x", ",", "y"...
Iterate over a line using a callback function. Your callback function will take x and y parameters and return True to continue iteration or False to stop iteration and return. This function includes both the start and end points. Args: xo (int): X starting point. yo (int): Y starting ...
[ "Iterate", "over", "a", "line", "using", "a", "callback", "function", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L3072-L3102
9,239
libtcod/python-tcod
tcod/libtcodpy.py
line_iter
def line_iter(xo: int, yo: int, xd: int, yd: int) -> Iterator[Tuple[int, int]]: """ returns an Iterable This Iterable does not include the origin point. Args: xo (int): X starting point. yo (int): Y starting point. xd (int): X destination point. yd (int): Y destination poin...
python
def line_iter(xo: int, yo: int, xd: int, yd: int) -> Iterator[Tuple[int, int]]: """ returns an Iterable This Iterable does not include the origin point. Args: xo (int): X starting point. yo (int): Y starting point. xd (int): X destination point. yd (int): Y destination poin...
[ "def", "line_iter", "(", "xo", ":", "int", ",", "yo", ":", "int", ",", "xd", ":", "int", ",", "yd", ":", "int", ")", "->", "Iterator", "[", "Tuple", "[", "int", ",", "int", "]", "]", ":", "data", "=", "ffi", ".", "new", "(", "\"TCOD_bresenham_d...
returns an Iterable This Iterable does not include the origin point. Args: xo (int): X starting point. yo (int): Y starting point. xd (int): X destination point. yd (int): Y destination point. Returns: Iterable[Tuple[int,int]]: An Iterable of (x,y) points.
[ "returns", "an", "Iterable" ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L3105-L3125
9,240
libtcod/python-tcod
tcod/libtcodpy.py
line_where
def line_where( x1: int, y1: int, x2: int, y2: int, inclusive: bool = True ) -> Tuple[np.array, np.array]: """Return a NumPy index array following a Bresenham line. If `inclusive` is true then the start point is included in the result. Example: >>> where = tcod.line_where(1, 0, 3, 4) >...
python
def line_where( x1: int, y1: int, x2: int, y2: int, inclusive: bool = True ) -> Tuple[np.array, np.array]: """Return a NumPy index array following a Bresenham line. If `inclusive` is true then the start point is included in the result. Example: >>> where = tcod.line_where(1, 0, 3, 4) >...
[ "def", "line_where", "(", "x1", ":", "int", ",", "y1", ":", "int", ",", "x2", ":", "int", ",", "y2", ":", "int", ",", "inclusive", ":", "bool", "=", "True", ")", "->", "Tuple", "[", "np", ".", "array", ",", "np", ".", "array", "]", ":", "leng...
Return a NumPy index array following a Bresenham line. If `inclusive` is true then the start point is included in the result. Example: >>> where = tcod.line_where(1, 0, 3, 4) >>> where (array([1, 1, 2, 2, 3]...), array([0, 1, 2, 3, 4]...)) >>> array = np.zeros((5, 5), dtype=np....
[ "Return", "a", "NumPy", "index", "array", "following", "a", "Bresenham", "line", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L3128-L3157
9,241
libtcod/python-tcod
tcod/libtcodpy.py
map_copy
def map_copy(source: tcod.map.Map, dest: tcod.map.Map) -> None: """Copy map data from `source` to `dest`. .. deprecated:: 4.5 Use Python's copy module, or see :any:`tcod.map.Map` and assign between array attributes manually. """ if source.width != dest.width or source.height != dest.hei...
python
def map_copy(source: tcod.map.Map, dest: tcod.map.Map) -> None: """Copy map data from `source` to `dest`. .. deprecated:: 4.5 Use Python's copy module, or see :any:`tcod.map.Map` and assign between array attributes manually. """ if source.width != dest.width or source.height != dest.hei...
[ "def", "map_copy", "(", "source", ":", "tcod", ".", "map", ".", "Map", ",", "dest", ":", "tcod", ".", "map", ".", "Map", ")", "->", "None", ":", "if", "source", ".", "width", "!=", "dest", ".", "width", "or", "source", ".", "height", "!=", "dest"...
Copy map data from `source` to `dest`. .. deprecated:: 4.5 Use Python's copy module, or see :any:`tcod.map.Map` and assign between array attributes manually.
[ "Copy", "map", "data", "from", "source", "to", "dest", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L3172-L3183
9,242
libtcod/python-tcod
tcod/libtcodpy.py
map_set_properties
def map_set_properties( m: tcod.map.Map, x: int, y: int, isTrans: bool, isWalk: bool ) -> None: """Set the properties of a single cell. .. note:: This function is slow. .. deprecated:: 4.5 Use :any:`tcod.map.Map.transparent` and :any:`tcod.map.Map.walkable` arrays to set these p...
python
def map_set_properties( m: tcod.map.Map, x: int, y: int, isTrans: bool, isWalk: bool ) -> None: """Set the properties of a single cell. .. note:: This function is slow. .. deprecated:: 4.5 Use :any:`tcod.map.Map.transparent` and :any:`tcod.map.Map.walkable` arrays to set these p...
[ "def", "map_set_properties", "(", "m", ":", "tcod", ".", "map", ".", "Map", ",", "x", ":", "int", ",", "y", ":", "int", ",", "isTrans", ":", "bool", ",", "isWalk", ":", "bool", ")", "->", "None", ":", "lib", ".", "TCOD_map_set_properties", "(", "m"...
Set the properties of a single cell. .. note:: This function is slow. .. deprecated:: 4.5 Use :any:`tcod.map.Map.transparent` and :any:`tcod.map.Map.walkable` arrays to set these properties.
[ "Set", "the", "properties", "of", "a", "single", "cell", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L3187-L3198
9,243
libtcod/python-tcod
tcod/libtcodpy.py
map_clear
def map_clear( m: tcod.map.Map, transparent: bool = False, walkable: bool = False ) -> None: """Change all map cells to a specific value. .. deprecated:: 4.5 Use :any:`tcod.map.Map.transparent` and :any:`tcod.map.Map.walkable` arrays to set these properties. """ m.transparent[:] = t...
python
def map_clear( m: tcod.map.Map, transparent: bool = False, walkable: bool = False ) -> None: """Change all map cells to a specific value. .. deprecated:: 4.5 Use :any:`tcod.map.Map.transparent` and :any:`tcod.map.Map.walkable` arrays to set these properties. """ m.transparent[:] = t...
[ "def", "map_clear", "(", "m", ":", "tcod", ".", "map", ".", "Map", ",", "transparent", ":", "bool", "=", "False", ",", "walkable", ":", "bool", "=", "False", ")", "->", "None", ":", "m", ".", "transparent", "[", ":", "]", "=", "transparent", "m", ...
Change all map cells to a specific value. .. deprecated:: 4.5 Use :any:`tcod.map.Map.transparent` and :any:`tcod.map.Map.walkable` arrays to set these properties.
[ "Change", "all", "map", "cells", "to", "a", "specific", "value", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L3202-L3212
9,244
libtcod/python-tcod
tcod/libtcodpy.py
map_compute_fov
def map_compute_fov( m: tcod.map.Map, x: int, y: int, radius: int = 0, light_walls: bool = True, algo: int = FOV_RESTRICTIVE, ) -> None: """Compute the field-of-view for a map instance. .. deprecated:: 4.5 Use :any:`tcod.map.Map.compute_fov` instead. """ m.compute_fov(x,...
python
def map_compute_fov( m: tcod.map.Map, x: int, y: int, radius: int = 0, light_walls: bool = True, algo: int = FOV_RESTRICTIVE, ) -> None: """Compute the field-of-view for a map instance. .. deprecated:: 4.5 Use :any:`tcod.map.Map.compute_fov` instead. """ m.compute_fov(x,...
[ "def", "map_compute_fov", "(", "m", ":", "tcod", ".", "map", ".", "Map", ",", "x", ":", "int", ",", "y", ":", "int", ",", "radius", ":", "int", "=", "0", ",", "light_walls", ":", "bool", "=", "True", ",", "algo", ":", "int", "=", "FOV_RESTRICTIVE...
Compute the field-of-view for a map instance. .. deprecated:: 4.5 Use :any:`tcod.map.Map.compute_fov` instead.
[ "Compute", "the", "field", "-", "of", "-", "view", "for", "a", "map", "instance", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L3216-L3229
9,245
libtcod/python-tcod
tcod/libtcodpy.py
map_is_in_fov
def map_is_in_fov(m: tcod.map.Map, x: int, y: int) -> bool: """Return True if the cell at x,y is lit by the last field-of-view algorithm. .. note:: This function is slow. .. deprecated:: 4.5 Use :any:`tcod.map.Map.fov` to check this property. """ return bool(lib.TCOD_map_is_in_f...
python
def map_is_in_fov(m: tcod.map.Map, x: int, y: int) -> bool: """Return True if the cell at x,y is lit by the last field-of-view algorithm. .. note:: This function is slow. .. deprecated:: 4.5 Use :any:`tcod.map.Map.fov` to check this property. """ return bool(lib.TCOD_map_is_in_f...
[ "def", "map_is_in_fov", "(", "m", ":", "tcod", ".", "map", ".", "Map", ",", "x", ":", "int", ",", "y", ":", "int", ")", "->", "bool", ":", "return", "bool", "(", "lib", ".", "TCOD_map_is_in_fov", "(", "m", ".", "map_c", ",", "x", ",", "y", ")",...
Return True if the cell at x,y is lit by the last field-of-view algorithm. .. note:: This function is slow. .. deprecated:: 4.5 Use :any:`tcod.map.Map.fov` to check this property.
[ "Return", "True", "if", "the", "cell", "at", "x", "y", "is", "lit", "by", "the", "last", "field", "-", "of", "-", "view", "algorithm", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L3233-L3242
9,246
libtcod/python-tcod
tcod/libtcodpy.py
noise_new
def noise_new( dim: int, h: float = NOISE_DEFAULT_HURST, l: float = NOISE_DEFAULT_LACUNARITY, # noqa: E741 random: Optional[tcod.random.Random] = None, ) -> tcod.noise.Noise: """Return a new Noise instance. Args: dim (int): Number of dimensions. From 1 to 4. h (float): The hur...
python
def noise_new( dim: int, h: float = NOISE_DEFAULT_HURST, l: float = NOISE_DEFAULT_LACUNARITY, # noqa: E741 random: Optional[tcod.random.Random] = None, ) -> tcod.noise.Noise: """Return a new Noise instance. Args: dim (int): Number of dimensions. From 1 to 4. h (float): The hur...
[ "def", "noise_new", "(", "dim", ":", "int", ",", "h", ":", "float", "=", "NOISE_DEFAULT_HURST", ",", "l", ":", "float", "=", "NOISE_DEFAULT_LACUNARITY", ",", "# noqa: E741", "random", ":", "Optional", "[", "tcod", ".", "random", ".", "Random", "]", "=", ...
Return a new Noise instance. Args: dim (int): Number of dimensions. From 1 to 4. h (float): The hurst exponent. Should be in the 0.0-1.0 range. l (float): The noise lacunarity. random (Optional[Random]): A Random instance, or None. Returns: Noise: The new Noise instan...
[ "Return", "a", "new", "Noise", "instance", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L3356-L3373
9,247
libtcod/python-tcod
tcod/libtcodpy.py
noise_set_type
def noise_set_type(n: tcod.noise.Noise, typ: int) -> None: """Set a Noise objects default noise algorithm. Args: typ (int): Any NOISE_* constant. """ n.algorithm = typ
python
def noise_set_type(n: tcod.noise.Noise, typ: int) -> None: """Set a Noise objects default noise algorithm. Args: typ (int): Any NOISE_* constant. """ n.algorithm = typ
[ "def", "noise_set_type", "(", "n", ":", "tcod", ".", "noise", ".", "Noise", ",", "typ", ":", "int", ")", "->", "None", ":", "n", ".", "algorithm", "=", "typ" ]
Set a Noise objects default noise algorithm. Args: typ (int): Any NOISE_* constant.
[ "Set", "a", "Noise", "objects", "default", "noise", "algorithm", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L3377-L3383
9,248
libtcod/python-tcod
tcod/libtcodpy.py
noise_get
def noise_get( n: tcod.noise.Noise, f: Sequence[float], typ: int = NOISE_DEFAULT ) -> float: """Return the noise value sampled from the ``f`` coordinate. ``f`` should be a tuple or list with a length matching :any:`Noise.dimensions`. If ``f`` is shoerter than :any:`Noise.dimensions` the missing coo...
python
def noise_get( n: tcod.noise.Noise, f: Sequence[float], typ: int = NOISE_DEFAULT ) -> float: """Return the noise value sampled from the ``f`` coordinate. ``f`` should be a tuple or list with a length matching :any:`Noise.dimensions`. If ``f`` is shoerter than :any:`Noise.dimensions` the missing coo...
[ "def", "noise_get", "(", "n", ":", "tcod", ".", "noise", ".", "Noise", ",", "f", ":", "Sequence", "[", "float", "]", ",", "typ", ":", "int", "=", "NOISE_DEFAULT", ")", "->", "float", ":", "return", "float", "(", "lib", ".", "TCOD_noise_get_ex", "(", ...
Return the noise value sampled from the ``f`` coordinate. ``f`` should be a tuple or list with a length matching :any:`Noise.dimensions`. If ``f`` is shoerter than :any:`Noise.dimensions` the missing coordinates will be filled with zeros. Args: n (Noise): A Noise instance. f (Seque...
[ "Return", "the", "noise", "value", "sampled", "from", "the", "f", "coordinate", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L3387-L3405
9,249
libtcod/python-tcod
tcod/libtcodpy.py
noise_get_fbm
def noise_get_fbm( n: tcod.noise.Noise, f: Sequence[float], oc: float, typ: int = NOISE_DEFAULT, ) -> float: """Return the fractal Brownian motion sampled from the ``f`` coordinate. Args: n (Noise): A Noise instance. f (Sequence[float]): The point to sample the noise from. ...
python
def noise_get_fbm( n: tcod.noise.Noise, f: Sequence[float], oc: float, typ: int = NOISE_DEFAULT, ) -> float: """Return the fractal Brownian motion sampled from the ``f`` coordinate. Args: n (Noise): A Noise instance. f (Sequence[float]): The point to sample the noise from. ...
[ "def", "noise_get_fbm", "(", "n", ":", "tcod", ".", "noise", ".", "Noise", ",", "f", ":", "Sequence", "[", "float", "]", ",", "oc", ":", "float", ",", "typ", ":", "int", "=", "NOISE_DEFAULT", ",", ")", "->", "float", ":", "return", "float", "(", ...
Return the fractal Brownian motion sampled from the ``f`` coordinate. Args: n (Noise): A Noise instance. f (Sequence[float]): The point to sample the noise from. typ (int): The noise algorithm to use. octaves (float): The level of level. Should be more than 1. Returns: ...
[ "Return", "the", "fractal", "Brownian", "motion", "sampled", "from", "the", "f", "coordinate", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L3409-L3428
9,250
libtcod/python-tcod
tcod/libtcodpy.py
noise_get_turbulence
def noise_get_turbulence( n: tcod.noise.Noise, f: Sequence[float], oc: float, typ: int = NOISE_DEFAULT, ) -> float: """Return the turbulence noise sampled from the ``f`` coordinate. Args: n (Noise): A Noise instance. f (Sequence[float]): The point to sample the noise from. ...
python
def noise_get_turbulence( n: tcod.noise.Noise, f: Sequence[float], oc: float, typ: int = NOISE_DEFAULT, ) -> float: """Return the turbulence noise sampled from the ``f`` coordinate. Args: n (Noise): A Noise instance. f (Sequence[float]): The point to sample the noise from. ...
[ "def", "noise_get_turbulence", "(", "n", ":", "tcod", ".", "noise", ".", "Noise", ",", "f", ":", "Sequence", "[", "float", "]", ",", "oc", ":", "float", ",", "typ", ":", "int", "=", "NOISE_DEFAULT", ",", ")", "->", "float", ":", "return", "float", ...
Return the turbulence noise sampled from the ``f`` coordinate. Args: n (Noise): A Noise instance. f (Sequence[float]): The point to sample the noise from. typ (int): The noise algorithm to use. octaves (float): The level of level. Should be more than 1. Returns: float:...
[ "Return", "the", "turbulence", "noise", "sampled", "from", "the", "f", "coordinate", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L3432-L3453
9,251
libtcod/python-tcod
tcod/libtcodpy.py
random_get_instance
def random_get_instance() -> tcod.random.Random: """Return the default Random instance. Returns: Random: A Random instance using the default random number generator. """ return tcod.random.Random._new_from_cdata( ffi.cast("mersenne_data_t*", lib.TCOD_random_get_instance()) )
python
def random_get_instance() -> tcod.random.Random: """Return the default Random instance. Returns: Random: A Random instance using the default random number generator. """ return tcod.random.Random._new_from_cdata( ffi.cast("mersenne_data_t*", lib.TCOD_random_get_instance()) )
[ "def", "random_get_instance", "(", ")", "->", "tcod", ".", "random", ".", "Random", ":", "return", "tcod", ".", "random", ".", "Random", ".", "_new_from_cdata", "(", "ffi", ".", "cast", "(", "\"mersenne_data_t*\"", ",", "lib", ".", "TCOD_random_get_instance", ...
Return the default Random instance. Returns: Random: A Random instance using the default random number generator.
[ "Return", "the", "default", "Random", "instance", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L3635-L3643
9,252
libtcod/python-tcod
tcod/libtcodpy.py
random_new
def random_new(algo: int = RNG_CMWC) -> tcod.random.Random: """Return a new Random instance. Using ``algo``. Args: algo (int): The random number algorithm to use. Returns: Random: A new Random instance using the given algorithm. """ return tcod.random.Random(algo)
python
def random_new(algo: int = RNG_CMWC) -> tcod.random.Random: """Return a new Random instance. Using ``algo``. Args: algo (int): The random number algorithm to use. Returns: Random: A new Random instance using the given algorithm. """ return tcod.random.Random(algo)
[ "def", "random_new", "(", "algo", ":", "int", "=", "RNG_CMWC", ")", "->", "tcod", ".", "random", ".", "Random", ":", "return", "tcod", ".", "random", ".", "Random", "(", "algo", ")" ]
Return a new Random instance. Using ``algo``. Args: algo (int): The random number algorithm to use. Returns: Random: A new Random instance using the given algorithm.
[ "Return", "a", "new", "Random", "instance", ".", "Using", "algo", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L3647-L3656
9,253
libtcod/python-tcod
tcod/libtcodpy.py
random_new_from_seed
def random_new_from_seed( seed: Hashable, algo: int = RNG_CMWC ) -> tcod.random.Random: """Return a new Random instance. Using the given ``seed`` and ``algo``. Args: seed (Hashable): The RNG seed. Should be a 32-bit integer, but any hashable object is accepted. al...
python
def random_new_from_seed( seed: Hashable, algo: int = RNG_CMWC ) -> tcod.random.Random: """Return a new Random instance. Using the given ``seed`` and ``algo``. Args: seed (Hashable): The RNG seed. Should be a 32-bit integer, but any hashable object is accepted. al...
[ "def", "random_new_from_seed", "(", "seed", ":", "Hashable", ",", "algo", ":", "int", "=", "RNG_CMWC", ")", "->", "tcod", ".", "random", ".", "Random", ":", "return", "tcod", ".", "random", ".", "Random", "(", "algo", ",", "seed", ")" ]
Return a new Random instance. Using the given ``seed`` and ``algo``. Args: seed (Hashable): The RNG seed. Should be a 32-bit integer, but any hashable object is accepted. algo (int): The random number algorithm to use. Returns: Random: A new Random instance u...
[ "Return", "a", "new", "Random", "instance", ".", "Using", "the", "given", "seed", "and", "algo", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L3660-L3673
9,254
libtcod/python-tcod
tcod/libtcodpy.py
random_set_distribution
def random_set_distribution( rnd: Optional[tcod.random.Random], dist: int ) -> None: """Change the distribution mode of a random number generator. Args: rnd (Optional[Random]): A Random instance, or None to use the default. dist (int): The distribution mode to use. Should be DISTRIBUTION_*...
python
def random_set_distribution( rnd: Optional[tcod.random.Random], dist: int ) -> None: """Change the distribution mode of a random number generator. Args: rnd (Optional[Random]): A Random instance, or None to use the default. dist (int): The distribution mode to use. Should be DISTRIBUTION_*...
[ "def", "random_set_distribution", "(", "rnd", ":", "Optional", "[", "tcod", ".", "random", ".", "Random", "]", ",", "dist", ":", "int", ")", "->", "None", ":", "lib", ".", "TCOD_random_set_distribution", "(", "rnd", ".", "random_c", "if", "rnd", "else", ...
Change the distribution mode of a random number generator. Args: rnd (Optional[Random]): A Random instance, or None to use the default. dist (int): The distribution mode to use. Should be DISTRIBUTION_*.
[ "Change", "the", "distribution", "mode", "of", "a", "random", "number", "generator", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L3677-L3686
9,255
libtcod/python-tcod
tcod/libtcodpy.py
random_save
def random_save(rnd: Optional[tcod.random.Random]) -> tcod.random.Random: """Return a copy of a random number generator. .. deprecated:: 8.4 You can use the standard library copy and pickle modules to save a random state. """ return tcod.random.Random._new_from_cdata( ffi.gc( ...
python
def random_save(rnd: Optional[tcod.random.Random]) -> tcod.random.Random: """Return a copy of a random number generator. .. deprecated:: 8.4 You can use the standard library copy and pickle modules to save a random state. """ return tcod.random.Random._new_from_cdata( ffi.gc( ...
[ "def", "random_save", "(", "rnd", ":", "Optional", "[", "tcod", ".", "random", ".", "Random", "]", ")", "->", "tcod", ".", "random", ".", "Random", ":", "return", "tcod", ".", "random", ".", "Random", ".", "_new_from_cdata", "(", "ffi", ".", "gc", "(...
Return a copy of a random number generator. .. deprecated:: 8.4 You can use the standard library copy and pickle modules to save a random state.
[ "Return", "a", "copy", "of", "a", "random", "number", "generator", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L3812-L3827
9,256
libtcod/python-tcod
tcod/libtcodpy.py
random_restore
def random_restore( rnd: Optional[tcod.random.Random], backup: tcod.random.Random ) -> None: """Restore a random number generator from a backed up copy. Args: rnd (Optional[Random]): A Random instance, or None to use the default. backup (Random): The Random instance which was used as a back...
python
def random_restore( rnd: Optional[tcod.random.Random], backup: tcod.random.Random ) -> None: """Restore a random number generator from a backed up copy. Args: rnd (Optional[Random]): A Random instance, or None to use the default. backup (Random): The Random instance which was used as a back...
[ "def", "random_restore", "(", "rnd", ":", "Optional", "[", "tcod", ".", "random", ".", "Random", "]", ",", "backup", ":", "tcod", ".", "random", ".", "Random", ")", "->", "None", ":", "lib", ".", "TCOD_random_restore", "(", "rnd", ".", "random_c", "if"...
Restore a random number generator from a backed up copy. Args: rnd (Optional[Random]): A Random instance, or None to use the default. backup (Random): The Random instance which was used as a backup. .. deprecated:: 8.4 You can use the standard library copy and pickle modules to save a ...
[ "Restore", "a", "random", "number", "generator", "from", "a", "backed", "up", "copy", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L3831-L3844
9,257
libtcod/python-tcod
tcod/libtcodpy.py
sys_set_renderer
def sys_set_renderer(renderer: int) -> None: """Change the current rendering mode to renderer. .. deprecated:: 2.0 RENDERER_GLSL and RENDERER_OPENGL are not currently available. """ lib.TCOD_sys_set_renderer(renderer) if tcod.console._root_console is not None: tcod.console.Console._g...
python
def sys_set_renderer(renderer: int) -> None: """Change the current rendering mode to renderer. .. deprecated:: 2.0 RENDERER_GLSL and RENDERER_OPENGL are not currently available. """ lib.TCOD_sys_set_renderer(renderer) if tcod.console._root_console is not None: tcod.console.Console._g...
[ "def", "sys_set_renderer", "(", "renderer", ":", "int", ")", "->", "None", ":", "lib", ".", "TCOD_sys_set_renderer", "(", "renderer", ")", "if", "tcod", ".", "console", ".", "_root_console", "is", "not", "None", ":", "tcod", ".", "console", ".", "Console",...
Change the current rendering mode to renderer. .. deprecated:: 2.0 RENDERER_GLSL and RENDERER_OPENGL are not currently available.
[ "Change", "the", "current", "rendering", "mode", "to", "renderer", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L3973-L3981
9,258
libtcod/python-tcod
tcod/libtcodpy.py
sys_save_screenshot
def sys_save_screenshot(name: Optional[str] = None) -> None: """Save a screenshot to a file. By default this will automatically save screenshots in the working directory. The automatic names are formatted as screenshotNNN.png. For example: screenshot000.png, screenshot001.png, etc. Whichever is ...
python
def sys_save_screenshot(name: Optional[str] = None) -> None: """Save a screenshot to a file. By default this will automatically save screenshots in the working directory. The automatic names are formatted as screenshotNNN.png. For example: screenshot000.png, screenshot001.png, etc. Whichever is ...
[ "def", "sys_save_screenshot", "(", "name", ":", "Optional", "[", "str", "]", "=", "None", ")", "->", "None", ":", "lib", ".", "TCOD_sys_save_screenshot", "(", "_bytes", "(", "name", ")", "if", "name", "is", "not", "None", "else", "ffi", ".", "NULL", ")...
Save a screenshot to a file. By default this will automatically save screenshots in the working directory. The automatic names are formatted as screenshotNNN.png. For example: screenshot000.png, screenshot001.png, etc. Whichever is available first. Args: file Optional[AnyStr]: File path...
[ "Save", "a", "screenshot", "to", "a", "file", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L3992-L4006
9,259
libtcod/python-tcod
tcod/libtcodpy.py
sys_update_char
def sys_update_char( asciiCode: int, fontx: int, fonty: int, img: tcod.image.Image, x: int, y: int, ) -> None: """Dynamically update the current font with img. All cells using this asciiCode will be updated at the next call to :any:`tcod.console_flush`. Args: asciiCode ...
python
def sys_update_char( asciiCode: int, fontx: int, fonty: int, img: tcod.image.Image, x: int, y: int, ) -> None: """Dynamically update the current font with img. All cells using this asciiCode will be updated at the next call to :any:`tcod.console_flush`. Args: asciiCode ...
[ "def", "sys_update_char", "(", "asciiCode", ":", "int", ",", "fontx", ":", "int", ",", "fonty", ":", "int", ",", "img", ":", "tcod", ".", "image", ".", "Image", ",", "x", ":", "int", ",", "y", ":", "int", ",", ")", "->", "None", ":", "lib", "."...
Dynamically update the current font with img. All cells using this asciiCode will be updated at the next call to :any:`tcod.console_flush`. Args: asciiCode (int): Ascii code corresponding to the character to update. fontx (int): Left coordinate of the character in the ...
[ "Dynamically", "update", "the", "current", "font", "with", "img", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L4054-L4077
9,260
libtcod/python-tcod
tcod/libtcodpy.py
sys_register_SDL_renderer
def sys_register_SDL_renderer(callback: Callable[[Any], None]) -> None: """Register a custom randering function with libtcod. Note: This callback will only be called by the SDL renderer. The callack will receive a :any:`CData <ffi-cdata>` void* to an SDL_Surface* struct. The callback is c...
python
def sys_register_SDL_renderer(callback: Callable[[Any], None]) -> None: """Register a custom randering function with libtcod. Note: This callback will only be called by the SDL renderer. The callack will receive a :any:`CData <ffi-cdata>` void* to an SDL_Surface* struct. The callback is c...
[ "def", "sys_register_SDL_renderer", "(", "callback", ":", "Callable", "[", "[", "Any", "]", ",", "None", "]", ")", "->", "None", ":", "with", "_PropagateException", "(", ")", "as", "propagate", ":", "@", "ffi", ".", "def_extern", "(", "onerror", "=", "pr...
Register a custom randering function with libtcod. Note: This callback will only be called by the SDL renderer. The callack will receive a :any:`CData <ffi-cdata>` void* to an SDL_Surface* struct. The callback is called on every call to :any:`tcod.console_flush`. Args: callback C...
[ "Register", "a", "custom", "randering", "function", "with", "libtcod", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L4081-L4102
9,261
libtcod/python-tcod
tcod/libtcodpy.py
sys_check_for_event
def sys_check_for_event( mask: int, k: Optional[Key], m: Optional[Mouse] ) -> int: """Check for and return an event. Args: mask (int): :any:`Event types` to wait for. k (Optional[Key]): A tcod.Key instance which might be updated with an event. Can be None. ...
python
def sys_check_for_event( mask: int, k: Optional[Key], m: Optional[Mouse] ) -> int: """Check for and return an event. Args: mask (int): :any:`Event types` to wait for. k (Optional[Key]): A tcod.Key instance which might be updated with an event. Can be None. ...
[ "def", "sys_check_for_event", "(", "mask", ":", "int", ",", "k", ":", "Optional", "[", "Key", "]", ",", "m", ":", "Optional", "[", "Mouse", "]", ")", "->", "int", ":", "return", "int", "(", "lib", ".", "TCOD_sys_check_for_event", "(", "mask", ",", "k...
Check for and return an event. Args: mask (int): :any:`Event types` to wait for. k (Optional[Key]): A tcod.Key instance which might be updated with an event. Can be None. m (Optional[Mouse]): A tcod.Mouse instance which might be updated ...
[ "Check", "for", "and", "return", "an", "event", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L4106-L4125
9,262
libtcod/python-tcod
tcod/libtcodpy.py
sys_wait_for_event
def sys_wait_for_event( mask: int, k: Optional[Key], m: Optional[Mouse], flush: bool ) -> int: """Wait for an event then return. If flush is True then the buffer will be cleared before waiting. Otherwise each available event will be returned in the order they're recieved. Args: mask (int):...
python
def sys_wait_for_event( mask: int, k: Optional[Key], m: Optional[Mouse], flush: bool ) -> int: """Wait for an event then return. If flush is True then the buffer will be cleared before waiting. Otherwise each available event will be returned in the order they're recieved. Args: mask (int):...
[ "def", "sys_wait_for_event", "(", "mask", ":", "int", ",", "k", ":", "Optional", "[", "Key", "]", ",", "m", ":", "Optional", "[", "Mouse", "]", ",", "flush", ":", "bool", ")", "->", "int", ":", "return", "int", "(", "lib", ".", "TCOD_sys_wait_for_eve...
Wait for an event then return. If flush is True then the buffer will be cleared before waiting. Otherwise each available event will be returned in the order they're recieved. Args: mask (int): :any:`Event types` to wait for. k (Optional[Key]): A tcod.Key instance which might be updated wit...
[ "Wait", "for", "an", "event", "then", "return", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L4129-L4155
9,263
libtcod/python-tcod
tcod/libtcodpy.py
_atexit_verify
def _atexit_verify() -> None: """Warns if the libtcod root console is implicitly deleted.""" if lib.TCOD_ctx.root: warnings.warn( "The libtcod root console was implicitly deleted.\n" "Make sure the 'with' statement is used with the root console to" " ensure that it cl...
python
def _atexit_verify() -> None: """Warns if the libtcod root console is implicitly deleted.""" if lib.TCOD_ctx.root: warnings.warn( "The libtcod root console was implicitly deleted.\n" "Make sure the 'with' statement is used with the root console to" " ensure that it cl...
[ "def", "_atexit_verify", "(", ")", "->", "None", ":", "if", "lib", ".", "TCOD_ctx", ".", "root", ":", "warnings", ".", "warn", "(", "\"The libtcod root console was implicitly deleted.\\n\"", "\"Make sure the 'with' statement is used with the root console to\"", "\" ensure tha...
Warns if the libtcod root console is implicitly deleted.
[ "Warns", "if", "the", "libtcod", "root", "console", "is", "implicitly", "deleted", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L4179-L4189
9,264
libtcod/python-tcod
tcod/libtcodpy.py
ConsoleBuffer.clear
def clear( self, back_r: int = 0, back_g: int = 0, back_b: int = 0, fore_r: int = 0, fore_g: int = 0, fore_b: int = 0, char: str = " ", ) -> None: """Clears the console. Values to fill it with are optional, defaults to black with no ch...
python
def clear( self, back_r: int = 0, back_g: int = 0, back_b: int = 0, fore_r: int = 0, fore_g: int = 0, fore_b: int = 0, char: str = " ", ) -> None: """Clears the console. Values to fill it with are optional, defaults to black with no ch...
[ "def", "clear", "(", "self", ",", "back_r", ":", "int", "=", "0", ",", "back_g", ":", "int", "=", "0", ",", "back_b", ":", "int", "=", "0", ",", "fore_r", ":", "int", "=", "0", ",", "fore_g", ":", "int", "=", "0", ",", "fore_b", ":", "int", ...
Clears the console. Values to fill it with are optional, defaults to black with no characters. Args: back_r (int): Red background color, from 0 to 255. back_g (int): Green background color, from 0 to 255. back_b (int): Blue background color, from 0 to 255. ...
[ "Clears", "the", "console", ".", "Values", "to", "fill", "it", "with", "are", "optional", "defaults", "to", "black", "with", "no", "characters", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L120-L149
9,265
libtcod/python-tcod
tcod/libtcodpy.py
ConsoleBuffer.copy
def copy(self) -> "ConsoleBuffer": """Returns a copy of this ConsoleBuffer. Returns: ConsoleBuffer: A new ConsoleBuffer copy. """ other = ConsoleBuffer(0, 0) # type: "ConsoleBuffer" other.width = self.width other.height = self.height other.back_r = l...
python
def copy(self) -> "ConsoleBuffer": """Returns a copy of this ConsoleBuffer. Returns: ConsoleBuffer: A new ConsoleBuffer copy. """ other = ConsoleBuffer(0, 0) # type: "ConsoleBuffer" other.width = self.width other.height = self.height other.back_r = l...
[ "def", "copy", "(", "self", ")", "->", "\"ConsoleBuffer\"", ":", "other", "=", "ConsoleBuffer", "(", "0", ",", "0", ")", "# type: \"ConsoleBuffer\"", "other", ".", "width", "=", "self", ".", "width", "other", ".", "height", "=", "self", ".", "height", "o...
Returns a copy of this ConsoleBuffer. Returns: ConsoleBuffer: A new ConsoleBuffer copy.
[ "Returns", "a", "copy", "of", "this", "ConsoleBuffer", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L151-L167
9,266
libtcod/python-tcod
tcod/libtcodpy.py
ConsoleBuffer.set_fore
def set_fore( self, x: int, y: int, r: int, g: int, b: int, char: str ) -> None: """Set the character and foreground color of one cell. Args: x (int): X position to change. y (int): Y position to change. r (int): Red foreground color, from 0 to 255. ...
python
def set_fore( self, x: int, y: int, r: int, g: int, b: int, char: str ) -> None: """Set the character and foreground color of one cell. Args: x (int): X position to change. y (int): Y position to change. r (int): Red foreground color, from 0 to 255. ...
[ "def", "set_fore", "(", "self", ",", "x", ":", "int", ",", "y", ":", "int", ",", "r", ":", "int", ",", "g", ":", "int", ",", "b", ":", "int", ",", "char", ":", "str", ")", "->", "None", ":", "i", "=", "self", ".", "width", "*", "y", "+", ...
Set the character and foreground color of one cell. Args: x (int): X position to change. y (int): Y position to change. r (int): Red foreground color, from 0 to 255. g (int): Green foreground color, from 0 to 255. b (int): Blue foreground color, from ...
[ "Set", "the", "character", "and", "foreground", "color", "of", "one", "cell", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L169-L186
9,267
libtcod/python-tcod
tcod/libtcodpy.py
ConsoleBuffer.set_back
def set_back(self, x: int, y: int, r: int, g: int, b: int) -> None: """Set the background color of one cell. Args: x (int): X position to change. y (int): Y position to change. r (int): Red background color, from 0 to 255. g (int): Green background color,...
python
def set_back(self, x: int, y: int, r: int, g: int, b: int) -> None: """Set the background color of one cell. Args: x (int): X position to change. y (int): Y position to change. r (int): Red background color, from 0 to 255. g (int): Green background color,...
[ "def", "set_back", "(", "self", ",", "x", ":", "int", ",", "y", ":", "int", ",", "r", ":", "int", ",", "g", ":", "int", ",", "b", ":", "int", ")", "->", "None", ":", "i", "=", "self", ".", "width", "*", "y", "+", "x", "self", ".", "back_r...
Set the background color of one cell. Args: x (int): X position to change. y (int): Y position to change. r (int): Red background color, from 0 to 255. g (int): Green background color, from 0 to 255. b (int): Blue background color, from 0 to 255.
[ "Set", "the", "background", "color", "of", "one", "cell", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L188-L201
9,268
libtcod/python-tcod
tcod/libtcodpy.py
ConsoleBuffer.set
def set( self, x: int, y: int, back_r: int, back_g: int, back_b: int, fore_r: int, fore_g: int, fore_b: int, char: str, ) -> None: """Set the background color, foreground color and character of one cell. Args: ...
python
def set( self, x: int, y: int, back_r: int, back_g: int, back_b: int, fore_r: int, fore_g: int, fore_b: int, char: str, ) -> None: """Set the background color, foreground color and character of one cell. Args: ...
[ "def", "set", "(", "self", ",", "x", ":", "int", ",", "y", ":", "int", ",", "back_r", ":", "int", ",", "back_g", ":", "int", ",", "back_b", ":", "int", ",", "fore_r", ":", "int", ",", "fore_g", ":", "int", ",", "fore_b", ":", "int", ",", "cha...
Set the background color, foreground color and character of one cell. Args: x (int): X position to change. y (int): Y position to change. back_r (int): Red background color, from 0 to 255. back_g (int): Green background color, from 0 to 255. back_b (i...
[ "Set", "the", "background", "color", "foreground", "color", "and", "character", "of", "one", "cell", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L203-L235
9,269
libtcod/python-tcod
tcod/libtcodpy.py
ConsoleBuffer.blit
def blit( self, dest: tcod.console.Console, fill_fore: bool = True, fill_back: bool = True, ) -> None: """Use libtcod's "fill" functions to write the buffer to a console. Args: dest (Console): Console object to modify. fill_fore (bool): ...
python
def blit( self, dest: tcod.console.Console, fill_fore: bool = True, fill_back: bool = True, ) -> None: """Use libtcod's "fill" functions to write the buffer to a console. Args: dest (Console): Console object to modify. fill_fore (bool): ...
[ "def", "blit", "(", "self", ",", "dest", ":", "tcod", ".", "console", ".", "Console", ",", "fill_fore", ":", "bool", "=", "True", ",", "fill_back", ":", "bool", "=", "True", ",", ")", "->", "None", ":", "if", "not", "dest", ":", "dest", "=", "tco...
Use libtcod's "fill" functions to write the buffer to a console. Args: dest (Console): Console object to modify. fill_fore (bool): If True, fill the foreground color and characters. fill_back (bool): If True, fill the background color.
[ "Use", "libtcod", "s", "fill", "functions", "to", "write", "the", "buffer", "to", "a", "console", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L237-L271
9,270
libtcod/python-tcod
tcod/image.py
Image.clear
def clear(self, color: Tuple[int, int, int]) -> None: """Fill this entire Image with color. Args: color (Union[Tuple[int, int, int], Sequence[int]]): An (r, g, b) sequence or Color instance. """ lib.TCOD_image_clear(self.image_c, color)
python
def clear(self, color: Tuple[int, int, int]) -> None: """Fill this entire Image with color. Args: color (Union[Tuple[int, int, int], Sequence[int]]): An (r, g, b) sequence or Color instance. """ lib.TCOD_image_clear(self.image_c, color)
[ "def", "clear", "(", "self", ",", "color", ":", "Tuple", "[", "int", ",", "int", ",", "int", "]", ")", "->", "None", ":", "lib", ".", "TCOD_image_clear", "(", "self", ".", "image_c", ",", "color", ")" ]
Fill this entire Image with color. Args: color (Union[Tuple[int, int, int], Sequence[int]]): An (r, g, b) sequence or Color instance.
[ "Fill", "this", "entire", "Image", "with", "color", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/image.py#L59-L66
9,271
libtcod/python-tcod
tcod/image.py
Image.scale
def scale(self, width: int, height: int) -> None: """Scale this Image to the new width and height. Args: width (int): The new width of the Image after scaling. height (int): The new height of the Image after scaling. """ lib.TCOD_image_scale(self.image_c, width, ...
python
def scale(self, width: int, height: int) -> None: """Scale this Image to the new width and height. Args: width (int): The new width of the Image after scaling. height (int): The new height of the Image after scaling. """ lib.TCOD_image_scale(self.image_c, width, ...
[ "def", "scale", "(", "self", ",", "width", ":", "int", ",", "height", ":", "int", ")", "->", "None", ":", "lib", ".", "TCOD_image_scale", "(", "self", ".", "image_c", ",", "width", ",", "height", ")", "self", ".", "width", ",", "self", ".", "height...
Scale this Image to the new width and height. Args: width (int): The new width of the Image after scaling. height (int): The new height of the Image after scaling.
[ "Scale", "this", "Image", "to", "the", "new", "width", "and", "height", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/image.py#L88-L96
9,272
libtcod/python-tcod
tcod/image.py
Image.set_key_color
def set_key_color(self, color: Tuple[int, int, int]) -> None: """Set a color to be transparent during blitting functions. Args: color (Union[Tuple[int, int, int], Sequence[int]]): An (r, g, b) sequence or Color instance. """ lib.TCOD_image_set_key_color(self....
python
def set_key_color(self, color: Tuple[int, int, int]) -> None: """Set a color to be transparent during blitting functions. Args: color (Union[Tuple[int, int, int], Sequence[int]]): An (r, g, b) sequence or Color instance. """ lib.TCOD_image_set_key_color(self....
[ "def", "set_key_color", "(", "self", ",", "color", ":", "Tuple", "[", "int", ",", "int", ",", "int", "]", ")", "->", "None", ":", "lib", ".", "TCOD_image_set_key_color", "(", "self", ".", "image_c", ",", "color", ")" ]
Set a color to be transparent during blitting functions. Args: color (Union[Tuple[int, int, int], Sequence[int]]): An (r, g, b) sequence or Color instance.
[ "Set", "a", "color", "to", "be", "transparent", "during", "blitting", "functions", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/image.py#L98-L105
9,273
libtcod/python-tcod
tcod/image.py
Image.get_alpha
def get_alpha(self, x: int, y: int) -> int: """Get the Image alpha of the pixel at x, y. Args: x (int): X pixel of the image. Starting from the left at 0. y (int): Y pixel of the image. Starting from the top at 0. Returns: int: The alpha value of the pixel...
python
def get_alpha(self, x: int, y: int) -> int: """Get the Image alpha of the pixel at x, y. Args: x (int): X pixel of the image. Starting from the left at 0. y (int): Y pixel of the image. Starting from the top at 0. Returns: int: The alpha value of the pixel...
[ "def", "get_alpha", "(", "self", ",", "x", ":", "int", ",", "y", ":", "int", ")", "->", "int", ":", "return", "lib", ".", "TCOD_image_get_alpha", "(", "self", ".", "image_c", ",", "x", ",", "y", ")" ]
Get the Image alpha of the pixel at x, y. Args: x (int): X pixel of the image. Starting from the left at 0. y (int): Y pixel of the image. Starting from the top at 0. Returns: int: The alpha value of the pixel. With 0 being fully transparent and 255 be...
[ "Get", "the", "Image", "alpha", "of", "the", "pixel", "at", "x", "y", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/image.py#L107-L118
9,274
libtcod/python-tcod
tcod/image.py
Image.get_pixel
def get_pixel(self, x: int, y: int) -> Tuple[int, int, int]: """Get the color of a pixel in this Image. Args: x (int): X pixel of the Image. Starting from the left at 0. y (int): Y pixel of the Image. Starting from the top at 0. Returns: Tuple[int, int, in...
python
def get_pixel(self, x: int, y: int) -> Tuple[int, int, int]: """Get the color of a pixel in this Image. Args: x (int): X pixel of the Image. Starting from the left at 0. y (int): Y pixel of the Image. Starting from the top at 0. Returns: Tuple[int, int, in...
[ "def", "get_pixel", "(", "self", ",", "x", ":", "int", ",", "y", ":", "int", ")", "->", "Tuple", "[", "int", ",", "int", ",", "int", "]", ":", "color", "=", "lib", ".", "TCOD_image_get_pixel", "(", "self", ".", "image_c", ",", "x", ",", "y", ")...
Get the color of a pixel in this Image. Args: x (int): X pixel of the Image. Starting from the left at 0. y (int): Y pixel of the Image. Starting from the top at 0. Returns: Tuple[int, int, int]: An (r, g, b) tuple containing the pixels color value...
[ "Get", "the", "color", "of", "a", "pixel", "in", "this", "Image", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/image.py#L145-L158
9,275
libtcod/python-tcod
tcod/image.py
Image.get_mipmap_pixel
def get_mipmap_pixel( self, left: float, top: float, right: float, bottom: float ) -> Tuple[int, int, int]: """Get the average color of a rectangle in this Image. Parameters should stay within the following limits: * 0 <= left < right < Image.width * 0 <= top < bottom < Imag...
python
def get_mipmap_pixel( self, left: float, top: float, right: float, bottom: float ) -> Tuple[int, int, int]: """Get the average color of a rectangle in this Image. Parameters should stay within the following limits: * 0 <= left < right < Image.width * 0 <= top < bottom < Imag...
[ "def", "get_mipmap_pixel", "(", "self", ",", "left", ":", "float", ",", "top", ":", "float", ",", "right", ":", "float", ",", "bottom", ":", "float", ")", "->", "Tuple", "[", "int", ",", "int", ",", "int", "]", ":", "color", "=", "lib", ".", "TCO...
Get the average color of a rectangle in this Image. Parameters should stay within the following limits: * 0 <= left < right < Image.width * 0 <= top < bottom < Image.height Args: left (float): Left corner of the region. top (float): Top corner of the region. ...
[ "Get", "the", "average", "color", "of", "a", "rectangle", "in", "this", "Image", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/image.py#L160-L183
9,276
libtcod/python-tcod
tcod/image.py
Image.put_pixel
def put_pixel(self, x: int, y: int, color: Tuple[int, int, int]) -> None: """Change a pixel on this Image. Args: x (int): X pixel of the Image. Starting from the left at 0. y (int): Y pixel of the Image. Starting from the top at 0. color (Union[Tuple[int, int, int]...
python
def put_pixel(self, x: int, y: int, color: Tuple[int, int, int]) -> None: """Change a pixel on this Image. Args: x (int): X pixel of the Image. Starting from the left at 0. y (int): Y pixel of the Image. Starting from the top at 0. color (Union[Tuple[int, int, int]...
[ "def", "put_pixel", "(", "self", ",", "x", ":", "int", ",", "y", ":", "int", ",", "color", ":", "Tuple", "[", "int", ",", "int", ",", "int", "]", ")", "->", "None", ":", "lib", ".", "TCOD_image_put_pixel", "(", "self", ".", "image_c", ",", "x", ...
Change a pixel on this Image. Args: x (int): X pixel of the Image. Starting from the left at 0. y (int): Y pixel of the Image. Starting from the top at 0. color (Union[Tuple[int, int, int], Sequence[int]]): An (r, g, b) sequence or Color instance.
[ "Change", "a", "pixel", "on", "this", "Image", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/image.py#L185-L194
9,277
libtcod/python-tcod
tcod/image.py
Image.blit
def blit( self, console: tcod.console.Console, x: float, y: float, bg_blend: int, scale_x: float, scale_y: float, angle: float, ) -> None: """Blit onto a Console using scaling and rotation. Args: console (Console): Blit des...
python
def blit( self, console: tcod.console.Console, x: float, y: float, bg_blend: int, scale_x: float, scale_y: float, angle: float, ) -> None: """Blit onto a Console using scaling and rotation. Args: console (Console): Blit des...
[ "def", "blit", "(", "self", ",", "console", ":", "tcod", ".", "console", ".", "Console", ",", "x", ":", "float", ",", "y", ":", "float", ",", "bg_blend", ":", "int", ",", "scale_x", ":", "float", ",", "scale_y", ":", "float", ",", "angle", ":", "...
Blit onto a Console using scaling and rotation. Args: console (Console): Blit destination Console. x (float): Console X position for the center of the Image blit. y (float): Console Y position for the center of the Image blit. The Image blit is centered ...
[ "Blit", "onto", "a", "Console", "using", "scaling", "and", "rotation", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/image.py#L196-L229
9,278
libtcod/python-tcod
tcod/image.py
Image.blit_rect
def blit_rect( self, console: tcod.console.Console, x: int, y: int, width: int, height: int, bg_blend: int, ) -> None: """Blit onto a Console without scaling or rotation. Args: console (Console): Blit destination Console. ...
python
def blit_rect( self, console: tcod.console.Console, x: int, y: int, width: int, height: int, bg_blend: int, ) -> None: """Blit onto a Console without scaling or rotation. Args: console (Console): Blit destination Console. ...
[ "def", "blit_rect", "(", "self", ",", "console", ":", "tcod", ".", "console", ".", "Console", ",", "x", ":", "int", ",", "y", ":", "int", ",", "width", ":", "int", ",", "height", ":", "int", ",", "bg_blend", ":", "int", ",", ")", "->", "None", ...
Blit onto a Console without scaling or rotation. Args: console (Console): Blit destination Console. x (int): Console tile X position starting from the left at 0. y (int): Console tile Y position starting from the top at 0. width (int): Use -1 for Image width. ...
[ "Blit", "onto", "a", "Console", "without", "scaling", "or", "rotation", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/image.py#L231-L252
9,279
libtcod/python-tcod
tcod/image.py
Image.blit_2x
def blit_2x( self, console: tcod.console.Console, dest_x: int, dest_y: int, img_x: int = 0, img_y: int = 0, img_width: int = -1, img_height: int = -1, ) -> None: """Blit onto a Console with double resolution. Args: console ...
python
def blit_2x( self, console: tcod.console.Console, dest_x: int, dest_y: int, img_x: int = 0, img_y: int = 0, img_width: int = -1, img_height: int = -1, ) -> None: """Blit onto a Console with double resolution. Args: console ...
[ "def", "blit_2x", "(", "self", ",", "console", ":", "tcod", ".", "console", ".", "Console", ",", "dest_x", ":", "int", ",", "dest_y", ":", "int", ",", "img_x", ":", "int", "=", "0", ",", "img_y", ":", "int", "=", "0", ",", "img_width", ":", "int"...
Blit onto a Console with double resolution. Args: console (Console): Blit destination Console. dest_x (int): Console tile X position starting from the left at 0. dest_y (int): Console tile Y position starting from the top at 0. img_x (int): Left corner pixel of t...
[ "Blit", "onto", "a", "Console", "with", "double", "resolution", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/image.py#L254-L286
9,280
libtcod/python-tcod
tcod/image.py
Image.save_as
def save_as(self, filename: str) -> None: """Save the Image to a 32-bit .bmp or .png file. Args: filename (Text): File path to same this Image. """ lib.TCOD_image_save(self.image_c, filename.encode("utf-8"))
python
def save_as(self, filename: str) -> None: """Save the Image to a 32-bit .bmp or .png file. Args: filename (Text): File path to same this Image. """ lib.TCOD_image_save(self.image_c, filename.encode("utf-8"))
[ "def", "save_as", "(", "self", ",", "filename", ":", "str", ")", "->", "None", ":", "lib", ".", "TCOD_image_save", "(", "self", ".", "image_c", ",", "filename", ".", "encode", "(", "\"utf-8\"", ")", ")" ]
Save the Image to a 32-bit .bmp or .png file. Args: filename (Text): File path to same this Image.
[ "Save", "the", "Image", "to", "a", "32", "-", "bit", ".", "bmp", "or", ".", "png", "file", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/image.py#L288-L294
9,281
libtcod/python-tcod
examples/sdlevent.py
main
def main(): """Example program for tcod.event""" WIDTH, HEIGHT = 120, 60 TITLE = None with tcod.console_init_root(WIDTH, HEIGHT, TITLE, order="F", renderer=tcod.RENDERER_SDL) as console: tcod.sys_set_fps(24) while True: tcod.console_flush() ...
python
def main(): """Example program for tcod.event""" WIDTH, HEIGHT = 120, 60 TITLE = None with tcod.console_init_root(WIDTH, HEIGHT, TITLE, order="F", renderer=tcod.RENDERER_SDL) as console: tcod.sys_set_fps(24) while True: tcod.console_flush() ...
[ "def", "main", "(", ")", ":", "WIDTH", ",", "HEIGHT", "=", "120", ",", "60", "TITLE", "=", "None", "with", "tcod", ".", "console_init_root", "(", "WIDTH", ",", "HEIGHT", ",", "TITLE", ",", "order", "=", "\"F\"", ",", "renderer", "=", "tcod", ".", "...
Example program for tcod.event
[ "Example", "program", "for", "tcod", ".", "event" ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/examples/sdlevent.py#L7-L27
9,282
libtcod/python-tcod
scripts/tag_release.py
parse_changelog
def parse_changelog(args: Any) -> Tuple[str, str]: """Return an updated changelog and and the list of changes.""" with open("CHANGELOG.rst", "r") as file: match = re.match( pattern=r"(.*?Unreleased\n---+\n)(.+?)(\n*[^\n]+\n---+\n.*)", string=file.read(), flags=re.DOTA...
python
def parse_changelog(args: Any) -> Tuple[str, str]: """Return an updated changelog and and the list of changes.""" with open("CHANGELOG.rst", "r") as file: match = re.match( pattern=r"(.*?Unreleased\n---+\n)(.+?)(\n*[^\n]+\n---+\n.*)", string=file.read(), flags=re.DOTA...
[ "def", "parse_changelog", "(", "args", ":", "Any", ")", "->", "Tuple", "[", "str", ",", "str", "]", ":", "with", "open", "(", "\"CHANGELOG.rst\"", ",", "\"r\"", ")", "as", "file", ":", "match", "=", "re", ".", "match", "(", "pattern", "=", "r\"(.*?Un...
Return an updated changelog and and the list of changes.
[ "Return", "an", "updated", "changelog", "and", "and", "the", "list", "of", "changes", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/scripts/tag_release.py#L29-L45
9,283
libtcod/python-tcod
tcod/bsp.py
BSP.split_once
def split_once(self, horizontal: bool, position: int) -> None: """Split this partition into 2 sub-partitions. Args: horizontal (bool): position (int): """ cdata = self._as_cdata() lib.TCOD_bsp_split_once(cdata, horizontal, position) self._unpack_b...
python
def split_once(self, horizontal: bool, position: int) -> None: """Split this partition into 2 sub-partitions. Args: horizontal (bool): position (int): """ cdata = self._as_cdata() lib.TCOD_bsp_split_once(cdata, horizontal, position) self._unpack_b...
[ "def", "split_once", "(", "self", ",", "horizontal", ":", "bool", ",", "position", ":", "int", ")", "->", "None", ":", "cdata", "=", "self", ".", "_as_cdata", "(", ")", "lib", ".", "TCOD_bsp_split_once", "(", "cdata", ",", "horizontal", ",", "position", ...
Split this partition into 2 sub-partitions. Args: horizontal (bool): position (int):
[ "Split", "this", "partition", "into", "2", "sub", "-", "partitions", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/bsp.py#L131-L140
9,284
libtcod/python-tcod
tcod/bsp.py
BSP.split_recursive
def split_recursive( self, depth: int, min_width: int, min_height: int, max_horizontal_ratio: float, max_vertical_ratio: float, seed: Optional[tcod.random.Random] = None, ) -> None: """Divide this partition recursively. Args: depth...
python
def split_recursive( self, depth: int, min_width: int, min_height: int, max_horizontal_ratio: float, max_vertical_ratio: float, seed: Optional[tcod.random.Random] = None, ) -> None: """Divide this partition recursively. Args: depth...
[ "def", "split_recursive", "(", "self", ",", "depth", ":", "int", ",", "min_width", ":", "int", ",", "min_height", ":", "int", ",", "max_horizontal_ratio", ":", "float", ",", "max_vertical_ratio", ":", "float", ",", "seed", ":", "Optional", "[", "tcod", "."...
Divide this partition recursively. Args: depth (int): The maximum depth to divide this object recursively. min_width (int): The minimum width of any individual partition. min_height (int): The minimum height of any individual partition. max_horizontal_ratio (floa...
[ "Divide", "this", "partition", "recursively", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/bsp.py#L142-L174
9,285
libtcod/python-tcod
tcod/bsp.py
BSP.in_order
def in_order(self) -> Iterator["BSP"]: """Iterate over this BSP's hierarchy in order. .. versionadded:: 8.3 """ if self.children: yield from self.children[0].in_order() yield self yield from self.children[1].in_order() else: yield ...
python
def in_order(self) -> Iterator["BSP"]: """Iterate over this BSP's hierarchy in order. .. versionadded:: 8.3 """ if self.children: yield from self.children[0].in_order() yield self yield from self.children[1].in_order() else: yield ...
[ "def", "in_order", "(", "self", ")", "->", "Iterator", "[", "\"BSP\"", "]", ":", "if", "self", ".", "children", ":", "yield", "from", "self", ".", "children", "[", "0", "]", ".", "in_order", "(", ")", "yield", "self", "yield", "from", "self", ".", ...
Iterate over this BSP's hierarchy in order. .. versionadded:: 8.3
[ "Iterate", "over", "this", "BSP", "s", "hierarchy", "in", "order", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/bsp.py#L194-L204
9,286
libtcod/python-tcod
tcod/bsp.py
BSP.level_order
def level_order(self) -> Iterator["BSP"]: """Iterate over this BSP's hierarchy in level order. .. versionadded:: 8.3 """ next = [self] # type: List['BSP'] while next: level = next # type: List['BSP'] next = [] yield from level fo...
python
def level_order(self) -> Iterator["BSP"]: """Iterate over this BSP's hierarchy in level order. .. versionadded:: 8.3 """ next = [self] # type: List['BSP'] while next: level = next # type: List['BSP'] next = [] yield from level fo...
[ "def", "level_order", "(", "self", ")", "->", "Iterator", "[", "\"BSP\"", "]", ":", "next", "=", "[", "self", "]", "# type: List['BSP']", "while", "next", ":", "level", "=", "next", "# type: List['BSP']", "next", "=", "[", "]", "yield", "from", "level", ...
Iterate over this BSP's hierarchy in level order. .. versionadded:: 8.3
[ "Iterate", "over", "this", "BSP", "s", "hierarchy", "in", "level", "order", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/bsp.py#L215-L226
9,287
libtcod/python-tcod
tcod/bsp.py
BSP.inverted_level_order
def inverted_level_order(self) -> Iterator["BSP"]: """Iterate over this BSP's hierarchy in inverse level order. .. versionadded:: 8.3 """ levels = [] # type: List[List['BSP']] next = [self] # type: List['BSP'] while next: levels.append(next) lev...
python
def inverted_level_order(self) -> Iterator["BSP"]: """Iterate over this BSP's hierarchy in inverse level order. .. versionadded:: 8.3 """ levels = [] # type: List[List['BSP']] next = [self] # type: List['BSP'] while next: levels.append(next) lev...
[ "def", "inverted_level_order", "(", "self", ")", "->", "Iterator", "[", "\"BSP\"", "]", ":", "levels", "=", "[", "]", "# type: List[List['BSP']]", "next", "=", "[", "self", "]", "# type: List['BSP']", "while", "next", ":", "levels", ".", "append", "(", "next...
Iterate over this BSP's hierarchy in inverse level order. .. versionadded:: 8.3
[ "Iterate", "over", "this", "BSP", "s", "hierarchy", "in", "inverse", "level", "order", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/bsp.py#L228-L242
9,288
libtcod/python-tcod
tcod/bsp.py
BSP.contains
def contains(self, x: int, y: int) -> bool: """Returns True if this node contains these coordinates. Args: x (int): X position to check. y (int): Y position to check. Returns: bool: True if this node contains these coordinates. Otherwise Fa...
python
def contains(self, x: int, y: int) -> bool: """Returns True if this node contains these coordinates. Args: x (int): X position to check. y (int): Y position to check. Returns: bool: True if this node contains these coordinates. Otherwise Fa...
[ "def", "contains", "(", "self", ",", "x", ":", "int", ",", "y", ":", "int", ")", "->", "bool", ":", "return", "(", "self", ".", "x", "<=", "x", "<", "self", ".", "x", "+", "self", ".", "width", "and", "self", ".", "y", "<=", "y", "<", "self...
Returns True if this node contains these coordinates. Args: x (int): X position to check. y (int): Y position to check. Returns: bool: True if this node contains these coordinates. Otherwise False.
[ "Returns", "True", "if", "this", "node", "contains", "these", "coordinates", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/bsp.py#L244-L258
9,289
libtcod/python-tcod
tcod/bsp.py
BSP.find_node
def find_node(self, x: int, y: int) -> Optional["BSP"]: """Return the deepest node which contains these coordinates. Returns: Optional[BSP]: BSP object or None. """ if not self.contains(x, y): return None for child in self.children: found = ch...
python
def find_node(self, x: int, y: int) -> Optional["BSP"]: """Return the deepest node which contains these coordinates. Returns: Optional[BSP]: BSP object or None. """ if not self.contains(x, y): return None for child in self.children: found = ch...
[ "def", "find_node", "(", "self", ",", "x", ":", "int", ",", "y", ":", "int", ")", "->", "Optional", "[", "\"BSP\"", "]", ":", "if", "not", "self", ".", "contains", "(", "x", ",", "y", ")", ":", "return", "None", "for", "child", "in", "self", "....
Return the deepest node which contains these coordinates. Returns: Optional[BSP]: BSP object or None.
[ "Return", "the", "deepest", "node", "which", "contains", "these", "coordinates", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/bsp.py#L260-L272
9,290
libtcod/python-tcod
tdl/style.py
backport
def backport(func): """ Backport a function name into an old style for compatibility. The docstring is updated to reflect that the new function returned is deprecated and that the other function is preferred. A DeprecationWarning is also raised for using this function. If t...
python
def backport(func): """ Backport a function name into an old style for compatibility. The docstring is updated to reflect that the new function returned is deprecated and that the other function is preferred. A DeprecationWarning is also raised for using this function. If t...
[ "def", "backport", "(", "func", ")", ":", "if", "not", "__debug__", ":", "return", "func", "@", "_functools", ".", "wraps", "(", "func", ")", "def", "deprecated_function", "(", "*", "args", ",", "*", "*", "kargs", ")", ":", "_warnings", ".", "warn", ...
Backport a function name into an old style for compatibility. The docstring is updated to reflect that the new function returned is deprecated and that the other function is preferred. A DeprecationWarning is also raised for using this function. If the script is run with an optimizatio...
[ "Backport", "a", "function", "name", "into", "an", "old", "style", "for", "compatibility", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tdl/style.py#L9-L29
9,291
libtcod/python-tcod
tdl/map.py
_get_fov_type
def _get_fov_type(fov): "Return a FOV from a string" oldFOV = fov fov = str(fov).upper() if fov in _FOVTYPES: return _FOVTYPES[fov] if fov[:10] == 'PERMISSIVE' and fov[10].isdigit() and fov[10] != '9': return 4 + int(fov[10]) raise _tdl.TDLError('No such fov option as %s' % oldFO...
python
def _get_fov_type(fov): "Return a FOV from a string" oldFOV = fov fov = str(fov).upper() if fov in _FOVTYPES: return _FOVTYPES[fov] if fov[:10] == 'PERMISSIVE' and fov[10].isdigit() and fov[10] != '9': return 4 + int(fov[10]) raise _tdl.TDLError('No such fov option as %s' % oldFO...
[ "def", "_get_fov_type", "(", "fov", ")", ":", "oldFOV", "=", "fov", "fov", "=", "str", "(", "fov", ")", ".", "upper", "(", ")", "if", "fov", "in", "_FOVTYPES", ":", "return", "_FOVTYPES", "[", "fov", "]", "if", "fov", "[", ":", "10", "]", "==", ...
Return a FOV from a string
[ "Return", "a", "FOV", "from", "a", "string" ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tdl/map.py#L29-L37
9,292
libtcod/python-tcod
tdl/map.py
quick_fov
def quick_fov(x, y, callback, fov='PERMISSIVE', radius=7.5, lightWalls=True, sphere=True): """All field-of-view functionality in one call. Before using this call be sure to make a function, lambda, or method that takes 2 positional parameters and returns True if light can pass through the til...
python
def quick_fov(x, y, callback, fov='PERMISSIVE', radius=7.5, lightWalls=True, sphere=True): """All field-of-view functionality in one call. Before using this call be sure to make a function, lambda, or method that takes 2 positional parameters and returns True if light can pass through the til...
[ "def", "quick_fov", "(", "x", ",", "y", ",", "callback", ",", "fov", "=", "'PERMISSIVE'", ",", "radius", "=", "7.5", ",", "lightWalls", "=", "True", ",", "sphere", "=", "True", ")", ":", "trueRadius", "=", "radius", "radius", "=", "int", "(", "_math"...
All field-of-view functionality in one call. Before using this call be sure to make a function, lambda, or method that takes 2 positional parameters and returns True if light can pass through the tile or False for light-blocking tiles and for indexes that are out of bounds of the dungeon. This fun...
[ "All", "field", "-", "of", "-", "view", "functionality", "in", "one", "call", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tdl/map.py#L235-L306
9,293
libtcod/python-tcod
tdl/map.py
bresenham
def bresenham(x1, y1, x2, y2): """ Return a list of points in a bresenham line. Implementation hastily copied from RogueBasin. Returns: List[Tuple[int, int]]: A list of (x, y) points, including both the start and end-points. """ points = [] issteep = abs(y2-y1) > abs(x2...
python
def bresenham(x1, y1, x2, y2): """ Return a list of points in a bresenham line. Implementation hastily copied from RogueBasin. Returns: List[Tuple[int, int]]: A list of (x, y) points, including both the start and end-points. """ points = [] issteep = abs(y2-y1) > abs(x2...
[ "def", "bresenham", "(", "x1", ",", "y1", ",", "x2", ",", "y2", ")", ":", "points", "=", "[", "]", "issteep", "=", "abs", "(", "y2", "-", "y1", ")", ">", "abs", "(", "x2", "-", "x1", ")", "if", "issteep", ":", "x1", ",", "y1", "=", "y1", ...
Return a list of points in a bresenham line. Implementation hastily copied from RogueBasin. Returns: List[Tuple[int, int]]: A list of (x, y) points, including both the start and end-points.
[ "Return", "a", "list", "of", "points", "in", "a", "bresenham", "line", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tdl/map.py#L308-L349
9,294
libtcod/python-tcod
tdl/map.py
Map.compute_fov
def compute_fov(self, x, y, fov='PERMISSIVE', radius=None, light_walls=True, sphere=True, cumulative=False): """Compute the field-of-view of this Map and return an iterator of the points touched. Args: x (int): Point of view, x-coordinate. y (int): Po...
python
def compute_fov(self, x, y, fov='PERMISSIVE', radius=None, light_walls=True, sphere=True, cumulative=False): """Compute the field-of-view of this Map and return an iterator of the points touched. Args: x (int): Point of view, x-coordinate. y (int): Po...
[ "def", "compute_fov", "(", "self", ",", "x", ",", "y", ",", "fov", "=", "'PERMISSIVE'", ",", "radius", "=", "None", ",", "light_walls", "=", "True", ",", "sphere", "=", "True", ",", "cumulative", "=", "False", ")", ":", "# refresh cdata", "if", "radius...
Compute the field-of-view of this Map and return an iterator of the points touched. Args: x (int): Point of view, x-coordinate. y (int): Point of view, y-coordinate. fov (Text): The type of field-of-view to be used. Available types are: ...
[ "Compute", "the", "field", "-", "of", "-", "view", "of", "this", "Map", "and", "return", "an", "iterator", "of", "the", "points", "touched", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tdl/map.py#L94-L130
9,295
libtcod/python-tcod
tdl/map.py
Map.compute_path
def compute_path(self, start_x, start_y, dest_x, dest_y, diagonal_cost=_math.sqrt(2)): """Get the shortest path between two points. Args: start_x (int): Starting x-position. start_y (int): Starting y-position. dest_x (int): Destination x-position...
python
def compute_path(self, start_x, start_y, dest_x, dest_y, diagonal_cost=_math.sqrt(2)): """Get the shortest path between two points. Args: start_x (int): Starting x-position. start_y (int): Starting y-position. dest_x (int): Destination x-position...
[ "def", "compute_path", "(", "self", ",", "start_x", ",", "start_y", ",", "dest_x", ",", "dest_y", ",", "diagonal_cost", "=", "_math", ".", "sqrt", "(", "2", ")", ")", ":", "return", "tcod", ".", "path", ".", "AStar", "(", "self", ",", "diagonal_cost", ...
Get the shortest path between two points. Args: start_x (int): Starting x-position. start_y (int): Starting y-position. dest_x (int): Destination x-position. dest_y (int): Destination y-position. diagonal_cost (float): Multiplier for diagonal movement...
[ "Get", "the", "shortest", "path", "between", "two", "points", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tdl/map.py#L133-L153
9,296
libtcod/python-tcod
tdl/map.py
AStar.get_path
def get_path(self, origX, origY, destX, destY): """ Get the shortest path from origXY to destXY. Returns: List[Tuple[int, int]]: Returns a list walking the path from orig to dest. This excludes the starting point and includes the destination. ...
python
def get_path(self, origX, origY, destX, destY): """ Get the shortest path from origXY to destXY. Returns: List[Tuple[int, int]]: Returns a list walking the path from orig to dest. This excludes the starting point and includes the destination. ...
[ "def", "get_path", "(", "self", ",", "origX", ",", "origY", ",", "destX", ",", "destY", ")", ":", "return", "super", "(", "AStar", ",", "self", ")", ".", "get_path", "(", "origX", ",", "origY", ",", "destX", ",", "destY", ")" ]
Get the shortest path from origXY to destXY. Returns: List[Tuple[int, int]]: Returns a list walking the path from orig to dest. This excludes the starting point and includes the destination. If no path is found then an empty list is returned.
[ "Get", "the", "shortest", "path", "from", "origXY", "to", "destXY", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tdl/map.py#L220-L232
9,297
libtcod/python-tcod
setup.py
get_long_description
def get_long_description(): """Return this projects description.""" with open("README.rst", "r") as f: readme = f.read() with open("CHANGELOG.rst", "r") as f: changelog = f.read() changelog = changelog.replace("\nUnreleased\n------------------", "") return "\n".join([readme, chan...
python
def get_long_description(): """Return this projects description.""" with open("README.rst", "r") as f: readme = f.read() with open("CHANGELOG.rst", "r") as f: changelog = f.read() changelog = changelog.replace("\nUnreleased\n------------------", "") return "\n".join([readme, chan...
[ "def", "get_long_description", "(", ")", ":", "with", "open", "(", "\"README.rst\"", ",", "\"r\"", ")", "as", "f", ":", "readme", "=", "f", ".", "read", "(", ")", "with", "open", "(", "\"CHANGELOG.rst\"", ",", "\"r\"", ")", "as", "f", ":", "changelog",...
Return this projects description.
[ "Return", "this", "projects", "description", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/setup.py#L78-L85
9,298
libtcod/python-tcod
tcod/console.py
get_height_rect
def get_height_rect(width: int, string: str) -> int: """Return the number of lines which would be printed from these parameters. `width` is the width of the print boundary. `string` is a Unicode string which may include color control characters. .. versionadded:: 9.2 """ string_ = string.enco...
python
def get_height_rect(width: int, string: str) -> int: """Return the number of lines which would be printed from these parameters. `width` is the width of the print boundary. `string` is a Unicode string which may include color control characters. .. versionadded:: 9.2 """ string_ = string.enco...
[ "def", "get_height_rect", "(", "width", ":", "int", ",", "string", ":", "str", ")", "->", "int", ":", "string_", "=", "string", ".", "encode", "(", "\"utf-8\"", ")", "# type: bytes", "return", "int", "(", "lib", ".", "get_height_rect2", "(", "width", ","...
Return the number of lines which would be printed from these parameters. `width` is the width of the print boundary. `string` is a Unicode string which may include color control characters. .. versionadded:: 9.2
[ "Return", "the", "number", "of", "lines", "which", "would", "be", "printed", "from", "these", "parameters", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/console.py#L1084-L1094
9,299
libtcod/python-tcod
tcod/console.py
Console._get_root
def _get_root(cls, order: Optional[str] = None) -> "Console": """Return a root console singleton with valid buffers. This function will also update an already active root console. """ global _root_console if _root_console is None: _root_console = object.__new__(cls) ...
python
def _get_root(cls, order: Optional[str] = None) -> "Console": """Return a root console singleton with valid buffers. This function will also update an already active root console. """ global _root_console if _root_console is None: _root_console = object.__new__(cls) ...
[ "def", "_get_root", "(", "cls", ",", "order", ":", "Optional", "[", "str", "]", "=", "None", ")", "->", "\"Console\"", ":", "global", "_root_console", "if", "_root_console", "is", "None", ":", "_root_console", "=", "object", ".", "__new__", "(", "cls", "...
Return a root console singleton with valid buffers. This function will also update an already active root console.
[ "Return", "a", "root", "console", "singleton", "with", "valid", "buffers", "." ]
8ba10c5cfb813eaf3e834de971ba2d6acb7838e4
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/console.py#L164-L177