Skip to content

Commit ccb5d49

Browse files
committed
Deprecate more libtcodpy functions.
1 parent 04901bf commit ccb5d49

File tree

2 files changed

+51
-9
lines changed

2 files changed

+51
-9
lines changed

CHANGELOG.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ v2.0.0
88

99
Unreleased
1010
------------------
11+
Deprecated
12+
- `tcod.console_is_key_pressed` was replaced with `tcod.event.get_keyboard_state`.
13+
- `tcod.console_from_file` is deprecated.
14+
- The `.asc` and `.apf` formats are no longer actively supported.
1115

1216
12.7.2 - 2021-07-01
1317
-------------------

tcod/libtcodpy.py

Lines changed: 47 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1720,6 +1720,12 @@ def console_wait_for_keypress(flush: bool) -> Key:
17201720
17211721
.. deprecated:: 9.3
17221722
Use the :any:`tcod.event.wait` function to wait for events.
1723+
1724+
Example::
1725+
1726+
for event in tcod.event.wait():
1727+
if isinstance(event, tcod.event.KeyDown):
1728+
...
17231729
"""
17241730
key = Key()
17251731
lib.TCOD_console_wait_for_keypress_wrapper(key.key_p, flush)
@@ -1731,14 +1737,24 @@ def console_check_for_keypress(flags: int = KEY_RELEASED) -> Key:
17311737
"""
17321738
.. deprecated:: 9.3
17331739
Use the :any:`tcod.event.get` function to check for events.
1740+
1741+
Example::
1742+
1743+
for event in tcod.event.get():
1744+
if isinstance(event, tcod.event.KeyDown):
1745+
...
17341746
"""
17351747
key = Key()
17361748
lib.TCOD_console_check_for_keypress_wrapper(key.key_p, flags)
17371749
return key
17381750

17391751

1740-
@pending_deprecate()
1752+
@deprecate("Use tcod.event.get_keyboard_state to see if a key is held.")
17411753
def console_is_key_pressed(key: int) -> bool:
1754+
"""
1755+
.. deprecated:: 12.7
1756+
Use :any:`tcod.event.get_keyboard_state` to check if a key is held.
1757+
"""
17421758
return bool(lib.TCOD_console_is_key_pressed(key))
17431759

17441760

@@ -1754,6 +1770,7 @@ def console_new(w: int, h: int) -> tcod.console.Console:
17541770
return tcod.console.Console(w, h)
17551771

17561772

1773+
@deprecate("This loading method is no longer supported, use tcod.console_load_xp instead.")
17571774
def console_from_file(filename: str) -> tcod.console.Console:
17581775
"""Return a new console object from a filename.
17591776
@@ -1764,6 +1781,11 @@ def console_from_file(filename: str) -> tcod.console.Console:
17641781
filename (Text): The path to the file, as a string.
17651782
17661783
Returns: A new :any`Console` instance.
1784+
1785+
.. deprecated:: 12.7
1786+
Use :any:`tcod.console_load_xp` to load REXPaint consoles.
1787+
1788+
Other formats are not actively supported.
17671789
"""
17681790
if not os.path.exists(filename):
17691791
raise RuntimeError("File not found:\n\t%s" % (os.path.realpath(filename),))
@@ -1933,27 +1955,43 @@ def console_fill_char(con: tcod.console.Console, arr: Sequence[int]) -> None:
19331955
lib.TCOD_console_fill_char(_console(con), carr)
19341956

19351957

1936-
@pending_deprecate()
1958+
@deprecate("This format is not actively supported")
19371959
def console_load_asc(con: tcod.console.Console, filename: str) -> bool:
1938-
"""Update a console from a non-delimited ASCII `.asc` file."""
1960+
"""Update a console from a non-delimited ASCII `.asc` file.
1961+
1962+
.. deprecated:: 12.7
1963+
This format is no longer supported.
1964+
"""
19391965
return bool(lib.TCOD_console_load_asc(_console(con), filename.encode("utf-8")))
19401966

19411967

1942-
@pending_deprecate()
1968+
@deprecate("This format is not actively supported")
19431969
def console_save_asc(con: tcod.console.Console, filename: str) -> bool:
1944-
"""Save a console to a non-delimited ASCII `.asc` file."""
1970+
"""Save a console to a non-delimited ASCII `.asc` file.
1971+
1972+
.. deprecated:: 12.7
1973+
This format is no longer supported.
1974+
"""
19451975
return bool(lib.TCOD_console_save_asc(_console(con), filename.encode("utf-8")))
19461976

19471977

1948-
@pending_deprecate()
1978+
@deprecate("This format is not actively supported")
19491979
def console_load_apf(con: tcod.console.Console, filename: str) -> bool:
1950-
"""Update a console from an ASCII Paint `.apf` file."""
1980+
"""Update a console from an ASCII Paint `.apf` file.
1981+
1982+
.. deprecated:: 12.7
1983+
This format is no longer supported.
1984+
"""
19511985
return bool(lib.TCOD_console_load_apf(_console(con), filename.encode("utf-8")))
19521986

19531987

1954-
@pending_deprecate()
1988+
@deprecate("This format is not actively supported")
19551989
def console_save_apf(con: tcod.console.Console, filename: str) -> bool:
1956-
"""Save a console to an ASCII Paint `.apf` file."""
1990+
"""Save a console to an ASCII Paint `.apf` file.
1991+
1992+
.. deprecated:: 12.7
1993+
This format is no longer supported.
1994+
"""
19571995
return bool(lib.TCOD_console_save_apf(_console(con), filename.encode("utf-8")))
19581996

19591997

0 commit comments

Comments
 (0)