Skip to content

Commit

Permalink
Prepare 12.4.0 release.
Browse files Browse the repository at this point in the history
  • Loading branch information
HexDecimal committed May 21, 2021
1 parent e0cd96d commit 8ddd70c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.rst
Expand Up @@ -8,13 +8,16 @@ v2.0.0

Unreleased
------------------

12.4.0 - 2021-05-21
-------------------
Added
- Added modernized REXPaint saving/loading functions.
- `tcod.console.load_xp`
- `tcod.console.save_xp`

Changed
- Using `libtcod 1.18.0`.
- Using `libtcod 1.18.1`.

Fixed
- `tcod.event.KeySym` and `tcod.event.Scancode ` can now be hashed.
Expand Down
6 changes: 2 additions & 4 deletions tcod/console.py
Expand Up @@ -1257,6 +1257,7 @@ def load_xp(
# Convert from REXPaint's encoding to Unicode.
CP437_TO_UNICODE = np.asarray(tcod.tileset.CHARMAP_CP437)
console.ch[:] = CP437_TO_UNICODE[console.ch]
# Apply REXPaint's alpha key color.
Expand Down Expand Up @@ -1302,15 +1303,12 @@ def save_xp(
console = tcod.Console(80, 24) # Example console.
# Load a REXPaint file with a single layer.
# The comma after console is used to unpack a single item tuple.
console, = tcod.console.load_xp(path, order="F")
# Convert from Unicode to REXPaint's encoding.
# Required to load this console correctly in the REXPaint tool.
CP437_TO_UNICODE = np.asarray(tcod.tileset.CHARMAP_CP437)
UNICODE_TO_CP437 = np.full(0x1FFFF, fill_value=ord("?"))
UNICODE_TO_CP437[CP437_TO_UNICODE] = np.arange(len(CP437_TO_UNICODE))
console.ch[:] = UNICODE_TO_CP437[console.ch]
# Convert console alpha into REXPaint's alpha key color.
Expand Down

0 comments on commit 8ddd70c

Please sign in to comment.