tcod 18.1.0__tar.gz → 19.0.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {tcod-18.1.0 → tcod-19.0.2}/CHANGELOG.md +54 -0
- {tcod-18.1.0 → tcod-19.0.2}/LICENSE.txt +1 -1
- {tcod-18.1.0 → tcod-19.0.2}/PKG-INFO +8 -8
- {tcod-18.1.0 → tcod-19.0.2}/README.rst +2 -2
- {tcod-18.1.0 → tcod-19.0.2}/build_libtcod.py +258 -11
- tcod-19.0.2/build_sdl.py +416 -0
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/CHANGELOG.md +61 -1
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/CMakeLists.txt +11 -1
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/CONTRIBUTING.md +2 -2
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/LICENSE.txt +1 -1
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/README.md +3 -1
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/bresenham.h +5 -4
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/bresenham_c.c +1 -1
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/bsp.h +5 -4
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/bsp_c.c +4 -4
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/color.c +19 -13
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/color.h +5 -4
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/config.h +2 -1
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/console.c +6 -6
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/console.h +7 -1
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/console_drawing.c +1 -1
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/console_drawing.h +5 -1
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/console_etc.c +17 -17
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/console_etc.h +2 -1
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/console_init.c +6 -7
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/console_init.h +2 -1
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/console_printing.c +20 -20
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/console_printing.h +10 -2
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/console_rexpaint.c +19 -19
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/console_rexpaint.h +2 -1
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/console_types.h +2 -1
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/context.c +19 -13
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/context.h +6 -4
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/context_init.c +10 -11
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/context_init.h +2 -1
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/context_viewport.c +1 -1
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/context_viewport.h +2 -1
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/error.c +5 -5
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/error.h +2 -1
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/fov.h +5 -4
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/fov_c.c +7 -7
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/fov_circular_raycasting.c +5 -5
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/fov_diamond_raycasting.c +4 -4
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/fov_permissive2.c +78 -49
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/fov_recursive_shadowcasting.c +3 -3
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/fov_restrictive.c +9 -9
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/fov_symmetric_shadowcast.c +1 -1
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/fov_types.h +2 -1
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/globals.c +1 -1
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/globals.h +2 -1
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/heapq.c +1 -1
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/heapq.h +2 -1
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/heightmap.h +5 -4
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/heightmap_c.c +23 -23
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/image.h +5 -4
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/image_c.c +27 -28
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/lex.h +2 -1
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/lex_c.c +5 -5
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/libtcod.h +2 -1
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/libtcod_int.h +2 -1
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/list.h +5 -4
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/list_c.c +4 -4
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/logging.c +6 -9
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/logging.h +10 -9
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/mersenne.h +5 -4
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/mersenne_c.c +14 -14
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/mersenne_types.h +5 -4
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/mouse.h +5 -4
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/mouse_types.h +2 -1
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/namegen.h +5 -5
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/namegen_c.c +11 -9
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/noise.h +5 -4
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/noise_c.c +32 -32
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/noise_defaults.h +5 -4
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/parser.h +5 -4
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/parser_c.c +5 -5
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/path.h +18 -17
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/path_c.c +52 -67
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/pathfinder.c +2 -2
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/pathfinder.h +2 -1
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/pathfinder_frontier.c +2 -2
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/pathfinder_frontier.h +2 -1
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/portability.h +2 -1
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/random.c +1 -1
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/random.h +2 -1
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/renderer_sdl2.c +106 -122
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/renderer_sdl2.h +28 -11
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/renderer_xterm.c +60 -65
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/renderer_xterm.h +3 -8
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/sdl2/event.h +2 -1
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/sys.h +9 -8
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/sys_c.c +12 -8
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/sys_sdl_c.c +110 -137
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/sys_sdl_img_bmp.c +3 -3
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/sys_sdl_img_png.c +9 -16
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/tileset.c +3 -3
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/tileset.h +2 -1
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/tileset_bdf.c +1 -1
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/tileset_bdf.h +2 -1
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/tileset_fallback.c +1 -1
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/tileset_fallback.h +2 -1
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/tileset_render.c +7 -5
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/tileset_render.h +2 -1
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/tileset_truetype.c +2 -2
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/tileset_truetype.h +2 -1
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/timer.h +2 -1
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/tree.h +5 -4
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/tree_c.c +1 -1
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/txtfield.h +5 -4
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/txtfield_c.c +12 -12
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/utility.h +7 -6
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/version.h +7 -6
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/wrappers.c +1 -1
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/wrappers.h +2 -1
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/zip.h +5 -4
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/zip_c.c +3 -3
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod.h +2 -1
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod_c.c +1 -1
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/vendor/stb.c +0 -2
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/vendor/utf8proc/utf8proc_data.c +0 -1
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/vendor/zlib/deflate.c +6 -6
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/vendor/zlib/trees.h +0 -1
- {tcod-18.1.0 → tcod-19.0.2}/pyproject.toml +22 -18
- {tcod-18.1.0 → tcod-19.0.2}/requirements.txt +1 -1
- tcod-19.0.2/setup.py +50 -0
- {tcod-18.1.0 → tcod-19.0.2}/tcod/_internal.py +3 -2
- tcod-19.0.2/tcod/_libtcod.pyi +9729 -0
- {tcod-18.1.0 → tcod-19.0.2}/tcod/bsp.py +2 -1
- {tcod-18.1.0 → tcod-19.0.2}/tcod/cffi.py +12 -16
- {tcod-18.1.0 → tcod-19.0.2}/tcod/color.py +3 -3
- {tcod-18.1.0 → tcod-19.0.2}/tcod/console.py +23 -4
- {tcod-18.1.0 → tcod-19.0.2}/tcod/context.py +14 -17
- {tcod-18.1.0 → tcod-19.0.2}/tcod/event.py +185 -157
- {tcod-18.1.0 → tcod-19.0.2}/tcod/event_constants.py +112 -90
- {tcod-18.1.0 → tcod-19.0.2}/tcod/libtcodpy.py +4 -3
- {tcod-18.1.0 → tcod-19.0.2}/tcod/map.py +3 -4
- {tcod-18.1.0 → tcod-19.0.2}/tcod/noise.py +11 -6
- {tcod-18.1.0 → tcod-19.0.2}/tcod/path.c +2 -2
- {tcod-18.1.0 → tcod-19.0.2}/tcod/path.h +9 -9
- {tcod-18.1.0 → tcod-19.0.2}/tcod/path.py +26 -16
- {tcod-18.1.0 → tcod-19.0.2}/tcod/random.py +2 -1
- tcod-19.0.2/tcod/sdl/_internal.py +219 -0
- tcod-19.0.2/tcod/sdl/audio.py +1069 -0
- tcod-19.0.2/tcod/sdl/constants.py +489 -0
- {tcod-18.1.0 → tcod-19.0.2}/tcod/sdl/joystick.py +86 -107
- {tcod-18.1.0 → tcod-19.0.2}/tcod/sdl/mouse.py +20 -7
- {tcod-18.1.0 → tcod-19.0.2}/tcod/sdl/render.py +105 -115
- {tcod-18.1.0 → tcod-19.0.2}/tcod/sdl/sys.py +5 -3
- {tcod-18.1.0 → tcod-19.0.2}/tcod/sdl/video.py +82 -44
- {tcod-18.1.0 → tcod-19.0.2}/tcod/tcod.c +1 -1
- {tcod-18.1.0 → tcod-19.0.2}/tcod/tileset.py +10 -10
- {tcod-18.1.0 → tcod-19.0.2}/tcod/version.py +2 -2
- {tcod-18.1.0 → tcod-19.0.2}/tcod.egg-info/PKG-INFO +8 -8
- {tcod-18.1.0 → tcod-19.0.2}/tcod.egg-info/SOURCES.txt +2 -0
- tcod-18.1.0/build_sdl.py +0 -320
- tcod-18.1.0/setup.py +0 -72
- tcod-18.1.0/tcod/sdl/_internal.py +0 -126
- tcod-18.1.0/tcod/sdl/audio.py +0 -693
- {tcod-18.1.0 → tcod-19.0.2}/CONTRIBUTING.md +0 -0
- {tcod-18.1.0 → tcod-19.0.2}/MANIFEST.in +0 -0
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/LIBTCOD-CREDITS.txt +0 -0
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/sdl2/console_grid.glslf +0 -0
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/libtcod/sdl2/console_grid.glslv +0 -0
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/vendor/khrplatform.h +0 -0
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/vendor/lodepng.c +0 -0
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/vendor/lodepng.h +0 -0
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/vendor/stb_ds.h +0 -0
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/vendor/stb_truetype.h +0 -0
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/vendor/utf8proc/utf8proc.c +0 -0
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/vendor/utf8proc/utf8proc.h +0 -0
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/vendor/zlib/adler32.c +0 -0
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/vendor/zlib/compress.c +0 -0
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/vendor/zlib/crc32.c +0 -0
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/vendor/zlib/crc32.h +0 -0
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/vendor/zlib/deflate.h +0 -0
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/vendor/zlib/gzclose.c +0 -0
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/vendor/zlib/gzguts.h +0 -0
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/vendor/zlib/gzlib.c +0 -0
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/vendor/zlib/gzread.c +0 -0
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/vendor/zlib/gzwrite.c +0 -0
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/vendor/zlib/infback.c +0 -0
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/vendor/zlib/inffast.c +0 -0
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/vendor/zlib/inffast.h +0 -0
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/vendor/zlib/inffixed.h +0 -0
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/vendor/zlib/inflate.c +0 -0
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/vendor/zlib/inflate.h +0 -0
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/vendor/zlib/inftrees.c +0 -0
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/vendor/zlib/inftrees.h +0 -0
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/vendor/zlib/trees.c +0 -0
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/vendor/zlib/uncompr.c +0 -0
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/vendor/zlib/zconf.h +0 -0
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/vendor/zlib/zlib.h +0 -0
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/vendor/zlib/zutil.c +0 -0
- {tcod-18.1.0 → tcod-19.0.2}/libtcod/src/vendor/zlib/zutil.h +0 -0
- {tcod-18.1.0 → tcod-19.0.2}/libtcodpy.py +0 -0
- {tcod-18.1.0 → tcod-19.0.2}/setup.cfg +0 -0
- {tcod-18.1.0 → tcod-19.0.2}/tcod/__init__.py +0 -0
- {tcod-18.1.0 → tcod-19.0.2}/tcod/__pyinstaller/__init__.py +0 -0
- {tcod-18.1.0 → tcod-19.0.2}/tcod/__pyinstaller/hook-tcod.py +0 -0
- {tcod-18.1.0 → tcod-19.0.2}/tcod/cdef.h +0 -0
- {tcod-18.1.0 → tcod-19.0.2}/tcod/cffi.h +0 -0
- {tcod-18.1.0 → tcod-19.0.2}/tcod/constants.py +0 -0
- {tcod-18.1.0 → tcod-19.0.2}/tcod/image.py +0 -0
- {tcod-18.1.0 → tcod-19.0.2}/tcod/los.py +0 -0
- {tcod-18.1.0 → tcod-19.0.2}/tcod/noise.c +0 -0
- {tcod-18.1.0 → tcod-19.0.2}/tcod/noise.h +0 -0
- {tcod-18.1.0 → tcod-19.0.2}/tcod/py.typed +0 -0
- {tcod-18.1.0 → tcod-19.0.2}/tcod/random.h +0 -0
- {tcod-18.1.0 → tcod-19.0.2}/tcod/render.py +0 -0
- {tcod-18.1.0 → tcod-19.0.2}/tcod/sdl/__init__.py +0 -0
- {tcod-18.1.0 → tcod-19.0.2}/tcod/tcod.h +0 -0
- {tcod-18.1.0 → tcod-19.0.2}/tcod/tcod.py +0 -0
- {tcod-18.1.0 → tcod-19.0.2}/tcod/tdl.c +0 -0
- {tcod-18.1.0 → tcod-19.0.2}/tcod/tdl.h +0 -0
- {tcod-18.1.0 → tcod-19.0.2}/tcod.egg-info/dependency_links.txt +0 -0
- {tcod-18.1.0 → tcod-19.0.2}/tcod.egg-info/entry_points.txt +0 -0
- {tcod-18.1.0 → tcod-19.0.2}/tcod.egg-info/requires.txt +0 -0
- {tcod-18.1.0 → tcod-19.0.2}/tcod.egg-info/top_level.txt +0 -0
- {tcod-18.1.0 → tcod-19.0.2}/tox.ini +0 -0
|
@@ -6,6 +6,60 @@ This project adheres to [Semantic Versioning](https://semver.org/) since version
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [19.0.2] - 2025-07-11
|
|
10
|
+
|
|
11
|
+
## [19.0.1] - 2025-07-11
|
|
12
|
+
|
|
13
|
+
### Fixed
|
|
14
|
+
|
|
15
|
+
- `Console.print` methods using `string` keyword were marked as invalid instead of deprecated.
|
|
16
|
+
|
|
17
|
+
## [19.0.0] - 2025-06-13
|
|
18
|
+
|
|
19
|
+
Finished port to SDL3, this has caused several breaking changes from SDL such as lowercase key constants now being uppercase and mouse events returning `float` instead of `int`.
|
|
20
|
+
Be sure to run [Mypy](https://mypy.readthedocs.io/en/stable/getting_started.html) on your projects to catch any issues from this update.
|
|
21
|
+
|
|
22
|
+
### Changed
|
|
23
|
+
|
|
24
|
+
- Updated libtcod to 2.1.1
|
|
25
|
+
- Updated SDL to 3.2.16
|
|
26
|
+
This will cause several breaking changes such as the names of keyboard constants and other SDL enums.
|
|
27
|
+
- `tcod.sdl.video.Window.grab` has been split into `.mouse_grab` and `.keyboard_grab` attributes.
|
|
28
|
+
- `tcod.event.KeySym` single letter symbols are now all uppercase.
|
|
29
|
+
- Relative mouse mode is set via `tcod.sdl.video.Window.relative_mouse_mode` instead of `tcod.sdl.mouse.set_relative_mode`.
|
|
30
|
+
- `tcod.sdl.render.new_renderer`: Removed `software` and `target_textures` parameters, `vsync` takes `int`, `driver` takes `str` instead of `int`.
|
|
31
|
+
- `tcod.sdl.render.Renderer`: `integer_scaling` and `logical_size` are now set with `set_logical_presentation` method.
|
|
32
|
+
- `tcod.sdl.render.Renderer.geometry` now takes float values for `color` instead of 8-bit integers.
|
|
33
|
+
- `tcod.event.Point` and other mouse/tile coordinate types now use `float` instead of `int`.
|
|
34
|
+
SDL3 has decided that mouse events have subpixel precision.
|
|
35
|
+
If you see any usual `float` types in your code then this is why.
|
|
36
|
+
- `tcod.sdl.audio` has been affected by major changes to SDL3.
|
|
37
|
+
- `tcod.sdl.audio.open` has new behavior due to SDL3 and should be avoided.
|
|
38
|
+
- Callbacks which were assigned to `AudioDevice`'s must now be applied to `AudioStream`'s instead.
|
|
39
|
+
- `AudioDevice`'s are now opened using references to existing devices.
|
|
40
|
+
- Sound queueing methods were moved from `AudioDevice` to a new `AudioStream` class.
|
|
41
|
+
- `BasicMixer` may require manually specifying `frequency` and `channels` to replicate old behavior.
|
|
42
|
+
- `get_devices` and `get_capture_devices` now return `dict[str, AudioDevice]`.
|
|
43
|
+
- `TextInput` events are no longer enabled by default.
|
|
44
|
+
|
|
45
|
+
### Deprecated
|
|
46
|
+
|
|
47
|
+
- `tcod.sdl.audio.open` was replaced with a newer API, get a default device with `tcod.sdl.audio.get_default_playback().open()`.
|
|
48
|
+
- `tcod.sdl.audio.BasicMixer` should be replaced with `AudioStream`'s.
|
|
49
|
+
- Should no longer use `tcod.sdl.audio.AudioDevice` in a context, use `contextlib.closing` for the old behavior.
|
|
50
|
+
|
|
51
|
+
### Removed
|
|
52
|
+
|
|
53
|
+
- Support dropped for Python 3.8 and 3.9.
|
|
54
|
+
- Removed `Joystick.get_current_power` due to SDL3 changes.
|
|
55
|
+
- `WindowFlags.FULLSCREEN_DESKTOP` is now just `WindowFlags.FULLSCREEN`
|
|
56
|
+
- `tcod.sdl.render.Renderer.integer_scaling` removed.
|
|
57
|
+
- Removed `callback`, `spec`, `queued_samples`, `queue_audio`, and `dequeue_audio` attributes from `tcod.sdl.audio.AudioDevice`.
|
|
58
|
+
|
|
59
|
+
### Fixed
|
|
60
|
+
|
|
61
|
+
- `Joystick.get_ball` was broken.
|
|
62
|
+
|
|
9
63
|
## [18.1.0] - 2025-05-05
|
|
10
64
|
|
|
11
65
|
### Added
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tcod
|
|
3
|
-
Version:
|
|
3
|
+
Version: 19.0.2
|
|
4
4
|
Summary: The official Python port of libtcod.
|
|
5
5
|
Author-email: Kyle Benesch <4b796c65+tcod@gmail.com>
|
|
6
|
-
License:
|
|
6
|
+
License-Expression: BSD-2-Clause
|
|
7
7
|
Project-URL: Homepage, https://github.com/libtcod/python-tcod
|
|
8
8
|
Project-URL: Documentation, https://python-tcod.readthedocs.io
|
|
9
9
|
Project-URL: Changelog, https://github.com/libtcod/python-tcod/blob/main/CHANGELOG.md
|
|
@@ -19,26 +19,26 @@ Classifier: Environment :: Win32 (MS Windows)
|
|
|
19
19
|
Classifier: Environment :: MacOS X
|
|
20
20
|
Classifier: Environment :: X11 Applications
|
|
21
21
|
Classifier: Intended Audience :: Developers
|
|
22
|
-
Classifier: License :: OSI Approved :: BSD License
|
|
23
22
|
Classifier: Natural Language :: English
|
|
24
23
|
Classifier: Operating System :: POSIX
|
|
25
24
|
Classifier: Operating System :: MacOS :: MacOS X
|
|
26
25
|
Classifier: Operating System :: Microsoft :: Windows
|
|
27
26
|
Classifier: Programming Language :: Python :: 3
|
|
28
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
29
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
30
27
|
Classifier: Programming Language :: Python :: 3.10
|
|
31
28
|
Classifier: Programming Language :: Python :: 3.11
|
|
32
29
|
Classifier: Programming Language :: Python :: 3.12
|
|
30
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
33
31
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
34
32
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
35
33
|
Classifier: Topic :: Games/Entertainment
|
|
36
34
|
Classifier: Topic :: Multimedia :: Graphics
|
|
37
35
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
38
36
|
Classifier: Typing :: Typed
|
|
39
|
-
Requires-Python: >=3.
|
|
37
|
+
Requires-Python: >=3.10
|
|
40
38
|
Description-Content-Type: text/x-rst
|
|
41
39
|
License-File: LICENSE.txt
|
|
40
|
+
License-File: libtcod/LICENSE.txt
|
|
41
|
+
License-File: libtcod/LIBTCOD-CREDITS.txt
|
|
42
42
|
Requires-Dist: cffi>=1.15
|
|
43
43
|
Requires-Dist: numpy>=1.21.4; implementation_name != "pypy"
|
|
44
44
|
Requires-Dist: typing_extensions>=4.12.2
|
|
@@ -93,9 +93,9 @@ For the most part it's just::
|
|
|
93
93
|
==============
|
|
94
94
|
Requirements
|
|
95
95
|
==============
|
|
96
|
-
* Python 3.
|
|
96
|
+
* Python 3.10+
|
|
97
97
|
* Windows, Linux, or MacOS X 10.9+.
|
|
98
|
-
* On Linux, requires
|
|
98
|
+
* On Linux, requires libsdl3
|
|
99
99
|
|
|
100
100
|
===========
|
|
101
101
|
Changelog
|
|
@@ -46,9 +46,9 @@ For the most part it's just::
|
|
|
46
46
|
==============
|
|
47
47
|
Requirements
|
|
48
48
|
==============
|
|
49
|
-
* Python 3.
|
|
49
|
+
* Python 3.10+
|
|
50
50
|
* Windows, Linux, or MacOS X 10.9+.
|
|
51
|
-
* On Linux, requires
|
|
51
|
+
* On Linux, requires libsdl3
|
|
52
52
|
|
|
53
53
|
===========
|
|
54
54
|
Changelog
|
|
@@ -3,15 +3,22 @@
|
|
|
3
3
|
|
|
4
4
|
from __future__ import annotations
|
|
5
5
|
|
|
6
|
+
import ast
|
|
6
7
|
import contextlib
|
|
7
8
|
import glob
|
|
8
9
|
import os
|
|
9
10
|
import platform
|
|
10
11
|
import re
|
|
12
|
+
import subprocess
|
|
11
13
|
import sys
|
|
14
|
+
from collections.abc import Iterable, Iterator
|
|
12
15
|
from pathlib import Path
|
|
13
|
-
from typing import Any, ClassVar
|
|
16
|
+
from typing import Any, ClassVar
|
|
14
17
|
|
|
18
|
+
import attrs
|
|
19
|
+
import pycparser # type: ignore[import-untyped]
|
|
20
|
+
import pycparser.c_ast # type: ignore[import-untyped]
|
|
21
|
+
import pycparser.c_generator # type: ignore[import-untyped]
|
|
15
22
|
from cffi import FFI
|
|
16
23
|
|
|
17
24
|
# ruff: noqa: T201
|
|
@@ -20,7 +27,7 @@ sys.path.append(str(Path(__file__).parent)) # Allow importing local modules.
|
|
|
20
27
|
|
|
21
28
|
import build_sdl
|
|
22
29
|
|
|
23
|
-
Py_LIMITED_API =
|
|
30
|
+
Py_LIMITED_API = 0x03100000
|
|
24
31
|
|
|
25
32
|
HEADER_PARSE_PATHS = ("tcod/", "libtcod/src/libtcod/")
|
|
26
33
|
HEADER_PARSE_EXCLUDES = ("gl2_ext_.h", "renderer_gl_internal.h", "event.h")
|
|
@@ -155,7 +162,12 @@ sources: list[str] = []
|
|
|
155
162
|
|
|
156
163
|
libraries: list[str] = [*build_sdl.libraries]
|
|
157
164
|
library_dirs: list[str] = [*build_sdl.library_dirs]
|
|
158
|
-
define_macros: list[tuple[str, Any]] = [
|
|
165
|
+
define_macros: list[tuple[str, Any]] = []
|
|
166
|
+
|
|
167
|
+
if "PYODIDE" not in os.environ:
|
|
168
|
+
# Unable to apply Py_LIMITED_API to Pyodide in cffi<=1.17.1
|
|
169
|
+
# https://github.com/python-cffi/cffi/issues/179
|
|
170
|
+
define_macros.append(("Py_LIMITED_API", Py_LIMITED_API))
|
|
159
171
|
|
|
160
172
|
sources += walk_sources("tcod/")
|
|
161
173
|
sources += walk_sources("libtcod/src/libtcod/")
|
|
@@ -173,8 +185,8 @@ if sys.platform in ["win32", "darwin"]:
|
|
|
173
185
|
include_dirs.append("libtcod/src/zlib/")
|
|
174
186
|
|
|
175
187
|
|
|
176
|
-
if sys.platform
|
|
177
|
-
# Fix
|
|
188
|
+
if sys.platform != "win32":
|
|
189
|
+
# Fix implicit declaration of multiple functions in zlib.
|
|
178
190
|
define_macros.append(("HAVE_UNISTD_H", 1))
|
|
179
191
|
|
|
180
192
|
|
|
@@ -203,15 +215,16 @@ else:
|
|
|
203
215
|
extra_link_args.extend(GCC_CFLAGS[tdl_build])
|
|
204
216
|
|
|
205
217
|
ffi = FFI()
|
|
206
|
-
|
|
218
|
+
sdl_cdef, sdl_strings = build_sdl.get_cdef()
|
|
219
|
+
ffi.cdef(sdl_cdef)
|
|
207
220
|
for include in includes:
|
|
208
221
|
try:
|
|
209
222
|
ffi.cdef(include.header)
|
|
210
|
-
except Exception:
|
|
223
|
+
except Exception: # noqa: PERF203
|
|
211
224
|
# Print the source, for debugging.
|
|
212
225
|
print(f"Error with: {include.path}")
|
|
213
226
|
for i, line in enumerate(include.header.split("\n"), 1):
|
|
214
|
-
print("
|
|
227
|
+
print(f"{i:03i} {line}")
|
|
215
228
|
raise
|
|
216
229
|
ffi.cdef(
|
|
217
230
|
"""
|
|
@@ -220,7 +233,10 @@ ffi.cdef(
|
|
|
220
233
|
)
|
|
221
234
|
ffi.set_source(
|
|
222
235
|
module_name,
|
|
223
|
-
"
|
|
236
|
+
"""\
|
|
237
|
+
#include <tcod/cffi.h>
|
|
238
|
+
#define SDL_oldnames_h_
|
|
239
|
+
#include <SDL3/SDL.h>""",
|
|
224
240
|
include_dirs=include_dirs,
|
|
225
241
|
library_dirs=library_dirs,
|
|
226
242
|
sources=sources,
|
|
@@ -379,10 +395,10 @@ def write_library_constants() -> None:
|
|
|
379
395
|
f.write(f"""{parse_sdl_attrs("SDL_SCANCODE", None)[0]}\n""")
|
|
380
396
|
|
|
381
397
|
f.write("\n# --- SDL keyboard symbols ---\n")
|
|
382
|
-
f.write(f"""{parse_sdl_attrs("
|
|
398
|
+
f.write(f"""{parse_sdl_attrs("SDLK_", None)[0]}\n""")
|
|
383
399
|
|
|
384
400
|
f.write("\n# --- SDL keyboard modifiers ---\n")
|
|
385
|
-
f.write("{}\n_REVERSE_MOD_TABLE = {}\n".format(*parse_sdl_attrs("
|
|
401
|
+
f.write("{}\n_REVERSE_MOD_TABLE = {}\n".format(*parse_sdl_attrs("SDL_KMOD", None)))
|
|
386
402
|
|
|
387
403
|
f.write("\n# --- SDL wheel ---\n")
|
|
388
404
|
f.write("{}\n_REVERSE_WHEEL_TABLE = {}\n".format(*parse_sdl_attrs("SDL_MOUSEWHEEL", all_names)))
|
|
@@ -406,6 +422,237 @@ def write_library_constants() -> None:
|
|
|
406
422
|
|
|
407
423
|
Path("tcod/event.py").write_text(event_py, encoding="utf-8")
|
|
408
424
|
|
|
425
|
+
with Path("tcod/sdl/constants.py").open("w", encoding="utf-8") as f:
|
|
426
|
+
f.write('"""SDL private constants."""\n\n')
|
|
427
|
+
for name, value in sdl_strings.items():
|
|
428
|
+
f.write(f"{name} = {ast.literal_eval(value)!r}\n")
|
|
429
|
+
|
|
430
|
+
subprocess.run(["ruff", "format", "--silent", Path("tcod/sdl/constants.py")], check=True) # noqa: S603, S607
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+
def _fix_reserved_name(name: str) -> str:
|
|
434
|
+
"""Add underscores to reserved Python keywords."""
|
|
435
|
+
assert isinstance(name, str)
|
|
436
|
+
if name in ("def", "in"):
|
|
437
|
+
return name + "_"
|
|
438
|
+
return name
|
|
439
|
+
|
|
440
|
+
|
|
441
|
+
@attrs.define(frozen=True)
|
|
442
|
+
class ConvertedParam:
|
|
443
|
+
name: str = attrs.field(converter=_fix_reserved_name)
|
|
444
|
+
hint: str
|
|
445
|
+
original: str
|
|
446
|
+
|
|
447
|
+
|
|
448
|
+
def _type_from_names(names: list[str]) -> str:
|
|
449
|
+
if not names:
|
|
450
|
+
return ""
|
|
451
|
+
if names[-1] == "void":
|
|
452
|
+
return "None"
|
|
453
|
+
if names in (["unsigned", "char"], ["bool"]):
|
|
454
|
+
return "bool"
|
|
455
|
+
if names[-1] in ("size_t", "int", "ptrdiff_t"):
|
|
456
|
+
return "int"
|
|
457
|
+
if names[-1] in ("float", "double"):
|
|
458
|
+
return "float"
|
|
459
|
+
return "Any"
|
|
460
|
+
|
|
461
|
+
|
|
462
|
+
def _param_as_hint(node: pycparser.c_ast.Node, default_name: str) -> ConvertedParam:
|
|
463
|
+
original = pycparser.c_generator.CGenerator().visit(node)
|
|
464
|
+
name: str
|
|
465
|
+
names: list[str]
|
|
466
|
+
match node:
|
|
467
|
+
case pycparser.c_ast.Typename(type=pycparser.c_ast.TypeDecl(type=pycparser.c_ast.IdentifierType(names=names))):
|
|
468
|
+
# Unnamed type
|
|
469
|
+
return ConvertedParam(default_name, _type_from_names(names), original)
|
|
470
|
+
case pycparser.c_ast.Decl(
|
|
471
|
+
name=name, type=pycparser.c_ast.TypeDecl(type=pycparser.c_ast.IdentifierType(names=names))
|
|
472
|
+
):
|
|
473
|
+
# Named type
|
|
474
|
+
return ConvertedParam(name, _type_from_names(names), original)
|
|
475
|
+
case pycparser.c_ast.Decl(
|
|
476
|
+
name=name,
|
|
477
|
+
type=pycparser.c_ast.ArrayDecl(
|
|
478
|
+
type=pycparser.c_ast.TypeDecl(type=pycparser.c_ast.IdentifierType(names=names))
|
|
479
|
+
),
|
|
480
|
+
):
|
|
481
|
+
# Named array
|
|
482
|
+
return ConvertedParam(name, "Any", original)
|
|
483
|
+
case pycparser.c_ast.Decl(name=name, type=pycparser.c_ast.PtrDecl()):
|
|
484
|
+
# Named pointer
|
|
485
|
+
return ConvertedParam(name, "Any", original)
|
|
486
|
+
case pycparser.c_ast.Typename(name=name, type=pycparser.c_ast.PtrDecl()):
|
|
487
|
+
# Forwarded struct
|
|
488
|
+
return ConvertedParam(name or default_name, "Any", original)
|
|
489
|
+
case pycparser.c_ast.TypeDecl(type=pycparser.c_ast.IdentifierType(names=names)):
|
|
490
|
+
# Return type
|
|
491
|
+
return ConvertedParam(default_name, _type_from_names(names), original)
|
|
492
|
+
case pycparser.c_ast.PtrDecl():
|
|
493
|
+
# Return pointer
|
|
494
|
+
return ConvertedParam(default_name, "Any", original)
|
|
495
|
+
case pycparser.c_ast.EllipsisParam():
|
|
496
|
+
# C variable args
|
|
497
|
+
return ConvertedParam("*__args", "Any", original)
|
|
498
|
+
case _:
|
|
499
|
+
raise AssertionError
|
|
500
|
+
|
|
501
|
+
|
|
502
|
+
class DefinitionCollector(pycparser.c_ast.NodeVisitor): # type: ignore[misc]
|
|
503
|
+
"""Gathers functions and names from C headers."""
|
|
504
|
+
|
|
505
|
+
def __init__(self) -> None:
|
|
506
|
+
"""Initialize the object with empty values."""
|
|
507
|
+
self.functions: list[str] = []
|
|
508
|
+
"""Indented Python function definitions."""
|
|
509
|
+
self.variables: set[str] = set()
|
|
510
|
+
"""Python variable definitions."""
|
|
511
|
+
|
|
512
|
+
def parse_defines(self, string: str, /) -> None:
|
|
513
|
+
"""Parse C define directives into hinted names."""
|
|
514
|
+
for match in re.finditer(r"#define\s+(\S+)\s+(\S+)\s*", string):
|
|
515
|
+
name, value = match.groups()
|
|
516
|
+
if value == "...":
|
|
517
|
+
self.variables.add(f"{name}: Final[int]")
|
|
518
|
+
else:
|
|
519
|
+
self.variables.add(f"{name}: Final[Literal[{value}]] = {value}")
|
|
520
|
+
|
|
521
|
+
def visit_Decl(self, node: pycparser.c_ast.Decl) -> None: # noqa: N802
|
|
522
|
+
"""Parse C FFI functions into type hinted Python functions."""
|
|
523
|
+
match node:
|
|
524
|
+
case pycparser.c_ast.Decl(
|
|
525
|
+
type=pycparser.c_ast.FuncDecl(),
|
|
526
|
+
):
|
|
527
|
+
assert isinstance(node.type.args, pycparser.c_ast.ParamList), type(node.type.args)
|
|
528
|
+
arg_hints = [_param_as_hint(param, f"arg{i}") for i, param in enumerate(node.type.args.params)]
|
|
529
|
+
return_hint = _param_as_hint(node.type.type, "")
|
|
530
|
+
if len(arg_hints) == 1 and arg_hints[0].hint == "None": # Remove void parameter
|
|
531
|
+
arg_hints = []
|
|
532
|
+
|
|
533
|
+
python_params = [f"{p.name}: {p.hint}" for p in arg_hints]
|
|
534
|
+
if python_params:
|
|
535
|
+
if arg_hints[-1].name.startswith("*"):
|
|
536
|
+
python_params.insert(-1, "/")
|
|
537
|
+
else:
|
|
538
|
+
python_params.append("/")
|
|
539
|
+
c_def = pycparser.c_generator.CGenerator().visit(node)
|
|
540
|
+
python_def = f"""def {node.name}({", ".join(python_params)}) -> {return_hint.hint}:"""
|
|
541
|
+
self.functions.append(f''' {python_def}\n """{c_def}"""''')
|
|
542
|
+
|
|
543
|
+
def visit_Enumerator(self, node: pycparser.c_ast.Enumerator) -> None: # noqa: N802
|
|
544
|
+
"""Parse C enums into hinted names."""
|
|
545
|
+
name: str | None
|
|
546
|
+
value: str | int
|
|
547
|
+
match node:
|
|
548
|
+
case pycparser.c_ast.Enumerator(name=name, value=None):
|
|
549
|
+
self.variables.add(f"{name}: Final[int]")
|
|
550
|
+
case pycparser.c_ast.Enumerator(name=name, value=pycparser.c_ast.ID()):
|
|
551
|
+
self.variables.add(f"{name}: Final[int]")
|
|
552
|
+
case pycparser.c_ast.Enumerator(name=name, value=pycparser.c_ast.Constant(value=value)):
|
|
553
|
+
value = int(str(value).removesuffix("u"), base=0)
|
|
554
|
+
self.variables.add(f"{name}: Final[Literal[{value}]] = {value}")
|
|
555
|
+
case pycparser.c_ast.Enumerator(
|
|
556
|
+
name=name, value=pycparser.c_ast.UnaryOp(op="-", expr=pycparser.c_ast.Constant(value=value))
|
|
557
|
+
):
|
|
558
|
+
value = -int(str(value).removesuffix("u"), base=0)
|
|
559
|
+
self.variables.add(f"{name}: Final[Literal[{value}]] = {value}")
|
|
560
|
+
case pycparser.c_ast.Enumerator(name=name):
|
|
561
|
+
self.variables.add(f"{name}: Final[int]")
|
|
562
|
+
case _:
|
|
563
|
+
raise AssertionError
|
|
564
|
+
|
|
565
|
+
|
|
566
|
+
def write_hints() -> None:
|
|
567
|
+
"""Write a custom _libtcod.pyi file from C definitions."""
|
|
568
|
+
function_collector = DefinitionCollector()
|
|
569
|
+
c = pycparser.CParser()
|
|
570
|
+
|
|
571
|
+
# Parse SDL headers
|
|
572
|
+
cdef = sdl_cdef
|
|
573
|
+
cdef = cdef.replace("int...", "int")
|
|
574
|
+
cdef = (
|
|
575
|
+
"""
|
|
576
|
+
typedef int bool;
|
|
577
|
+
typedef int int8_t;
|
|
578
|
+
typedef int uint8_t;
|
|
579
|
+
typedef int int16_t;
|
|
580
|
+
typedef int uint16_t;
|
|
581
|
+
typedef int int32_t;
|
|
582
|
+
typedef int uint32_t;
|
|
583
|
+
typedef int int64_t;
|
|
584
|
+
typedef int uint64_t;
|
|
585
|
+
typedef int wchar_t;
|
|
586
|
+
typedef int intptr_t;
|
|
587
|
+
"""
|
|
588
|
+
+ cdef
|
|
589
|
+
)
|
|
590
|
+
for match in re.finditer(r"SDL_PIXELFORMAT_\w+", cdef):
|
|
591
|
+
function_collector.variables.add(f"{match.group()}: int")
|
|
592
|
+
cdef = re.sub(r"(typedef enum SDL_PixelFormat).*(SDL_PixelFormat;)", r"\1 \2", cdef, flags=re.DOTALL)
|
|
593
|
+
cdef = cdef.replace("padding[...]", "padding[]")
|
|
594
|
+
cdef = cdef.replace("...;} SDL_TouchFingerEvent;", "} SDL_TouchFingerEvent;")
|
|
595
|
+
function_collector.parse_defines(cdef)
|
|
596
|
+
cdef = re.sub(r"\n#define .*", "", cdef)
|
|
597
|
+
cdef = re.sub(r"""extern "Python" \{(.*?)\}""", r"\1", cdef, flags=re.DOTALL)
|
|
598
|
+
cdef = re.sub(r"//.*", "", cdef)
|
|
599
|
+
cdef = cdef.replace("...;", ";")
|
|
600
|
+
ast = c.parse(cdef)
|
|
601
|
+
function_collector.visit(ast)
|
|
602
|
+
|
|
603
|
+
# Parse libtcod headers
|
|
604
|
+
cdef = "\n".join(include.header for include in includes)
|
|
605
|
+
function_collector.parse_defines(cdef)
|
|
606
|
+
cdef = re.sub(r"\n?#define .*", "", cdef)
|
|
607
|
+
cdef = re.sub(r"//.*", "", cdef)
|
|
608
|
+
cdef = (
|
|
609
|
+
"""
|
|
610
|
+
typedef int int8_t;
|
|
611
|
+
typedef int uint8_t;
|
|
612
|
+
typedef int int16_t;
|
|
613
|
+
typedef int uint16_t;
|
|
614
|
+
typedef int int32_t;
|
|
615
|
+
typedef int uint32_t;
|
|
616
|
+
typedef int int64_t;
|
|
617
|
+
typedef int uint64_t;
|
|
618
|
+
typedef int wchar_t;
|
|
619
|
+
typedef int intptr_t;
|
|
620
|
+
typedef int ptrdiff_t;
|
|
621
|
+
typedef int size_t;
|
|
622
|
+
typedef unsigned char bool;
|
|
623
|
+
typedef void* SDL_PropertiesID;
|
|
624
|
+
"""
|
|
625
|
+
+ cdef
|
|
626
|
+
)
|
|
627
|
+
cdef = re.sub(r"""extern "Python" \{(.*?)\}""", r"\1", cdef, flags=re.DOTALL)
|
|
628
|
+
function_collector.visit(c.parse(cdef))
|
|
629
|
+
function_collector.variables.add("TCOD_ctx: Any")
|
|
630
|
+
function_collector.variables.add("TCOD_COMPILEDVERSION: Final[int]")
|
|
631
|
+
|
|
632
|
+
# Write PYI file
|
|
633
|
+
out_functions = """\n\n @staticmethod\n""".join(sorted(function_collector.functions))
|
|
634
|
+
out_variables = "\n ".join(sorted(function_collector.variables))
|
|
635
|
+
|
|
636
|
+
pyi = f"""\
|
|
637
|
+
# Autogenerated with build_libtcod.py
|
|
638
|
+
from typing import Any, Final, Literal
|
|
639
|
+
|
|
640
|
+
# pyi files for CFFI ports are not standard
|
|
641
|
+
# ruff: noqa: A002, ANN401, D402, D403, D415, N801, N802, N803, N815, PLW0211, PYI021
|
|
642
|
+
|
|
643
|
+
class _lib:
|
|
644
|
+
@staticmethod
|
|
645
|
+
{out_functions}
|
|
646
|
+
|
|
647
|
+
{out_variables}
|
|
648
|
+
|
|
649
|
+
lib: _lib
|
|
650
|
+
ffi: Any
|
|
651
|
+
"""
|
|
652
|
+
Path("tcod/_libtcod.pyi").write_text(pyi)
|
|
653
|
+
subprocess.run(["ruff", "format", "--silent", Path("tcod/_libtcod.pyi")], check=True) # noqa: S603, S607
|
|
654
|
+
|
|
409
655
|
|
|
410
656
|
if __name__ == "__main__":
|
|
657
|
+
write_hints()
|
|
411
658
|
write_library_constants()
|