Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@deprecate("Call the `con.clear()` method instead.")
def console_clear(con: tcod.console.Console) -> None:
"""Reset a console to its default colors and the space character.
Args:
con (Console): Any Console instance.
.. seealso::
:any:`console_set_default_background`
:any:`console_set_default_foreground`
.. deprecated:: 8.5
Call the :any:`Console.clear` method instead.
"""
lib.TCOD_console_clear(_console(con))
@deprecate("Directly access a consoles foreground color with `console.fg`")
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 the top.
col (Union[Tuple[int, int, int], Sequence[int]]):
An (r, g, b) sequence or Color instance.
.. deprecated:: 8.4
Array access performs significantly faster than using this function.
See :any:`Console.fg`.
"""
@deprecate("Check the `con.default_bg_blend` attribute instead.")
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(con)))
@deprecate("Iterate over nodes using 'for n in node.level_order():' instead.")
def bsp_traverse_level_order(
node: tcod.bsp.BSP,
callback: Callable[[tcod.bsp.BSP, Any], None],
userData: Any = 0,
) -> None:
"""Traverse this nodes hierarchy with a callback.
.. deprecated:: 2.0
Use :any:`BSP.level_order` instead.
"""
_bsp_traverse(node.level_order(), callback, userData)
@deprecate("Use the tcod.event.get function to check for events.")
def console_check_for_keypress(flags: int = KEY_RELEASED) -> Key:
"""
.. deprecated:: 9.3
Use the :any:`tcod.event.get` function to check for events.
"""
key = Key()
lib.TCOD_console_check_for_keypress_wrapper(key.key_p, flags)
return key
@deprecate("Use Python's standard copy module instead.")
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.height:
dest.__init__( # type: ignore
source.width, source.height, source._order
)
dest._Map__buffer[:] = source._Map__buffer[:] # type: ignore
@deprecate("This function is deprecated.")
def struct_is_mandatory(struct, name): # type: ignore
return lib.TCOD_struct_is_mandatory(struct, name)
@deprecate("Parser functions have been deprecated.")
def parser_get_string_property(parser: Any, name: str) -> str:
return _unpack_char_p(
lib.TCOD_parser_get_string_property(parser, _bytes(name))
)
@deprecate("Setting color attributes has been deprecated.")
def r(self, value: int) -> None:
self[0] = value & 0xFF
@deprecate("Parser functions have been deprecated.")
def parser_new() -> Any:
return ffi.gc(lib.TCOD_parser_new(), lib.TCOD_parser_delete)