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 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
libtcod/python-tcod | tcod/path.py | _get_pathcost_func | def _get_pathcost_func(
name: str
) -> Callable[[int, int, int, int, Any], float]:
"""Return a properly cast PathCostArray callback."""
return ffi.cast( # type: ignore
"TCOD_path_func_t", ffi.addressof(lib, name)
) | python | def _get_pathcost_func(
name: str
) -> Callable[[int, int, int, int, Any], float]:
"""Return a properly cast PathCostArray callback."""
return ffi.cast( # type: ignore
"TCOD_path_func_t", ffi.addressof(lib, name)
) | [
"def",
"_get_pathcost_func",
"(",
"name",
":",
"str",
")",
"->",
"Callable",
"[",
"[",
"int",
",",
"int",
",",
"int",
",",
"int",
",",
"Any",
"]",
",",
"float",
"]",
":",
"return",
"ffi",
".",
"cast",
"(",
"# type: ignore",
"\"TCOD_path_func_t\"",
",",... | Return a properly cast PathCostArray callback. | [
"Return",
"a",
"properly",
"cast",
"PathCostArray",
"callback",
"."
] | 8ba10c5cfb813eaf3e834de971ba2d6acb7838e4 | https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/path.py#L82-L88 | train |
libtcod/python-tcod | tcod/path.py | Dijkstra.set_goal | def set_goal(self, x: int, y: int) -> None:
"""Set the goal point and recompute the Dijkstra path-finder.
"""
lib.TCOD_dijkstra_compute(self._path_c, x, y) | python | def set_goal(self, x: int, y: int) -> None:
"""Set the goal point and recompute the Dijkstra path-finder.
"""
lib.TCOD_dijkstra_compute(self._path_c, x, y) | [
"def",
"set_goal",
"(",
"self",
",",
"x",
":",
"int",
",",
"y",
":",
"int",
")",
"->",
"None",
":",
"lib",
".",
"TCOD_dijkstra_compute",
"(",
"self",
".",
"_path_c",
",",
"x",
",",
"y",
")"
] | Set the goal point and recompute the Dijkstra path-finder. | [
"Set",
"the",
"goal",
"point",
"and",
"recompute",
"the",
"Dijkstra",
"path",
"-",
"finder",
"."
] | 8ba10c5cfb813eaf3e834de971ba2d6acb7838e4 | https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/path.py#L294-L297 | train |
libtcod/python-tcod | examples/termbox/termbox.py | Termbox.poll_event | def poll_event(self):
"""Wait for an event and return it.
Returns a tuple: (type, unicode character, key, mod, width, height,
mousex, mousey).
"""
"""
cdef tb_event e
with self._poll_lock:
with nogil:
result = tb_poll_event(&e)
... | python | def poll_event(self):
"""Wait for an event and return it.
Returns a tuple: (type, unicode character, key, mod, width, height,
mousex, mousey).
"""
"""
cdef tb_event e
with self._poll_lock:
with nogil:
result = tb_poll_event(&e)
... | [
"def",
"poll_event",
"(",
"self",
")",
":",
"\"\"\"\n cdef tb_event e\n with self._poll_lock:\n with nogil:\n result = tb_poll_event(&e)\n assert(result >= 0)\n if e.ch:\n uch = unichr(e.ch)\n else:\n uch = None\n ... | Wait for an event and return it.
Returns a tuple: (type, unicode character, key, mod, width, height,
mousex, mousey). | [
"Wait",
"for",
"an",
"event",
"and",
"return",
"it",
"."
] | 8ba10c5cfb813eaf3e834de971ba2d6acb7838e4 | https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/examples/termbox/termbox.py#L271-L293 | train |
libtcod/python-tcod | tcod/random.py | Random._new_from_cdata | def _new_from_cdata(cls, cdata: Any) -> "Random":
"""Return a new instance encapsulating this cdata."""
self = object.__new__(cls) # type: "Random"
self.random_c = cdata
return self | python | def _new_from_cdata(cls, cdata: Any) -> "Random":
"""Return a new instance encapsulating this cdata."""
self = object.__new__(cls) # type: "Random"
self.random_c = cdata
return self | [
"def",
"_new_from_cdata",
"(",
"cls",
",",
"cdata",
":",
"Any",
")",
"->",
"\"Random\"",
":",
"self",
"=",
"object",
".",
"__new__",
"(",
"cls",
")",
"# type: \"Random\"",
"self",
".",
"random_c",
"=",
"cdata",
"return",
"self"
] | Return a new instance encapsulating this cdata. | [
"Return",
"a",
"new",
"instance",
"encapsulating",
"this",
"cdata",
"."
] | 8ba10c5cfb813eaf3e834de971ba2d6acb7838e4 | https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/random.py#L58-L62 | train |
libtcod/python-tcod | tcod/random.py | Random.guass | def guass(self, mu: float, sigma: float) -> float:
"""Return a random number using Gaussian distribution.
Args:
mu (float): The median returned value.
sigma (float): The standard deviation.
Returns:
float: A random float.
"""
return float(
... | python | def guass(self, mu: float, sigma: float) -> float:
"""Return a random number using Gaussian distribution.
Args:
mu (float): The median returned value.
sigma (float): The standard deviation.
Returns:
float: A random float.
"""
return float(
... | [
"def",
"guass",
"(",
"self",
",",
"mu",
":",
"float",
",",
"sigma",
":",
"float",
")",
"->",
"float",
":",
"return",
"float",
"(",
"lib",
".",
"TCOD_random_get_gaussian_double",
"(",
"self",
".",
"random_c",
",",
"mu",
",",
"sigma",
")",
")"
] | Return a random number using Gaussian distribution.
Args:
mu (float): The median returned value.
sigma (float): The standard deviation.
Returns:
float: A random float. | [
"Return",
"a",
"random",
"number",
"using",
"Gaussian",
"distribution",
"."
] | 8ba10c5cfb813eaf3e834de971ba2d6acb7838e4 | https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/random.py#L88-L100 | train |
libtcod/python-tcod | tcod/random.py | Random.inverse_guass | def inverse_guass(self, mu: float, sigma: float) -> float:
"""Return a random Gaussian number using the Box-Muller transform.
Args:
mu (float): The median returned value.
sigma (float): The standard deviation.
Returns:
float: A random float.
"""
... | python | def inverse_guass(self, mu: float, sigma: float) -> float:
"""Return a random Gaussian number using the Box-Muller transform.
Args:
mu (float): The median returned value.
sigma (float): The standard deviation.
Returns:
float: A random float.
"""
... | [
"def",
"inverse_guass",
"(",
"self",
",",
"mu",
":",
"float",
",",
"sigma",
":",
"float",
")",
"->",
"float",
":",
"return",
"float",
"(",
"lib",
".",
"TCOD_random_get_gaussian_double_inv",
"(",
"self",
".",
"random_c",
",",
"mu",
",",
"sigma",
")",
")"
... | Return a random Gaussian number using the Box-Muller transform.
Args:
mu (float): The median returned value.
sigma (float): The standard deviation.
Returns:
float: A random float. | [
"Return",
"a",
"random",
"Gaussian",
"number",
"using",
"the",
"Box",
"-",
"Muller",
"transform",
"."
] | 8ba10c5cfb813eaf3e834de971ba2d6acb7838e4 | https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/random.py#L102-L114 | train |
libtcod/python-tcod | tdl/noise.py | Noise.get_point | def get_point(self, *position):
"""Return the noise value of a specific position.
Example usage: value = noise.getPoint(x, y, z)
Args:
position (Tuple[float, ...]): The point to sample at.
Returns:
float: The noise value at position.
This will ... | python | def get_point(self, *position):
"""Return the noise value of a specific position.
Example usage: value = noise.getPoint(x, y, z)
Args:
position (Tuple[float, ...]): The point to sample at.
Returns:
float: The noise value at position.
This will ... | [
"def",
"get_point",
"(",
"self",
",",
"*",
"position",
")",
":",
"#array = self._array",
"#for d, pos in enumerate(position):",
"# array[d] = pos",
"#array = self._cFloatArray(*position)",
"array",
"=",
"_ffi",
".",
"new",
"(",
"self",
".",
"_arrayType",
",",
"positi... | Return the noise value of a specific position.
Example usage: value = noise.getPoint(x, y, z)
Args:
position (Tuple[float, ...]): The point to sample at.
Returns:
float: The noise value at position.
This will be a floating point in the 0.0-1.0 range. | [
"Return",
"the",
"noise",
"value",
"of",
"a",
"specific",
"position",
"."
] | 8ba10c5cfb813eaf3e834de971ba2d6acb7838e4 | https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tdl/noise.py#L144-L164 | train |
libtcod/python-tcod | tcod/map.py | compute_fov | def compute_fov(
transparency: np.array,
x: int,
y: int,
radius: int = 0,
light_walls: bool = True,
algorithm: int = tcod.constants.FOV_RESTRICTIVE,
) -> np.array:
"""Return the visible area of a field-of-view computation.
`transparency` is a 2 dimensional array where all non-zero value... | python | def compute_fov(
transparency: np.array,
x: int,
y: int,
radius: int = 0,
light_walls: bool = True,
algorithm: int = tcod.constants.FOV_RESTRICTIVE,
) -> np.array:
"""Return the visible area of a field-of-view computation.
`transparency` is a 2 dimensional array where all non-zero value... | [
"def",
"compute_fov",
"(",
"transparency",
":",
"np",
".",
"array",
",",
"x",
":",
"int",
",",
"y",
":",
"int",
",",
"radius",
":",
"int",
"=",
"0",
",",
"light_walls",
":",
"bool",
"=",
"True",
",",
"algorithm",
":",
"int",
"=",
"tcod",
".",
"co... | Return the visible area of a field-of-view computation.
`transparency` is a 2 dimensional array where all non-zero values are
considered transparent. The returned array will match the shape of this
array.
`x` and `y` are the 1st and 2nd coordinates of the origin point. Areas
are visible when the... | [
"Return",
"the",
"visible",
"area",
"of",
"a",
"field",
"-",
"of",
"-",
"view",
"computation",
"."
] | 8ba10c5cfb813eaf3e834de971ba2d6acb7838e4 | https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/map.py#L147-L209 | train |
libtcod/python-tcod | tcod/map.py | Map.compute_fov | def compute_fov(
self,
x: int,
y: int,
radius: int = 0,
light_walls: bool = True,
algorithm: int = tcod.constants.FOV_RESTRICTIVE,
) -> None:
"""Compute a field-of-view on the current instance.
Args:
x (int): Point of view, x-coordinate.
... | python | def compute_fov(
self,
x: int,
y: int,
radius: int = 0,
light_walls: bool = True,
algorithm: int = tcod.constants.FOV_RESTRICTIVE,
) -> None:
"""Compute a field-of-view on the current instance.
Args:
x (int): Point of view, x-coordinate.
... | [
"def",
"compute_fov",
"(",
"self",
",",
"x",
":",
"int",
",",
"y",
":",
"int",
",",
"radius",
":",
"int",
"=",
"0",
",",
"light_walls",
":",
"bool",
"=",
"True",
",",
"algorithm",
":",
"int",
"=",
"tcod",
".",
"constants",
".",
"FOV_RESTRICTIVE",
"... | Compute a field-of-view on the current instance.
Args:
x (int): Point of view, x-coordinate.
y (int): Point of view, y-coordinate.
radius (int): Maximum view distance from the point of view.
A value of `0` will give an infinite distance.
light_wa... | [
"Compute",
"a",
"field",
"-",
"of",
"-",
"view",
"on",
"the",
"current",
"instance",
"."
] | 8ba10c5cfb813eaf3e834de971ba2d6acb7838e4 | https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/map.py#L99-L123 | train |
libtcod/python-tcod | tcod/noise.py | Noise.sample_mgrid | def sample_mgrid(self, mgrid: np.array) -> np.array:
"""Sample a mesh-grid array and return the result.
The :any:`sample_ogrid` method performs better as there is a lot of
overhead when working with large mesh-grids.
Args:
mgrid (numpy.ndarray): A mesh-grid array of points ... | python | def sample_mgrid(self, mgrid: np.array) -> np.array:
"""Sample a mesh-grid array and return the result.
The :any:`sample_ogrid` method performs better as there is a lot of
overhead when working with large mesh-grids.
Args:
mgrid (numpy.ndarray): A mesh-grid array of points ... | [
"def",
"sample_mgrid",
"(",
"self",
",",
"mgrid",
":",
"np",
".",
"array",
")",
"->",
"np",
".",
"array",
":",
"mgrid",
"=",
"np",
".",
"ascontiguousarray",
"(",
"mgrid",
",",
"np",
".",
"float32",
")",
"if",
"mgrid",
".",
"shape",
"[",
"0",
"]",
... | Sample a mesh-grid array and return the result.
The :any:`sample_ogrid` method performs better as there is a lot of
overhead when working with large mesh-grids.
Args:
mgrid (numpy.ndarray): A mesh-grid array of points to sample.
A contiguous array of type `numpy.flo... | [
"Sample",
"a",
"mesh",
"-",
"grid",
"array",
"and",
"return",
"the",
"result",
"."
] | 8ba10c5cfb813eaf3e834de971ba2d6acb7838e4 | https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/noise.py#L162-L196 | train |
libtcod/python-tcod | tcod/noise.py | Noise.sample_ogrid | def sample_ogrid(self, ogrid: np.array) -> np.array:
"""Sample an open mesh-grid array and return the result.
Args
ogrid (Sequence[Sequence[float]]): An open mesh-grid.
Returns:
numpy.ndarray: An array of sampled points.
The ``shape`` is based on the le... | python | def sample_ogrid(self, ogrid: np.array) -> np.array:
"""Sample an open mesh-grid array and return the result.
Args
ogrid (Sequence[Sequence[float]]): An open mesh-grid.
Returns:
numpy.ndarray: An array of sampled points.
The ``shape`` is based on the le... | [
"def",
"sample_ogrid",
"(",
"self",
",",
"ogrid",
":",
"np",
".",
"array",
")",
"->",
"np",
".",
"array",
":",
"if",
"len",
"(",
"ogrid",
")",
"!=",
"self",
".",
"dimensions",
":",
"raise",
"ValueError",
"(",
"\"len(ogrid) must equal self.dimensions, \"",
... | Sample an open mesh-grid array and return the result.
Args
ogrid (Sequence[Sequence[float]]): An open mesh-grid.
Returns:
numpy.ndarray: An array of sampled points.
The ``shape`` is based on the lengths of the open mesh-grid
arrays.
... | [
"Sample",
"an",
"open",
"mesh",
"-",
"grid",
"array",
"and",
"return",
"the",
"result",
"."
] | 8ba10c5cfb813eaf3e834de971ba2d6acb7838e4 | https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/noise.py#L198-L225 | train |
libtcod/python-tcod | tdl/event.py | _processEvents | def _processEvents():
"""Flushes the event queue from libtcod into the global list _eventQueue"""
global _mousel, _mousem, _mouser, _eventsflushed, _pushedEvents
_eventsflushed = True
events = _pushedEvents # get events from event.push
_pushedEvents = [] # then clear the pushed events queue
mou... | python | def _processEvents():
"""Flushes the event queue from libtcod into the global list _eventQueue"""
global _mousel, _mousem, _mouser, _eventsflushed, _pushedEvents
_eventsflushed = True
events = _pushedEvents # get events from event.push
_pushedEvents = [] # then clear the pushed events queue
mou... | [
"def",
"_processEvents",
"(",
")",
":",
"global",
"_mousel",
",",
"_mousem",
",",
"_mouser",
",",
"_eventsflushed",
",",
"_pushedEvents",
"_eventsflushed",
"=",
"True",
"events",
"=",
"_pushedEvents",
"# get events from event.push",
"_pushedEvents",
"=",
"[",
"]",
... | Flushes the event queue from libtcod into the global list _eventQueue | [
"Flushes",
"the",
"event",
"queue",
"from",
"libtcod",
"into",
"the",
"global",
"list",
"_eventQueue"
] | 8ba10c5cfb813eaf3e834de971ba2d6acb7838e4 | https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tdl/event.py#L331-L403 | train |
libtcod/python-tcod | tdl/event.py | wait | def wait(timeout=None, flush=True):
"""Wait for an event.
Args:
timeout (Optional[int]): The time in seconds that this function will
wait before giving up and returning None.
With the default value of None, this will block forever.
flush (bool): If True a call to :any:`... | python | def wait(timeout=None, flush=True):
"""Wait for an event.
Args:
timeout (Optional[int]): The time in seconds that this function will
wait before giving up and returning None.
With the default value of None, this will block forever.
flush (bool): If True a call to :any:`... | [
"def",
"wait",
"(",
"timeout",
"=",
"None",
",",
"flush",
"=",
"True",
")",
":",
"if",
"timeout",
"is",
"not",
"None",
":",
"timeout",
"=",
"timeout",
"+",
"_time",
".",
"clock",
"(",
")",
"# timeout at this time",
"while",
"True",
":",
"if",
"_eventQu... | Wait for an event.
Args:
timeout (Optional[int]): The time in seconds that this function will
wait before giving up and returning None.
With the default value of None, this will block forever.
flush (bool): If True a call to :any:`tdl.flush` will be made before
... | [
"Wait",
"for",
"an",
"event",
"."
] | 8ba10c5cfb813eaf3e834de971ba2d6acb7838e4 | https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tdl/event.py#L428-L454 | train |
libtcod/python-tcod | tdl/event.py | App.run_once | def run_once(self):
"""Pump events to this App instance and then return.
This works in the way described in :any:`App.run` except it immediately
returns after the first :any:`update` call.
Having multiple :any:`App` instances and selectively calling runOnce on
them is a decent ... | python | def run_once(self):
"""Pump events to this App instance and then return.
This works in the way described in :any:`App.run` except it immediately
returns after the first :any:`update` call.
Having multiple :any:`App` instances and selectively calling runOnce on
them is a decent ... | [
"def",
"run_once",
"(",
"self",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'_App__prevTime'",
")",
":",
"self",
".",
"__prevTime",
"=",
"_time",
".",
"clock",
"(",
")",
"# initiate __prevTime",
"for",
"event",
"in",
"get",
"(",
")",
":",
"if"... | Pump events to this App instance and then return.
This works in the way described in :any:`App.run` except it immediately
returns after the first :any:`update` call.
Having multiple :any:`App` instances and selectively calling runOnce on
them is a decent way to create a state machine. | [
"Pump",
"events",
"to",
"this",
"App",
"instance",
"and",
"then",
"return",
"."
] | 8ba10c5cfb813eaf3e834de971ba2d6acb7838e4 | https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tdl/event.py#L305-L328 | train |
libtcod/python-tcod | tcod/tileset.py | load_truetype_font | def load_truetype_font(
path: str, tile_width: int, tile_height: int
) -> Tileset:
"""Return a new Tileset from a `.ttf` or `.otf` file.
Same as :any:`set_truetype_font`, but returns a :any:`Tileset` instead.
You can send this Tileset to :any:`set_default`.
This function is provisional. The API m... | python | def load_truetype_font(
path: str, tile_width: int, tile_height: int
) -> Tileset:
"""Return a new Tileset from a `.ttf` or `.otf` file.
Same as :any:`set_truetype_font`, but returns a :any:`Tileset` instead.
You can send this Tileset to :any:`set_default`.
This function is provisional. The API m... | [
"def",
"load_truetype_font",
"(",
"path",
":",
"str",
",",
"tile_width",
":",
"int",
",",
"tile_height",
":",
"int",
")",
"->",
"Tileset",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"path",
")",
":",
"raise",
"RuntimeError",
"(",
"\"File ... | Return a new Tileset from a `.ttf` or `.otf` file.
Same as :any:`set_truetype_font`, but returns a :any:`Tileset` instead.
You can send this Tileset to :any:`set_default`.
This function is provisional. The API may change. | [
"Return",
"a",
"new",
"Tileset",
"from",
"a",
".",
"ttf",
"or",
".",
"otf",
"file",
"."
] | 8ba10c5cfb813eaf3e834de971ba2d6acb7838e4 | https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/tileset.py#L120-L134 | train |
libtcod/python-tcod | tcod/tileset.py | set_truetype_font | def set_truetype_font(path: str, tile_width: int, tile_height: int) -> None:
"""Set the default tileset from a `.ttf` or `.otf` file.
`path` is the file path for the font file.
`tile_width` and `tile_height` are the desired size of the tiles in the new
tileset. The font will be scaled to fit the give... | python | def set_truetype_font(path: str, tile_width: int, tile_height: int) -> None:
"""Set the default tileset from a `.ttf` or `.otf` file.
`path` is the file path for the font file.
`tile_width` and `tile_height` are the desired size of the tiles in the new
tileset. The font will be scaled to fit the give... | [
"def",
"set_truetype_font",
"(",
"path",
":",
"str",
",",
"tile_width",
":",
"int",
",",
"tile_height",
":",
"int",
")",
"->",
"None",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"path",
")",
":",
"raise",
"RuntimeError",
"(",
"\"File not ... | Set the default tileset from a `.ttf` or `.otf` file.
`path` is the file path for the font file.
`tile_width` and `tile_height` are the desired size of the tiles in the new
tileset. The font will be scaled to fit the given `tile_height` and
`tile_width`.
This function will only affect the `SDL2`... | [
"Set",
"the",
"default",
"tileset",
"from",
"a",
".",
"ttf",
"or",
".",
"otf",
"file",
"."
] | 8ba10c5cfb813eaf3e834de971ba2d6acb7838e4 | https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/tileset.py#L137-L157 | train |
libtcod/python-tcod | tcod/tileset.py | Tileset.get_tile | def get_tile(self, codepoint: int) -> np.array:
"""Return a copy of a tile for the given codepoint.
If the tile does not exist yet then a blank array will be returned.
The tile will have a shape of (height, width, rgba) and a dtype of
uint8. Note that most grey-scale tiles will only u... | python | def get_tile(self, codepoint: int) -> np.array:
"""Return a copy of a tile for the given codepoint.
If the tile does not exist yet then a blank array will be returned.
The tile will have a shape of (height, width, rgba) and a dtype of
uint8. Note that most grey-scale tiles will only u... | [
"def",
"get_tile",
"(",
"self",
",",
"codepoint",
":",
"int",
")",
"->",
"np",
".",
"array",
":",
"tile",
"=",
"np",
".",
"zeros",
"(",
"self",
".",
"tile_shape",
"+",
"(",
"4",
",",
")",
",",
"dtype",
"=",
"np",
".",
"uint8",
")",
"lib",
".",
... | Return a copy of a tile for the given codepoint.
If the tile does not exist yet then a blank array will be returned.
The tile will have a shape of (height, width, rgba) and a dtype of
uint8. Note that most grey-scale tiles will only use the alpha
channel and will usually have a solid ... | [
"Return",
"a",
"copy",
"of",
"a",
"tile",
"for",
"the",
"given",
"codepoint",
"."
] | 8ba10c5cfb813eaf3e834de971ba2d6acb7838e4 | https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/tileset.py#L55-L70 | train |
libtcod/python-tcod | tcod/tileset.py | Tileset.set_tile | def set_tile(self, codepoint: int, tile: np.array) -> None:
"""Upload a tile into this array.
The tile can be in 32-bit color (height, width, rgba), or grey-scale
(height, width). The tile should have a dtype of ``np.uint8``.
This data may need to be sent to graphics card memory, this... | python | def set_tile(self, codepoint: int, tile: np.array) -> None:
"""Upload a tile into this array.
The tile can be in 32-bit color (height, width, rgba), or grey-scale
(height, width). The tile should have a dtype of ``np.uint8``.
This data may need to be sent to graphics card memory, this... | [
"def",
"set_tile",
"(",
"self",
",",
"codepoint",
":",
"int",
",",
"tile",
":",
"np",
".",
"array",
")",
"->",
"None",
":",
"tile",
"=",
"np",
".",
"ascontiguousarray",
"(",
"tile",
",",
"dtype",
"=",
"np",
".",
"uint8",
")",
"if",
"tile",
".",
"... | Upload a tile into this array.
The tile can be in 32-bit color (height, width, rgba), or grey-scale
(height, width). The tile should have a dtype of ``np.uint8``.
This data may need to be sent to graphics card memory, this is a slow
operation. | [
"Upload",
"a",
"tile",
"into",
"this",
"array",
"."
] | 8ba10c5cfb813eaf3e834de971ba2d6acb7838e4 | https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/tileset.py#L72-L97 | train |
libtcod/python-tcod | build_libtcod.py | fix_header | def fix_header(filepath):
"""Removes leading whitespace from a MacOS header file.
This whitespace is causing issues with directives on some platforms.
"""
with open(filepath, "r+") as f:
current = f.read()
fixed = "\n".join(line.strip() for line in current.split("\n"))
if curren... | python | def fix_header(filepath):
"""Removes leading whitespace from a MacOS header file.
This whitespace is causing issues with directives on some platforms.
"""
with open(filepath, "r+") as f:
current = f.read()
fixed = "\n".join(line.strip() for line in current.split("\n"))
if curren... | [
"def",
"fix_header",
"(",
"filepath",
")",
":",
"with",
"open",
"(",
"filepath",
",",
"\"r+\"",
")",
"as",
"f",
":",
"current",
"=",
"f",
".",
"read",
"(",
")",
"fixed",
"=",
"\"\\n\"",
".",
"join",
"(",
"line",
".",
"strip",
"(",
")",
"for",
"li... | Removes leading whitespace from a MacOS header file.
This whitespace is causing issues with directives on some platforms. | [
"Removes",
"leading",
"whitespace",
"from",
"a",
"MacOS",
"header",
"file",
"."
] | 8ba10c5cfb813eaf3e834de971ba2d6acb7838e4 | https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/build_libtcod.py#L145-L157 | train |
libtcod/python-tcod | build_libtcod.py | find_sdl_attrs | def find_sdl_attrs(prefix: str) -> Iterator[Tuple[str, Any]]:
"""Return names and values from `tcod.lib`.
`prefix` is used to filter out which names to copy.
"""
from tcod._libtcod import lib
if prefix.startswith("SDL_"):
name_starts_at = 4
elif prefix.startswith("SDL"):
name_s... | python | def find_sdl_attrs(prefix: str) -> Iterator[Tuple[str, Any]]:
"""Return names and values from `tcod.lib`.
`prefix` is used to filter out which names to copy.
"""
from tcod._libtcod import lib
if prefix.startswith("SDL_"):
name_starts_at = 4
elif prefix.startswith("SDL"):
name_s... | [
"def",
"find_sdl_attrs",
"(",
"prefix",
":",
"str",
")",
"->",
"Iterator",
"[",
"Tuple",
"[",
"str",
",",
"Any",
"]",
"]",
":",
"from",
"tcod",
".",
"_libtcod",
"import",
"lib",
"if",
"prefix",
".",
"startswith",
"(",
"\"SDL_\"",
")",
":",
"name_starts... | Return names and values from `tcod.lib`.
`prefix` is used to filter out which names to copy. | [
"Return",
"names",
"and",
"values",
"from",
"tcod",
".",
"lib",
"."
] | 8ba10c5cfb813eaf3e834de971ba2d6acb7838e4 | https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/build_libtcod.py#L357-L372 | train |
libtcod/python-tcod | build_libtcod.py | write_library_constants | def write_library_constants():
"""Write libtcod constants into the tcod.constants module."""
from tcod._libtcod import lib, ffi
import tcod.color
with open("tcod/constants.py", "w") as f:
all_names = []
f.write(CONSTANT_MODULE_HEADER)
for name in dir(lib):
value = ge... | python | def write_library_constants():
"""Write libtcod constants into the tcod.constants module."""
from tcod._libtcod import lib, ffi
import tcod.color
with open("tcod/constants.py", "w") as f:
all_names = []
f.write(CONSTANT_MODULE_HEADER)
for name in dir(lib):
value = ge... | [
"def",
"write_library_constants",
"(",
")",
":",
"from",
"tcod",
".",
"_libtcod",
"import",
"lib",
",",
"ffi",
"import",
"tcod",
".",
"color",
"with",
"open",
"(",
"\"tcod/constants.py\"",
",",
"\"w\"",
")",
"as",
"f",
":",
"all_names",
"=",
"[",
"]",
"f... | Write libtcod constants into the tcod.constants module. | [
"Write",
"libtcod",
"constants",
"into",
"the",
"tcod",
".",
"constants",
"module",
"."
] | 8ba10c5cfb813eaf3e834de971ba2d6acb7838e4 | https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/build_libtcod.py#L394-L458 | train |
libtcod/python-tcod | build_libtcod.py | CustomPostParser.visit_EnumeratorList | def visit_EnumeratorList(self, node):
"""Replace enumerator expressions with '...' stubs."""
for type, enum in node.children():
if enum.value is None:
pass
elif isinstance(enum.value, (c_ast.BinaryOp, c_ast.UnaryOp)):
enum.value = c_ast.Constant("i... | python | def visit_EnumeratorList(self, node):
"""Replace enumerator expressions with '...' stubs."""
for type, enum in node.children():
if enum.value is None:
pass
elif isinstance(enum.value, (c_ast.BinaryOp, c_ast.UnaryOp)):
enum.value = c_ast.Constant("i... | [
"def",
"visit_EnumeratorList",
"(",
"self",
",",
"node",
")",
":",
"for",
"type",
",",
"enum",
"in",
"node",
".",
"children",
"(",
")",
":",
"if",
"enum",
".",
"value",
"is",
"None",
":",
"pass",
"elif",
"isinstance",
"(",
"enum",
".",
"value",
",",
... | Replace enumerator expressions with '...' stubs. | [
"Replace",
"enumerator",
"expressions",
"with",
"...",
"stubs",
"."
] | 8ba10c5cfb813eaf3e834de971ba2d6acb7838e4 | https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/build_libtcod.py#L214-L222 | train |
libtcod/python-tcod | tcod/libtcodpy.py | bsp_new_with_size | def bsp_new_with_size(x: int, y: int, w: int, h: int) -> tcod.bsp.BSP:
"""Create a new BSP instance with the given rectangle.
Args:
x (int): Rectangle left coordinate.
y (int): Rectangle top coordinate.
w (int): Rectangle width.
h (int): Rectangle height.
Returns:
B... | python | def bsp_new_with_size(x: int, y: int, w: int, h: int) -> tcod.bsp.BSP:
"""Create a new BSP instance with the given rectangle.
Args:
x (int): Rectangle left coordinate.
y (int): Rectangle top coordinate.
w (int): Rectangle width.
h (int): Rectangle height.
Returns:
B... | [
"def",
"bsp_new_with_size",
"(",
"x",
":",
"int",
",",
"y",
":",
"int",
",",
"w",
":",
"int",
",",
"h",
":",
"int",
")",
"->",
"tcod",
".",
"bsp",
".",
"BSP",
":",
"return",
"Bsp",
"(",
"x",
",",
"y",
",",
"w",
",",
"h",
")"
] | Create a new BSP instance with the given rectangle.
Args:
x (int): Rectangle left coordinate.
y (int): Rectangle top coordinate.
w (int): Rectangle width.
h (int): Rectangle height.
Returns:
BSP: A new BSP instance.
.. deprecated:: 2.0
Call the :any:`BSP` cl... | [
"Create",
"a",
"new",
"BSP",
"instance",
"with",
"the",
"given",
"rectangle",
"."
] | 8ba10c5cfb813eaf3e834de971ba2d6acb7838e4 | https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L533-L548 | train |
libtcod/python-tcod | tcod/libtcodpy.py | _bsp_traverse | def _bsp_traverse(
node_iter: Iterable[tcod.bsp.BSP],
callback: Callable[[tcod.bsp.BSP, Any], None],
userData: Any,
) -> None:
"""pack callback into a handle for use with the callback
_pycall_bsp_callback
"""
for node in node_iter:
callback(node, userData) | python | def _bsp_traverse(
node_iter: Iterable[tcod.bsp.BSP],
callback: Callable[[tcod.bsp.BSP, Any], None],
userData: Any,
) -> None:
"""pack callback into a handle for use with the callback
_pycall_bsp_callback
"""
for node in node_iter:
callback(node, userData) | [
"def",
"_bsp_traverse",
"(",
"node_iter",
":",
"Iterable",
"[",
"tcod",
".",
"bsp",
".",
"BSP",
"]",
",",
"callback",
":",
"Callable",
"[",
"[",
"tcod",
".",
"bsp",
".",
"BSP",
",",
"Any",
"]",
",",
"None",
"]",
",",
"userData",
":",
"Any",
",",
... | pack callback into a handle for use with the callback
_pycall_bsp_callback | [
"pack",
"callback",
"into",
"a",
"handle",
"for",
"use",
"with",
"the",
"callback",
"_pycall_bsp_callback"
] | 8ba10c5cfb813eaf3e834de971ba2d6acb7838e4 | https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L649-L658 | train |
libtcod/python-tcod | tcod/libtcodpy.py | color_lerp | def color_lerp(
c1: Tuple[int, int, int], c2: Tuple[int, int, int], a: float
) -> Color:
"""Return the linear interpolation between two colors.
``a`` is the interpolation value, with 0 returing ``c1``,
1 returning ``c2``, and 0.5 returing a color halfway between both.
Args:
c1 (Union[Tuple... | python | def color_lerp(
c1: Tuple[int, int, int], c2: Tuple[int, int, int], a: float
) -> Color:
"""Return the linear interpolation between two colors.
``a`` is the interpolation value, with 0 returing ``c1``,
1 returning ``c2``, and 0.5 returing a color halfway between both.
Args:
c1 (Union[Tuple... | [
"def",
"color_lerp",
"(",
"c1",
":",
"Tuple",
"[",
"int",
",",
"int",
",",
"int",
"]",
",",
"c2",
":",
"Tuple",
"[",
"int",
",",
"int",
",",
"int",
"]",
",",
"a",
":",
"float",
")",
"->",
"Color",
":",
"return",
"Color",
".",
"_new_from_cdata",
... | Return the linear interpolation between two colors.
``a`` is the interpolation value, with 0 returing ``c1``,
1 returning ``c2``, and 0.5 returing a color halfway between both.
Args:
c1 (Union[Tuple[int, int, int], Sequence[int]]):
The first color. At a=0.
c2 (Union[Tuple[int,... | [
"Return",
"the",
"linear",
"interpolation",
"between",
"two",
"colors",
"."
] | 8ba10c5cfb813eaf3e834de971ba2d6acb7838e4 | https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L762-L780 | train |
libtcod/python-tcod | tcod/libtcodpy.py | color_scale_HSV | def color_scale_HSV(c: Color, scoef: float, vcoef: float) -> None:
"""Scale a color's saturation and value.
Does not return a new Color. ``c`` is modified inplace.
Args:
c (Union[Color, List[int]]): A Color instance, or an [r, g, b] list.
scoef (float): Saturation multiplier, from 0 to 1.... | python | def color_scale_HSV(c: Color, scoef: float, vcoef: float) -> None:
"""Scale a color's saturation and value.
Does not return a new Color. ``c`` is modified inplace.
Args:
c (Union[Color, List[int]]): A Color instance, or an [r, g, b] list.
scoef (float): Saturation multiplier, from 0 to 1.... | [
"def",
"color_scale_HSV",
"(",
"c",
":",
"Color",
",",
"scoef",
":",
"float",
",",
"vcoef",
":",
"float",
")",
"->",
"None",
":",
"color_p",
"=",
"ffi",
".",
"new",
"(",
"\"TCOD_color_t*\"",
")",
"color_p",
".",
"r",
",",
"color_p",
".",
"g",
",",
... | Scale a color's saturation and value.
Does not return a new Color. ``c`` is modified inplace.
Args:
c (Union[Color, List[int]]): A Color instance, or an [r, g, b] list.
scoef (float): Saturation multiplier, from 0 to 1.
Use 1 to keep current saturation.
vcoef (f... | [
"Scale",
"a",
"color",
"s",
"saturation",
"and",
"value",
"."
] | 8ba10c5cfb813eaf3e834de971ba2d6acb7838e4 | https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L818-L833 | train |
libtcod/python-tcod | tcod/libtcodpy.py | color_gen_map | def color_gen_map(
colors: Iterable[Tuple[int, int, int]], indexes: Iterable[int]
) -> List[Color]:
"""Return a smoothly defined scale of colors.
If ``indexes`` is [0, 3, 9] for example, the first color from ``colors``
will be returned at 0, the 2nd will be at 3, and the 3rd will be at 9.
All in-be... | python | def color_gen_map(
colors: Iterable[Tuple[int, int, int]], indexes: Iterable[int]
) -> List[Color]:
"""Return a smoothly defined scale of colors.
If ``indexes`` is [0, 3, 9] for example, the first color from ``colors``
will be returned at 0, the 2nd will be at 3, and the 3rd will be at 9.
All in-be... | [
"def",
"color_gen_map",
"(",
"colors",
":",
"Iterable",
"[",
"Tuple",
"[",
"int",
",",
"int",
",",
"int",
"]",
"]",
",",
"indexes",
":",
"Iterable",
"[",
"int",
"]",
")",
"->",
"List",
"[",
"Color",
"]",
":",
"ccolors",
"=",
"ffi",
".",
"new",
"(... | Return a smoothly defined scale of colors.
If ``indexes`` is [0, 3, 9] for example, the first color from ``colors``
will be returned at 0, the 2nd will be at 3, and the 3rd will be at 9.
All in-betweens will be filled with a gradient.
Args:
colors (Iterable[Union[Tuple[int, int, int], Sequence... | [
"Return",
"a",
"smoothly",
"defined",
"scale",
"of",
"colors",
"."
] | 8ba10c5cfb813eaf3e834de971ba2d6acb7838e4 | https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L837-L863 | train |
libtcod/python-tcod | tcod/libtcodpy.py | console_init_root | def console_init_root(
w: int,
h: int,
title: Optional[str] = None,
fullscreen: bool = False,
renderer: Optional[int] = None,
order: str = "C",
) -> tcod.console.Console:
"""Set up the primary display and return the root console.
`w` and `h` are the columns and rows of the new window (i... | python | def console_init_root(
w: int,
h: int,
title: Optional[str] = None,
fullscreen: bool = False,
renderer: Optional[int] = None,
order: str = "C",
) -> tcod.console.Console:
"""Set up the primary display and return the root console.
`w` and `h` are the columns and rows of the new window (i... | [
"def",
"console_init_root",
"(",
"w",
":",
"int",
",",
"h",
":",
"int",
",",
"title",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
",",
"fullscreen",
":",
"bool",
"=",
"False",
",",
"renderer",
":",
"Optional",
"[",
"int",
"]",
"=",
"None",
",",
... | Set up the primary display and return the root console.
`w` and `h` are the columns and rows of the new window (in tiles.)
`title` is an optional string to display on the windows title bar.
`fullscreen` determines if the window will start in fullscreen. Fullscreen
mode is unreliable unless the rende... | [
"Set",
"up",
"the",
"primary",
"display",
"and",
"return",
"the",
"root",
"console",
"."
] | 8ba10c5cfb813eaf3e834de971ba2d6acb7838e4 | https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L866-L935 | train |
libtcod/python-tcod | tcod/libtcodpy.py | console_set_custom_font | def console_set_custom_font(
fontFile: AnyStr,
flags: int = FONT_LAYOUT_ASCII_INCOL,
nb_char_horiz: int = 0,
nb_char_vertic: int = 0,
) -> None:
"""Load the custom font file at `fontFile`.
Call this before function before calling :any:`tcod.console_init_root`.
Flags can be a mix of the fol... | python | def console_set_custom_font(
fontFile: AnyStr,
flags: int = FONT_LAYOUT_ASCII_INCOL,
nb_char_horiz: int = 0,
nb_char_vertic: int = 0,
) -> None:
"""Load the custom font file at `fontFile`.
Call this before function before calling :any:`tcod.console_init_root`.
Flags can be a mix of the fol... | [
"def",
"console_set_custom_font",
"(",
"fontFile",
":",
"AnyStr",
",",
"flags",
":",
"int",
"=",
"FONT_LAYOUT_ASCII_INCOL",
",",
"nb_char_horiz",
":",
"int",
"=",
"0",
",",
"nb_char_vertic",
":",
"int",
"=",
"0",
",",
")",
"->",
"None",
":",
"if",
"not",
... | Load the custom font file at `fontFile`.
Call this before function before calling :any:`tcod.console_init_root`.
Flags can be a mix of the following:
* tcod.FONT_LAYOUT_ASCII_INCOL:
Decode tileset raw in column-major order.
* tcod.FONT_LAYOUT_ASCII_INROW:
Decode tileset raw in row-major o... | [
"Load",
"the",
"custom",
"font",
"file",
"at",
"fontFile",
"."
] | 8ba10c5cfb813eaf3e834de971ba2d6acb7838e4 | https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L938-L971 | train |
libtcod/python-tcod | tcod/libtcodpy.py | console_get_width | def console_get_width(con: tcod.console.Console) -> int:
"""Return the width of a console.
Args:
con (Console): Any Console instance.
Returns:
int: The width of a Console.
.. deprecated:: 2.0
Use `Console.width` instead.
"""
return int(lib.TCOD_console_get_width(_conso... | python | def console_get_width(con: tcod.console.Console) -> int:
"""Return the width of a console.
Args:
con (Console): Any Console instance.
Returns:
int: The width of a Console.
.. deprecated:: 2.0
Use `Console.width` instead.
"""
return int(lib.TCOD_console_get_width(_conso... | [
"def",
"console_get_width",
"(",
"con",
":",
"tcod",
".",
"console",
".",
"Console",
")",
"->",
"int",
":",
"return",
"int",
"(",
"lib",
".",
"TCOD_console_get_width",
"(",
"_console",
"(",
"con",
")",
")",
")"
] | Return the width of a console.
Args:
con (Console): Any Console instance.
Returns:
int: The width of a Console.
.. deprecated:: 2.0
Use `Console.width` instead. | [
"Return",
"the",
"width",
"of",
"a",
"console",
"."
] | 8ba10c5cfb813eaf3e834de971ba2d6acb7838e4 | https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L975-L987 | train |
libtcod/python-tcod | tcod/libtcodpy.py | console_get_height | def console_get_height(con: tcod.console.Console) -> int:
"""Return the height of a console.
Args:
con (Console): Any Console instance.
Returns:
int: The height of a Console.
.. deprecated:: 2.0
Use `Console.height` instead.
"""
return int(lib.TCOD_console_get_height(_... | python | def console_get_height(con: tcod.console.Console) -> int:
"""Return the height of a console.
Args:
con (Console): Any Console instance.
Returns:
int: The height of a Console.
.. deprecated:: 2.0
Use `Console.height` instead.
"""
return int(lib.TCOD_console_get_height(_... | [
"def",
"console_get_height",
"(",
"con",
":",
"tcod",
".",
"console",
".",
"Console",
")",
"->",
"int",
":",
"return",
"int",
"(",
"lib",
".",
"TCOD_console_get_height",
"(",
"_console",
"(",
"con",
")",
")",
")"
] | Return the height of a console.
Args:
con (Console): Any Console instance.
Returns:
int: The height of a Console.
.. deprecated:: 2.0
Use `Console.height` instead. | [
"Return",
"the",
"height",
"of",
"a",
"console",
"."
] | 8ba10c5cfb813eaf3e834de971ba2d6acb7838e4 | https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L991-L1003 | train |
libtcod/python-tcod | tcod/libtcodpy.py | console_map_ascii_code_to_font | def console_map_ascii_code_to_font(
asciiCode: int, fontCharX: int, fontCharY: int
) -> None:
"""Set a character code to new coordinates on the tile-set.
`asciiCode` must be within the bounds created during the initialization of
the loaded tile-set. For example, you can't use 255 here unless you have ... | python | def console_map_ascii_code_to_font(
asciiCode: int, fontCharX: int, fontCharY: int
) -> None:
"""Set a character code to new coordinates on the tile-set.
`asciiCode` must be within the bounds created during the initialization of
the loaded tile-set. For example, you can't use 255 here unless you have ... | [
"def",
"console_map_ascii_code_to_font",
"(",
"asciiCode",
":",
"int",
",",
"fontCharX",
":",
"int",
",",
"fontCharY",
":",
"int",
")",
"->",
"None",
":",
"lib",
".",
"TCOD_console_map_ascii_code_to_font",
"(",
"_int",
"(",
"asciiCode",
")",
",",
"fontCharX",
... | Set a character code to new coordinates on the tile-set.
`asciiCode` must be within the bounds created during the initialization of
the loaded tile-set. For example, you can't use 255 here unless you have a
256 tile tile-set loaded. This applies to all functions in this group.
Args:
asciiCod... | [
"Set",
"a",
"character",
"code",
"to",
"new",
"coordinates",
"on",
"the",
"tile",
"-",
"set",
"."
] | 8ba10c5cfb813eaf3e834de971ba2d6acb7838e4 | https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1007-L1025 | train |
libtcod/python-tcod | tcod/libtcodpy.py | console_map_ascii_codes_to_font | def console_map_ascii_codes_to_font(
firstAsciiCode: int, nbCodes: int, fontCharX: int, fontCharY: int
) -> None:
"""Remap a contiguous set of codes to a contiguous set of tiles.
Both the tile-set and character codes must be contiguous to use this
function. If this is not the case you may want to use
... | python | def console_map_ascii_codes_to_font(
firstAsciiCode: int, nbCodes: int, fontCharX: int, fontCharY: int
) -> None:
"""Remap a contiguous set of codes to a contiguous set of tiles.
Both the tile-set and character codes must be contiguous to use this
function. If this is not the case you may want to use
... | [
"def",
"console_map_ascii_codes_to_font",
"(",
"firstAsciiCode",
":",
"int",
",",
"nbCodes",
":",
"int",
",",
"fontCharX",
":",
"int",
",",
"fontCharY",
":",
"int",
")",
"->",
"None",
":",
"lib",
".",
"TCOD_console_map_ascii_codes_to_font",
"(",
"_int",
"(",
"... | Remap a contiguous set of codes to a contiguous set of tiles.
Both the tile-set and character codes must be contiguous to use this
function. If this is not the case you may want to use
:any:`console_map_ascii_code_to_font`.
Args:
firstAsciiCode (int): The starting character code.
nbCo... | [
"Remap",
"a",
"contiguous",
"set",
"of",
"codes",
"to",
"a",
"contiguous",
"set",
"of",
"tiles",
"."
] | 8ba10c5cfb813eaf3e834de971ba2d6acb7838e4 | https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1029-L1049 | train |
libtcod/python-tcod | tcod/libtcodpy.py | console_map_string_to_font | def console_map_string_to_font(s: str, fontCharX: int, fontCharY: int) -> None:
"""Remap a string of codes to a contiguous set of tiles.
Args:
s (AnyStr): A string of character codes to map to new values.
The null character `'\\x00'` will prematurely end this
fun... | python | def console_map_string_to_font(s: str, fontCharX: int, fontCharY: int) -> None:
"""Remap a string of codes to a contiguous set of tiles.
Args:
s (AnyStr): A string of character codes to map to new values.
The null character `'\\x00'` will prematurely end this
fun... | [
"def",
"console_map_string_to_font",
"(",
"s",
":",
"str",
",",
"fontCharX",
":",
"int",
",",
"fontCharY",
":",
"int",
")",
"->",
"None",
":",
"lib",
".",
"TCOD_console_map_string_to_font_utf",
"(",
"_unicode",
"(",
"s",
")",
",",
"fontCharX",
",",
"fontChar... | Remap a string of codes to a contiguous set of tiles.
Args:
s (AnyStr): A string of character codes to map to new values.
The null character `'\\x00'` will prematurely end this
function.
fontCharX (int): The starting X tile coordinate on the loaded tileset.
... | [
"Remap",
"a",
"string",
"of",
"codes",
"to",
"a",
"contiguous",
"set",
"of",
"tiles",
"."
] | 8ba10c5cfb813eaf3e834de971ba2d6acb7838e4 | https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1053-L1065 | train |
libtcod/python-tcod | tcod/libtcodpy.py | console_set_default_background | def console_set_default_background(
con: tcod.console.Console, col: Tuple[int, int, int]
) -> None:
"""Change the default background color for a console.
Args:
con (Console): Any Console instance.
col (Union[Tuple[int, int, int], Sequence[int]]):
An (r, g, b) sequence or Color i... | python | def console_set_default_background(
con: tcod.console.Console, col: Tuple[int, int, int]
) -> None:
"""Change the default background color for a console.
Args:
con (Console): Any Console instance.
col (Union[Tuple[int, int, int], Sequence[int]]):
An (r, g, b) sequence or Color i... | [
"def",
"console_set_default_background",
"(",
"con",
":",
"tcod",
".",
"console",
".",
"Console",
",",
"col",
":",
"Tuple",
"[",
"int",
",",
"int",
",",
"int",
"]",
")",
"->",
"None",
":",
"lib",
".",
"TCOD_console_set_default_background",
"(",
"_console",
... | Change the default background color for a console.
Args:
con (Console): Any Console instance.
col (Union[Tuple[int, int, int], Sequence[int]]):
An (r, g, b) sequence or Color instance.
.. deprecated:: 8.5
Use :any:`Console.default_bg` instead. | [
"Change",
"the",
"default",
"background",
"color",
"for",
"a",
"console",
"."
] | 8ba10c5cfb813eaf3e834de971ba2d6acb7838e4 | https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1138-L1151 | train |
libtcod/python-tcod | tcod/libtcodpy.py | console_set_default_foreground | def console_set_default_foreground(
con: tcod.console.Console, col: Tuple[int, int, int]
) -> None:
"""Change the default foreground color for a console.
Args:
con (Console): Any Console instance.
col (Union[Tuple[int, int, int], Sequence[int]]):
An (r, g, b) sequence or Color i... | python | def console_set_default_foreground(
con: tcod.console.Console, col: Tuple[int, int, int]
) -> None:
"""Change the default foreground color for a console.
Args:
con (Console): Any Console instance.
col (Union[Tuple[int, int, int], Sequence[int]]):
An (r, g, b) sequence or Color i... | [
"def",
"console_set_default_foreground",
"(",
"con",
":",
"tcod",
".",
"console",
".",
"Console",
",",
"col",
":",
"Tuple",
"[",
"int",
",",
"int",
",",
"int",
"]",
")",
"->",
"None",
":",
"lib",
".",
"TCOD_console_set_default_foreground",
"(",
"_console",
... | Change the default foreground color for a console.
Args:
con (Console): Any Console instance.
col (Union[Tuple[int, int, int], Sequence[int]]):
An (r, g, b) sequence or Color instance.
.. deprecated:: 8.5
Use :any:`Console.default_fg` instead. | [
"Change",
"the",
"default",
"foreground",
"color",
"for",
"a",
"console",
"."
] | 8ba10c5cfb813eaf3e834de971ba2d6acb7838e4 | https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1155-L1168 | train |
libtcod/python-tcod | tcod/libtcodpy.py | console_put_char_ex | def console_put_char_ex(
con: tcod.console.Console,
x: int,
y: int,
c: Union[int, str],
fore: Tuple[int, int, int],
back: Tuple[int, int, int],
) -> None:
"""Draw the character c at x,y using the colors fore and back.
Args:
con (Console): Any Console instance.
x (int): C... | python | def console_put_char_ex(
con: tcod.console.Console,
x: int,
y: int,
c: Union[int, str],
fore: Tuple[int, int, int],
back: Tuple[int, int, int],
) -> None:
"""Draw the character c at x,y using the colors fore and back.
Args:
con (Console): Any Console instance.
x (int): C... | [
"def",
"console_put_char_ex",
"(",
"con",
":",
"tcod",
".",
"console",
".",
"Console",
",",
"x",
":",
"int",
",",
"y",
":",
"int",
",",
"c",
":",
"Union",
"[",
"int",
",",
"str",
"]",
",",
"fore",
":",
"Tuple",
"[",
"int",
",",
"int",
",",
"int... | Draw the character c at x,y using the colors fore and back.
Args:
con (Console): Any Console instance.
x (int): Character x position from the left.
y (int): Character y position from the top.
c (Union[int, AnyStr]): Character to draw, can be an integer or string.
fore (Union... | [
"Draw",
"the",
"character",
"c",
"at",
"x",
"y",
"using",
"the",
"colors",
"fore",
"and",
"back",
"."
] | 8ba10c5cfb813eaf3e834de971ba2d6acb7838e4 | https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1209-L1229 | train |
libtcod/python-tcod | tcod/libtcodpy.py | console_set_char_background | def console_set_char_background(
con: tcod.console.Console,
x: int,
y: int,
col: Tuple[int, int, int],
flag: int = BKGND_SET,
) -> None:
"""Change the background color of x,y to col using a blend mode.
Args:
con (Console): Any Console instance.
x (int): Character x position ... | python | def console_set_char_background(
con: tcod.console.Console,
x: int,
y: int,
col: Tuple[int, int, int],
flag: int = BKGND_SET,
) -> None:
"""Change the background color of x,y to col using a blend mode.
Args:
con (Console): Any Console instance.
x (int): Character x position ... | [
"def",
"console_set_char_background",
"(",
"con",
":",
"tcod",
".",
"console",
".",
"Console",
",",
"x",
":",
"int",
",",
"y",
":",
"int",
",",
"col",
":",
"Tuple",
"[",
"int",
",",
"int",
",",
"int",
"]",
",",
"flag",
":",
"int",
"=",
"BKGND_SET",... | Change the background color of x,y to col using a blend mode.
Args:
con (Console): Any Console instance.
x (int): Character x position from the left.
y (int): Character y position from the top.
col (Union[Tuple[int, int, int], Sequence[int]]):
An (r, g, b) sequence or Co... | [
"Change",
"the",
"background",
"color",
"of",
"x",
"y",
"to",
"col",
"using",
"a",
"blend",
"mode",
"."
] | 8ba10c5cfb813eaf3e834de971ba2d6acb7838e4 | https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1233-L1250 | train |
libtcod/python-tcod | tcod/libtcodpy.py | console_set_char_foreground | def console_set_char_foreground(
con: tcod.console.Console, x: int, y: int, col: Tuple[int, int, int]
) -> None:
"""Change the foreground color of x,y to col.
Args:
con (Console): Any Console instance.
x (int): Character x position from the left.
y (int): Character y position from t... | python | def console_set_char_foreground(
con: tcod.console.Console, x: int, y: int, col: Tuple[int, int, int]
) -> None:
"""Change the foreground color of x,y to col.
Args:
con (Console): Any Console instance.
x (int): Character x position from the left.
y (int): Character y position from t... | [
"def",
"console_set_char_foreground",
"(",
"con",
":",
"tcod",
".",
"console",
".",
"Console",
",",
"x",
":",
"int",
",",
"y",
":",
"int",
",",
"col",
":",
"Tuple",
"[",
"int",
",",
"int",
",",
"int",
"]",
")",
"->",
"None",
":",
"lib",
".",
"TCO... | Change the foreground color of x,y to col.
Args:
con (Console): Any Console instance.
x (int): Character x position from the left.
y (int): Character y position from the top.
col (Union[Tuple[int, int, int], Sequence[int]]):
An (r, g, b) sequence or Color instance.
... | [
"Change",
"the",
"foreground",
"color",
"of",
"x",
"y",
"to",
"col",
"."
] | 8ba10c5cfb813eaf3e834de971ba2d6acb7838e4 | https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1254-L1270 | train |
libtcod/python-tcod | tcod/libtcodpy.py | console_set_char | def console_set_char(
con: tcod.console.Console, x: int, y: int, c: Union[int, str]
) -> None:
"""Change the character at x,y to c, keeping the current colors.
Args:
con (Console): Any Console instance.
x (int): Character x position from the left.
y (int): Character y position from ... | python | def console_set_char(
con: tcod.console.Console, x: int, y: int, c: Union[int, str]
) -> None:
"""Change the character at x,y to c, keeping the current colors.
Args:
con (Console): Any Console instance.
x (int): Character x position from the left.
y (int): Character y position from ... | [
"def",
"console_set_char",
"(",
"con",
":",
"tcod",
".",
"console",
".",
"Console",
",",
"x",
":",
"int",
",",
"y",
":",
"int",
",",
"c",
":",
"Union",
"[",
"int",
",",
"str",
"]",
")",
"->",
"None",
":",
"lib",
".",
"TCOD_console_set_char",
"(",
... | Change the character at x,y to c, keeping the current colors.
Args:
con (Console): Any Console instance.
x (int): Character x position from the left.
y (int): Character y position from the top.
c (Union[int, AnyStr]): Character to draw, can be an integer or string.
.. deprecate... | [
"Change",
"the",
"character",
"at",
"x",
"y",
"to",
"c",
"keeping",
"the",
"current",
"colors",
"."
] | 8ba10c5cfb813eaf3e834de971ba2d6acb7838e4 | https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1274-L1289 | train |
libtcod/python-tcod | tcod/libtcodpy.py | console_set_background_flag | def console_set_background_flag(con: tcod.console.Console, flag: int) -> None:
"""Change the default blend mode for this console.
Args:
con (Console): Any Console instance.
flag (int): Blend mode to use by default.
.. deprecated:: 8.5
Set :any:`Console.default_bg_blend` instead.
... | python | def console_set_background_flag(con: tcod.console.Console, flag: int) -> None:
"""Change the default blend mode for this console.
Args:
con (Console): Any Console instance.
flag (int): Blend mode to use by default.
.. deprecated:: 8.5
Set :any:`Console.default_bg_blend` instead.
... | [
"def",
"console_set_background_flag",
"(",
"con",
":",
"tcod",
".",
"console",
".",
"Console",
",",
"flag",
":",
"int",
")",
"->",
"None",
":",
"lib",
".",
"TCOD_console_set_background_flag",
"(",
"_console",
"(",
"con",
")",
",",
"flag",
")"
] | Change the default blend mode for this console.
Args:
con (Console): Any Console instance.
flag (int): Blend mode to use by default.
.. deprecated:: 8.5
Set :any:`Console.default_bg_blend` instead. | [
"Change",
"the",
"default",
"blend",
"mode",
"for",
"this",
"console",
"."
] | 8ba10c5cfb813eaf3e834de971ba2d6acb7838e4 | https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1293-L1303 | train |
libtcod/python-tcod | tcod/libtcodpy.py | console_get_background_flag | def console_get_background_flag(con: tcod.console.Console) -> int:
"""Return this consoles current blend mode.
Args:
con (Console): Any Console instance.
.. deprecated:: 8.5
Check :any:`Console.default_bg_blend` instead.
"""
return int(lib.TCOD_console_get_background_flag(_console(... | python | def console_get_background_flag(con: tcod.console.Console) -> int:
"""Return this consoles current blend mode.
Args:
con (Console): Any Console instance.
.. deprecated:: 8.5
Check :any:`Console.default_bg_blend` instead.
"""
return int(lib.TCOD_console_get_background_flag(_console(... | [
"def",
"console_get_background_flag",
"(",
"con",
":",
"tcod",
".",
"console",
".",
"Console",
")",
"->",
"int",
":",
"return",
"int",
"(",
"lib",
".",
"TCOD_console_get_background_flag",
"(",
"_console",
"(",
"con",
")",
")",
")"
] | Return this consoles current blend mode.
Args:
con (Console): Any Console instance.
.. deprecated:: 8.5
Check :any:`Console.default_bg_blend` instead. | [
"Return",
"this",
"consoles",
"current",
"blend",
"mode",
"."
] | 8ba10c5cfb813eaf3e834de971ba2d6acb7838e4 | https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1307-L1316 | train |
libtcod/python-tcod | tcod/libtcodpy.py | console_set_alignment | def console_set_alignment(con: tcod.console.Console, alignment: int) -> None:
"""Change this consoles current alignment mode.
* tcod.LEFT
* tcod.CENTER
* tcod.RIGHT
Args:
con (Console): Any Console instance.
alignment (int):
.. deprecated:: 8.5
Set :any:`Console.defaul... | python | def console_set_alignment(con: tcod.console.Console, alignment: int) -> None:
"""Change this consoles current alignment mode.
* tcod.LEFT
* tcod.CENTER
* tcod.RIGHT
Args:
con (Console): Any Console instance.
alignment (int):
.. deprecated:: 8.5
Set :any:`Console.defaul... | [
"def",
"console_set_alignment",
"(",
"con",
":",
"tcod",
".",
"console",
".",
"Console",
",",
"alignment",
":",
"int",
")",
"->",
"None",
":",
"lib",
".",
"TCOD_console_set_alignment",
"(",
"_console",
"(",
"con",
")",
",",
"alignment",
")"
] | Change this consoles current alignment mode.
* tcod.LEFT
* tcod.CENTER
* tcod.RIGHT
Args:
con (Console): Any Console instance.
alignment (int):
.. deprecated:: 8.5
Set :any:`Console.default_alignment` instead. | [
"Change",
"this",
"consoles",
"current",
"alignment",
"mode",
"."
] | 8ba10c5cfb813eaf3e834de971ba2d6acb7838e4 | https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1320-L1334 | train |
libtcod/python-tcod | tcod/libtcodpy.py | console_get_alignment | def console_get_alignment(con: tcod.console.Console) -> int:
"""Return this consoles current alignment mode.
Args:
con (Console): Any Console instance.
.. deprecated:: 8.5
Check :any:`Console.default_alignment` instead.
"""
return int(lib.TCOD_console_get_alignment(_console(con))) | python | def console_get_alignment(con: tcod.console.Console) -> int:
"""Return this consoles current alignment mode.
Args:
con (Console): Any Console instance.
.. deprecated:: 8.5
Check :any:`Console.default_alignment` instead.
"""
return int(lib.TCOD_console_get_alignment(_console(con))) | [
"def",
"console_get_alignment",
"(",
"con",
":",
"tcod",
".",
"console",
".",
"Console",
")",
"->",
"int",
":",
"return",
"int",
"(",
"lib",
".",
"TCOD_console_get_alignment",
"(",
"_console",
"(",
"con",
")",
")",
")"
] | Return this consoles current alignment mode.
Args:
con (Console): Any Console instance.
.. deprecated:: 8.5
Check :any:`Console.default_alignment` instead. | [
"Return",
"this",
"consoles",
"current",
"alignment",
"mode",
"."
] | 8ba10c5cfb813eaf3e834de971ba2d6acb7838e4 | https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1338-L1347 | train |
libtcod/python-tcod | tcod/libtcodpy.py | console_print_ex | def console_print_ex(
con: tcod.console.Console,
x: int,
y: int,
flag: int,
alignment: int,
fmt: str,
) -> None:
"""Print a string on a console using a blend mode and alignment mode.
Args:
con (Console): Any Console instance.
x (int): Character x position from the left.
... | python | def console_print_ex(
con: tcod.console.Console,
x: int,
y: int,
flag: int,
alignment: int,
fmt: str,
) -> None:
"""Print a string on a console using a blend mode and alignment mode.
Args:
con (Console): Any Console instance.
x (int): Character x position from the left.
... | [
"def",
"console_print_ex",
"(",
"con",
":",
"tcod",
".",
"console",
".",
"Console",
",",
"x",
":",
"int",
",",
"y",
":",
"int",
",",
"flag",
":",
"int",
",",
"alignment",
":",
"int",
",",
"fmt",
":",
"str",
",",
")",
"->",
"None",
":",
"lib",
"... | Print a string on a console using a blend mode and alignment mode.
Args:
con (Console): Any Console instance.
x (int): Character x position from the left.
y (int): Character y position from the top.
.. deprecated:: 8.5
Use :any:`Console.print_` instead. | [
"Print",
"a",
"string",
"on",
"a",
"console",
"using",
"a",
"blend",
"mode",
"and",
"alignment",
"mode",
"."
] | 8ba10c5cfb813eaf3e834de971ba2d6acb7838e4 | https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1367-L1385 | train |
libtcod/python-tcod | tcod/libtcodpy.py | console_print_rect_ex | def console_print_rect_ex(
con: tcod.console.Console,
x: int,
y: int,
w: int,
h: int,
flag: int,
alignment: int,
fmt: str,
) -> int:
"""Print a string constrained to a rectangle with blend and alignment.
Returns:
int: The number of lines of text once word-wrapped.
.... | python | def console_print_rect_ex(
con: tcod.console.Console,
x: int,
y: int,
w: int,
h: int,
flag: int,
alignment: int,
fmt: str,
) -> int:
"""Print a string constrained to a rectangle with blend and alignment.
Returns:
int: The number of lines of text once word-wrapped.
.... | [
"def",
"console_print_rect_ex",
"(",
"con",
":",
"tcod",
".",
"console",
".",
"Console",
",",
"x",
":",
"int",
",",
"y",
":",
"int",
",",
"w",
":",
"int",
",",
"h",
":",
"int",
",",
"flag",
":",
"int",
",",
"alignment",
":",
"int",
",",
"fmt",
... | Print a string constrained to a rectangle with blend and alignment.
Returns:
int: The number of lines of text once word-wrapped.
.. deprecated:: 8.5
Use :any:`Console.print_rect` instead. | [
"Print",
"a",
"string",
"constrained",
"to",
"a",
"rectangle",
"with",
"blend",
"and",
"alignment",
"."
] | 8ba10c5cfb813eaf3e834de971ba2d6acb7838e4 | https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1412-L1434 | train |
libtcod/python-tcod | tcod/libtcodpy.py | console_get_height_rect | def console_get_height_rect(
con: tcod.console.Console, x: int, y: int, w: int, h: int, fmt: str
) -> int:
"""Return the height of this text once word-wrapped into this rectangle.
Returns:
int: The number of lines of text once word-wrapped.
.. deprecated:: 8.5
Use :any:`Console.get_hei... | python | def console_get_height_rect(
con: tcod.console.Console, x: int, y: int, w: int, h: int, fmt: str
) -> int:
"""Return the height of this text once word-wrapped into this rectangle.
Returns:
int: The number of lines of text once word-wrapped.
.. deprecated:: 8.5
Use :any:`Console.get_hei... | [
"def",
"console_get_height_rect",
"(",
"con",
":",
"tcod",
".",
"console",
".",
"Console",
",",
"x",
":",
"int",
",",
"y",
":",
"int",
",",
"w",
":",
"int",
",",
"h",
":",
"int",
",",
"fmt",
":",
"str",
")",
"->",
"int",
":",
"return",
"int",
"... | Return the height of this text once word-wrapped into this rectangle.
Returns:
int: The number of lines of text once word-wrapped.
.. deprecated:: 8.5
Use :any:`Console.get_height_rect` instead. | [
"Return",
"the",
"height",
"of",
"this",
"text",
"once",
"word",
"-",
"wrapped",
"into",
"this",
"rectangle",
"."
] | 8ba10c5cfb813eaf3e834de971ba2d6acb7838e4 | https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1438-L1453 | train |
libtcod/python-tcod | tcod/libtcodpy.py | console_print_frame | def console_print_frame(
con: tcod.console.Console,
x: int,
y: int,
w: int,
h: int,
clear: bool = True,
flag: int = BKGND_DEFAULT,
fmt: str = "",
) -> None:
"""Draw a framed rectangle with optinal text.
This uses the default background color and blend mode to fill the
rectan... | python | def console_print_frame(
con: tcod.console.Console,
x: int,
y: int,
w: int,
h: int,
clear: bool = True,
flag: int = BKGND_DEFAULT,
fmt: str = "",
) -> None:
"""Draw a framed rectangle with optinal text.
This uses the default background color and blend mode to fill the
rectan... | [
"def",
"console_print_frame",
"(",
"con",
":",
"tcod",
".",
"console",
".",
"Console",
",",
"x",
":",
"int",
",",
"y",
":",
"int",
",",
"w",
":",
"int",
",",
"h",
":",
"int",
",",
"clear",
":",
"bool",
"=",
"True",
",",
"flag",
":",
"int",
"=",... | Draw a framed rectangle with optinal text.
This uses the default background color and blend mode to fill the
rectangle and the default foreground to draw the outline.
`fmt` will be printed on the inside of the rectangle, word-wrapped.
If `fmt` is empty then no title will be drawn.
.. versionchang... | [
"Draw",
"a",
"framed",
"rectangle",
"with",
"optinal",
"text",
"."
] | 8ba10c5cfb813eaf3e834de971ba2d6acb7838e4 | https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1513-L1538 | train |
libtcod/python-tcod | tcod/libtcodpy.py | console_get_default_background | def console_get_default_background(con: tcod.console.Console) -> Color:
"""Return this consoles default background color.
.. deprecated:: 8.5
Use :any:`Console.default_bg` instead.
"""
return Color._new_from_cdata(
lib.TCOD_console_get_default_background(_console(con))
) | python | def console_get_default_background(con: tcod.console.Console) -> Color:
"""Return this consoles default background color.
.. deprecated:: 8.5
Use :any:`Console.default_bg` instead.
"""
return Color._new_from_cdata(
lib.TCOD_console_get_default_background(_console(con))
) | [
"def",
"console_get_default_background",
"(",
"con",
":",
"tcod",
".",
"console",
".",
"Console",
")",
"->",
"Color",
":",
"return",
"Color",
".",
"_new_from_cdata",
"(",
"lib",
".",
"TCOD_console_get_default_background",
"(",
"_console",
"(",
"con",
")",
")",
... | Return this consoles default background color.
.. deprecated:: 8.5
Use :any:`Console.default_bg` instead. | [
"Return",
"this",
"consoles",
"default",
"background",
"color",
"."
] | 8ba10c5cfb813eaf3e834de971ba2d6acb7838e4 | https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1558-L1566 | train |
libtcod/python-tcod | tcod/libtcodpy.py | console_get_default_foreground | def console_get_default_foreground(con: tcod.console.Console) -> Color:
"""Return this consoles default foreground color.
.. deprecated:: 8.5
Use :any:`Console.default_fg` instead.
"""
return Color._new_from_cdata(
lib.TCOD_console_get_default_foreground(_console(con))
) | python | def console_get_default_foreground(con: tcod.console.Console) -> Color:
"""Return this consoles default foreground color.
.. deprecated:: 8.5
Use :any:`Console.default_fg` instead.
"""
return Color._new_from_cdata(
lib.TCOD_console_get_default_foreground(_console(con))
) | [
"def",
"console_get_default_foreground",
"(",
"con",
":",
"tcod",
".",
"console",
".",
"Console",
")",
"->",
"Color",
":",
"return",
"Color",
".",
"_new_from_cdata",
"(",
"lib",
".",
"TCOD_console_get_default_foreground",
"(",
"_console",
"(",
"con",
")",
")",
... | Return this consoles default foreground color.
.. deprecated:: 8.5
Use :any:`Console.default_fg` instead. | [
"Return",
"this",
"consoles",
"default",
"foreground",
"color",
"."
] | 8ba10c5cfb813eaf3e834de971ba2d6acb7838e4 | https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1570-L1578 | train |
libtcod/python-tcod | tcod/libtcodpy.py | console_get_char_background | def console_get_char_background(
con: tcod.console.Console, x: int, y: int
) -> Color:
"""Return the background color at the x,y of this console.
.. deprecated:: 8.4
Array access performs significantly faster than using this function.
See :any:`Console.bg`.
"""
return Color._new_fro... | python | def console_get_char_background(
con: tcod.console.Console, x: int, y: int
) -> Color:
"""Return the background color at the x,y of this console.
.. deprecated:: 8.4
Array access performs significantly faster than using this function.
See :any:`Console.bg`.
"""
return Color._new_fro... | [
"def",
"console_get_char_background",
"(",
"con",
":",
"tcod",
".",
"console",
".",
"Console",
",",
"x",
":",
"int",
",",
"y",
":",
"int",
")",
"->",
"Color",
":",
"return",
"Color",
".",
"_new_from_cdata",
"(",
"lib",
".",
"TCOD_console_get_char_background"... | Return the background color at the x,y of this console.
.. deprecated:: 8.4
Array access performs significantly faster than using this function.
See :any:`Console.bg`. | [
"Return",
"the",
"background",
"color",
"at",
"the",
"x",
"y",
"of",
"this",
"console",
"."
] | 8ba10c5cfb813eaf3e834de971ba2d6acb7838e4 | https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1582-L1593 | train |
libtcod/python-tcod | tcod/libtcodpy.py | console_get_char_foreground | def console_get_char_foreground(
con: tcod.console.Console, x: int, y: int
) -> Color:
"""Return the foreground color at the x,y of this console.
.. deprecated:: 8.4
Array access performs significantly faster than using this function.
See :any:`Console.fg`.
"""
return Color._new_fro... | python | def console_get_char_foreground(
con: tcod.console.Console, x: int, y: int
) -> Color:
"""Return the foreground color at the x,y of this console.
.. deprecated:: 8.4
Array access performs significantly faster than using this function.
See :any:`Console.fg`.
"""
return Color._new_fro... | [
"def",
"console_get_char_foreground",
"(",
"con",
":",
"tcod",
".",
"console",
".",
"Console",
",",
"x",
":",
"int",
",",
"y",
":",
"int",
")",
"->",
"Color",
":",
"return",
"Color",
".",
"_new_from_cdata",
"(",
"lib",
".",
"TCOD_console_get_char_foreground"... | Return the foreground color at the x,y of this console.
.. deprecated:: 8.4
Array access performs significantly faster than using this function.
See :any:`Console.fg`. | [
"Return",
"the",
"foreground",
"color",
"at",
"the",
"x",
"y",
"of",
"this",
"console",
"."
] | 8ba10c5cfb813eaf3e834de971ba2d6acb7838e4 | https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1597-L1608 | train |
libtcod/python-tcod | tcod/libtcodpy.py | console_get_char | def console_get_char(con: tcod.console.Console, x: int, y: int) -> int:
"""Return the character at the x,y of this console.
.. deprecated:: 8.4
Array access performs significantly faster than using this function.
See :any:`Console.ch`.
"""
return lib.TCOD_console_get_char(_console(con),... | python | def console_get_char(con: tcod.console.Console, x: int, y: int) -> int:
"""Return the character at the x,y of this console.
.. deprecated:: 8.4
Array access performs significantly faster than using this function.
See :any:`Console.ch`.
"""
return lib.TCOD_console_get_char(_console(con),... | [
"def",
"console_get_char",
"(",
"con",
":",
"tcod",
".",
"console",
".",
"Console",
",",
"x",
":",
"int",
",",
"y",
":",
"int",
")",
"->",
"int",
":",
"return",
"lib",
".",
"TCOD_console_get_char",
"(",
"_console",
"(",
"con",
")",
",",
"x",
",",
"... | Return the character at the x,y of this console.
.. deprecated:: 8.4
Array access performs significantly faster than using this function.
See :any:`Console.ch`. | [
"Return",
"the",
"character",
"at",
"the",
"x",
"y",
"of",
"this",
"console",
"."
] | 8ba10c5cfb813eaf3e834de971ba2d6acb7838e4 | https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1612-L1619 | train |
libtcod/python-tcod | tcod/libtcodpy.py | console_wait_for_keypress | def console_wait_for_keypress(flush: bool) -> Key:
"""Block until the user presses a key, then returns a new Key.
Args:
flush bool: If True then the event queue is cleared before waiting
for the next event.
Returns:
Key: A new Key instance.
.. deprecated:: 9.3
... | python | def console_wait_for_keypress(flush: bool) -> Key:
"""Block until the user presses a key, then returns a new Key.
Args:
flush bool: If True then the event queue is cleared before waiting
for the next event.
Returns:
Key: A new Key instance.
.. deprecated:: 9.3
... | [
"def",
"console_wait_for_keypress",
"(",
"flush",
":",
"bool",
")",
"->",
"Key",
":",
"key",
"=",
"Key",
"(",
")",
"lib",
".",
"TCOD_console_wait_for_keypress_wrapper",
"(",
"key",
".",
"key_p",
",",
"flush",
")",
"return",
"key"
] | Block until the user presses a key, then returns a new Key.
Args:
flush bool: If True then the event queue is cleared before waiting
for the next event.
Returns:
Key: A new Key instance.
.. deprecated:: 9.3
Use the :any:`tcod.event.wait` function to wait for ev... | [
"Block",
"until",
"the",
"user",
"presses",
"a",
"key",
"then",
"returns",
"a",
"new",
"Key",
"."
] | 8ba10c5cfb813eaf3e834de971ba2d6acb7838e4 | https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1639-L1654 | train |
libtcod/python-tcod | tcod/libtcodpy.py | console_from_file | def console_from_file(filename: str) -> tcod.console.Console:
"""Return a new console object from a filename.
The file format is automactially determined. This can load REXPaint `.xp`,
ASCII Paint `.apf`, or Non-delimited ASCII `.asc` files.
Args:
filename (Text): The path to the file, as a s... | python | def console_from_file(filename: str) -> tcod.console.Console:
"""Return a new console object from a filename.
The file format is automactially determined. This can load REXPaint `.xp`,
ASCII Paint `.apf`, or Non-delimited ASCII `.asc` files.
Args:
filename (Text): The path to the file, as a s... | [
"def",
"console_from_file",
"(",
"filename",
":",
"str",
")",
"->",
"tcod",
".",
"console",
".",
"Console",
":",
"return",
"tcod",
".",
"console",
".",
"Console",
".",
"_from_cdata",
"(",
"lib",
".",
"TCOD_console_from_file",
"(",
"filename",
".",
"encode",
... | Return a new console object from a filename.
The file format is automactially determined. This can load REXPaint `.xp`,
ASCII Paint `.apf`, or Non-delimited ASCII `.asc` files.
Args:
filename (Text): The path to the file, as a string.
Returns: A new :any`Console` instance. | [
"Return",
"a",
"new",
"console",
"object",
"from",
"a",
"filename",
"."
] | 8ba10c5cfb813eaf3e834de971ba2d6acb7838e4 | https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1685-L1698 | train |
libtcod/python-tcod | tcod/libtcodpy.py | console_blit | def console_blit(
src: tcod.console.Console,
x: int,
y: int,
w: int,
h: int,
dst: tcod.console.Console,
xdst: int,
ydst: int,
ffade: float = 1.0,
bfade: float = 1.0,
) -> None:
"""Blit the console src from x,y,w,h to console dst at xdst,ydst.
.. deprecated:: 8.5
... | python | def console_blit(
src: tcod.console.Console,
x: int,
y: int,
w: int,
h: int,
dst: tcod.console.Console,
xdst: int,
ydst: int,
ffade: float = 1.0,
bfade: float = 1.0,
) -> None:
"""Blit the console src from x,y,w,h to console dst at xdst,ydst.
.. deprecated:: 8.5
... | [
"def",
"console_blit",
"(",
"src",
":",
"tcod",
".",
"console",
".",
"Console",
",",
"x",
":",
"int",
",",
"y",
":",
"int",
",",
"w",
":",
"int",
",",
"h",
":",
"int",
",",
"dst",
":",
"tcod",
".",
"console",
".",
"Console",
",",
"xdst",
":",
... | Blit the console src from x,y,w,h to console dst at xdst,ydst.
.. deprecated:: 8.5
Call the :any:`Console.blit` method instead. | [
"Blit",
"the",
"console",
"src",
"from",
"x",
"y",
"w",
"h",
"to",
"console",
"dst",
"at",
"xdst",
"ydst",
"."
] | 8ba10c5cfb813eaf3e834de971ba2d6acb7838e4 | https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1702-L1721 | train |
libtcod/python-tcod | tcod/libtcodpy.py | console_delete | def console_delete(con: tcod.console.Console) -> None:
"""Closes the window if `con` is the root console.
libtcod objects are automatically garbage collected once they go out of
scope.
This function exists for backwards compatibility.
.. deprecated:: 9.3
This function is not needed for no... | python | def console_delete(con: tcod.console.Console) -> None:
"""Closes the window if `con` is the root console.
libtcod objects are automatically garbage collected once they go out of
scope.
This function exists for backwards compatibility.
.. deprecated:: 9.3
This function is not needed for no... | [
"def",
"console_delete",
"(",
"con",
":",
"tcod",
".",
"console",
".",
"Console",
")",
"->",
"None",
":",
"con",
"=",
"_console",
"(",
"con",
")",
"if",
"con",
"==",
"ffi",
".",
"NULL",
":",
"lib",
".",
"TCOD_console_delete",
"(",
"con",
")",
"warnin... | Closes the window if `con` is the root console.
libtcod objects are automatically garbage collected once they go out of
scope.
This function exists for backwards compatibility.
.. deprecated:: 9.3
This function is not needed for normal :any:`tcod.console.Console`'s.
The root console s... | [
"Closes",
"the",
"window",
"if",
"con",
"is",
"the",
"root",
"console",
"."
] | 8ba10c5cfb813eaf3e834de971ba2d6acb7838e4 | https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1741-L1771 | train |
libtcod/python-tcod | tcod/libtcodpy.py | console_fill_foreground | def console_fill_foreground(
con: tcod.console.Console,
r: Sequence[int],
g: Sequence[int],
b: Sequence[int],
) -> None:
"""Fill the foregound of a console with r,g,b.
Args:
con (Console): Any Console instance.
r (Sequence[int]): An array of integers with a length of width*heigh... | python | def console_fill_foreground(
con: tcod.console.Console,
r: Sequence[int],
g: Sequence[int],
b: Sequence[int],
) -> None:
"""Fill the foregound of a console with r,g,b.
Args:
con (Console): Any Console instance.
r (Sequence[int]): An array of integers with a length of width*heigh... | [
"def",
"console_fill_foreground",
"(",
"con",
":",
"tcod",
".",
"console",
".",
"Console",
",",
"r",
":",
"Sequence",
"[",
"int",
"]",
",",
"g",
":",
"Sequence",
"[",
"int",
"]",
",",
"b",
":",
"Sequence",
"[",
"int",
"]",
",",
")",
"->",
"None",
... | Fill the foregound of a console with r,g,b.
Args:
con (Console): Any Console instance.
r (Sequence[int]): An array of integers with a length of width*height.
g (Sequence[int]): An array of integers with a length of width*height.
b (Sequence[int]): An array of integers with a length ... | [
"Fill",
"the",
"foregound",
"of",
"a",
"console",
"with",
"r",
"g",
"b",
"."
] | 8ba10c5cfb813eaf3e834de971ba2d6acb7838e4 | https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L1775-L1812 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.