Skip to content

Commit ba4ac69

Browse files
committed
Update libtcod and SDL versions.
Apply new fixes from libtcod and warn for changes in renderers. Update parser to handle a more complex deprecation qualifier. Remove references to GLAD. Update Numpy typing.
1 parent 33ead26 commit ba4ac69

File tree

9 files changed

+46
-17
lines changed

9 files changed

+46
-17
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ Changes relevant to the users of python-tcod are documented here.
44
This project adheres to [Semantic Versioning](https://semver.org/) since version `2.0.0`.
55

66
## [Unreleased]
7+
### Changed
8+
- Using `libtcod 1.23.1`.
9+
- Bundle `SDL 2.26.0` on Windows and MacOS.
10+
- Code Page 437: Character 0x7F is now assigned to 0x2302 (HOUSE).
11+
- Forced all renderers to ``RENDERER_SDL2`` to fix rare graphical artifacts with OpenGL.
12+
13+
### Deprecated
14+
- The `renderer` parameter of new contexts is now deprecated.
715

816
## [13.8.1] - 2022-09-23
917
### Fixed

build_libtcod.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
RE_INCLUDE = re.compile(r'#include "([^"]*)"')
3030
RE_TAGS = re.compile(
3131
r"TCODLIB_C?API|TCOD_PUBLIC|TCOD_NODISCARD|TCOD_DEPRECATED_NOMESSAGE|TCOD_DEPRECATED_ENUM"
32+
r"|(TCOD_DEPRECATED\(\".*?\"\))"
3233
r"|(TCOD_DEPRECATED|TCODLIB_FORMAT)\([^)]*\)|__restrict"
3334
)
3435
RE_VAFUNC = re.compile(r"^[^;]*\([^;]*va_list.*\);", re.MULTILINE)
@@ -151,7 +152,6 @@ def walk_sources(directory: str) -> Iterator[str]:
151152
sources += walk_sources("tcod/")
152153
sources += walk_sources("libtcod/src/libtcod/")
153154
sources += ["libtcod/src/vendor/stb.c"]
154-
sources += ["libtcod/src/vendor/glad.c"]
155155
sources += ["libtcod/src/vendor/lodepng.c"]
156156
sources += ["libtcod/src/vendor/utf8proc/utf8proc.c"]
157157
sources += glob.glob("libtcod/src/vendor/zlib/*.c")
@@ -265,6 +265,8 @@ def parse_sdl_attrs(prefix: str, all_names: List[str]) -> Tuple[str, str]:
265265
names = []
266266
lookup = []
267267
for name, value in sorted(find_sdl_attrs(prefix), key=lambda item: item[1]):
268+
if name == "KMOD_RESERVED":
269+
continue
268270
all_names.append(name)
269271
names.append(f"{name} = {value}")
270272
lookup.append(f'{value}: "{name}"')

build_sdl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
# The SDL2 version to parse and export symbols from.
2323
SDL2_PARSE_VERSION = os.environ.get("SDL_VERSION", "2.0.20")
2424
# The SDL2 version to include in binary distributions.
25-
SDL2_BUNDLE_VERSION = os.environ.get("SDL_VERSION", "2.24.0")
25+
SDL2_BUNDLE_VERSION = os.environ.get("SDL_VERSION", "2.26.0")
2626

2727

2828
# Used to remove excessive newlines in debug outputs.

docs/tcod/charmap-reference.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ https://en.wikipedia.org/wiki/Code_page_437
173173
124 0x7C \'\|\' VERTICAL LINE
174174
125 0x7D \'}\' RIGHT CURLY BRACKET
175175
126 0x7E \'~\' TILDE
176-
127 0x7F \'\\x7f\'
176+
127 0x2302 \'\' HOUSE
177177
128 0xC7 \'Ç\' LATIN CAPITAL LETTER C WITH CEDILLA
178178
129 0xFC \'ü\' LATIN SMALL LETTER U WITH DIAERESIS
179179
130 0xE9 \'é\' LATIN SMALL LETTER E WITH ACUTE

tcod/context.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -489,9 +489,7 @@ def new(
489489
490490
Providing no size information at all is also acceptable.
491491
492-
`renderer` is the desired libtcod renderer to use.
493-
The default is :any:`tcod.context.RENDERER_SDL2` which is a fast renderer that runs reliably on all platforms.
494-
If unsure then don't set this parameter.
492+
`renderer` now does nothing and should not be set. It may be removed in the future.
495493
496494
`tileset` is the font/tileset for the new context to render with.
497495
The fall-back tileset available from passing None is useful for
@@ -524,14 +522,14 @@ def new(
524522
.. versionchanged:: 13.2
525523
Added the `console` parameter.
526524
"""
527-
if renderer is None:
528-
renderer = RENDERER_SDL2
529-
if renderer != RENDERER_SDL2:
525+
if renderer is not None:
530526
warnings.warn(
531-
"In the future all renderers other than tcod.RENDERER_SDL2 may be removed or ignored.",
532-
PendingDeprecationWarning,
527+
"The renderer parameter was deprecated and will likely be removed in a future version of libtcod. "
528+
"Remove the renderer parameter to fix this warning.",
529+
FutureWarning,
533530
stacklevel=2,
534531
)
532+
renderer = RENDERER_SDL2
535533
if sdl_window_flags is None:
536534
sdl_window_flags = SDL_WINDOW_RESIZABLE
537535
if argv is None:

tcod/event.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1583,7 +1583,7 @@ def get_keyboard_state() -> NDArray[np.bool_]:
15831583
numkeys = ffi.new("int[1]")
15841584
keyboard_state = lib.SDL_GetKeyboardState(numkeys)
15851585
out: NDArray[np.bool_] = np.frombuffer(ffi.buffer(keyboard_state[0 : numkeys[0]]), dtype=np.bool_)
1586-
out.flags["WRITEABLE"] = False # type: ignore[index] # This buffer is supposed to be const.
1586+
out.flags["WRITEABLE"] = False # This buffer is supposed to be const.
15871587
return out
15881588

15891589

@@ -2094,6 +2094,8 @@ class Scancode(enum.IntEnum):
20942094
SLEEP = 282
20952095
APP1 = 283
20962096
APP2 = 284
2097+
AUDIOREWIND = 285
2098+
AUDIOFASTFORWARD = 286
20972099
# --- end ---
20982100

20992101
@property
@@ -2639,6 +2641,10 @@ class KeySym(enum.IntEnum):
26392641
KBDILLUMUP = 1073742104
26402642
EJECT = 1073742105
26412643
SLEEP = 1073742106
2644+
APP1 = 1073742107
2645+
APP2 = 1073742108
2646+
AUDIOREWIND = 1073742109
2647+
AUDIOFASTFORWARD = 1073742110
26422648
# --- end ---
26432649

26442650
@property

tcod/event_constants.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,8 @@
245245
SCANCODE_SLEEP = 282
246246
SCANCODE_APP1 = 283
247247
SCANCODE_APP2 = 284
248+
SCANCODE_AUDIOREWIND = 285
249+
SCANCODE_AUDIOFASTFORWARD = 286
248250

249251
# --- SDL keyboard symbols ---
250252
K_UNKNOWN = 0
@@ -484,6 +486,10 @@
484486
K_KBDILLUMUP = 1073742104
485487
K_EJECT = 1073742105
486488
K_SLEEP = 1073742106
489+
K_APP1 = 1073742107
490+
K_APP2 = 1073742108
491+
K_AUDIOREWIND = 1073742109
492+
K_AUDIOFASTFORWARD = 1073742110
487493

488494
# --- SDL keyboard modifiers ---
489495
KMOD_NONE = 0
@@ -502,7 +508,7 @@
502508
KMOD_NUM = 4096
503509
KMOD_CAPS = 8192
504510
KMOD_MODE = 16384
505-
KMOD_RESERVED = 32768
511+
KMOD_SCROLL = 32768
506512
_REVERSE_MOD_TABLE = {
507513
0: "KMOD_NONE",
508514
1: "KMOD_LSHIFT",
@@ -520,7 +526,7 @@
520526
4096: "KMOD_NUM",
521527
8192: "KMOD_CAPS",
522528
16384: "KMOD_MODE",
523-
32768: "KMOD_RESERVED",
529+
32768: "KMOD_SCROLL",
524530
}
525531

526532
# --- SDL wheel ---
@@ -775,6 +781,8 @@
775781
"SCANCODE_SLEEP",
776782
"SCANCODE_APP1",
777783
"SCANCODE_APP2",
784+
"SCANCODE_AUDIOREWIND",
785+
"SCANCODE_AUDIOFASTFORWARD",
778786
"K_UNKNOWN",
779787
"K_BACKSPACE",
780788
"K_TAB",
@@ -1012,6 +1020,10 @@
10121020
"K_KBDILLUMUP",
10131021
"K_EJECT",
10141022
"K_SLEEP",
1023+
"K_APP1",
1024+
"K_APP2",
1025+
"K_AUDIOREWIND",
1026+
"K_AUDIOFASTFORWARD",
10151027
"KMOD_NONE",
10161028
"KMOD_LSHIFT",
10171029
"KMOD_RSHIFT",
@@ -1028,7 +1040,7 @@
10281040
"KMOD_NUM",
10291041
"KMOD_CAPS",
10301042
"KMOD_MODE",
1031-
"KMOD_RESERVED",
1043+
"KMOD_SCROLL",
10321044
"MOUSEWHEEL_NORMAL",
10331045
"MOUSEWHEEL_FLIPPED",
10341046
"MOUSEWHEEL",

tcod/tileset.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ def procedural_block_elements(*, tileset: Tileset) -> None:
584584
0x007C,
585585
0x007D,
586586
0x007E,
587-
0x007F,
587+
0x2302,
588588
0x00C7,
589589
0x00FC,
590590
0x00E9,
@@ -719,6 +719,9 @@ def procedural_block_elements(*, tileset: Tileset) -> None:
719719
See :ref:`code-page-437` for more info and a table of glyphs.
720720
721721
.. versionadded:: 11.12
722+
723+
.. versionchanged:: Unreleased
724+
Character at index ``0x7F`` was changed from value ``0x7F`` to the HOUSE ``⌂`` glyph ``0x2302``.
722725
"""
723726

724727
CHARMAP_TCOD = [

0 commit comments

Comments
 (0)