tcod 19.6.3__tar.gz → 20.1.0__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-19.6.3 → tcod-20.1.0}/CHANGELOG.md +27 -0
- {tcod-19.6.3 → tcod-20.1.0}/PKG-INFO +4 -6
- {tcod-19.6.3 → tcod-20.1.0}/build_libtcod.py +24 -12
- {tcod-19.6.3 → tcod-20.1.0}/build_sdl.py +23 -10
- {tcod-19.6.3 → tcod-20.1.0}/pyproject.toml +10 -17
- {tcod-19.6.3 → tcod-20.1.0}/setup.py +14 -6
- {tcod-19.6.3 → tcod-20.1.0}/tcod/_internal.py +1 -11
- {tcod-19.6.3 → tcod-20.1.0}/tcod/cffi.py +5 -3
- {tcod-19.6.3 → tcod-20.1.0}/tcod/color.py +2 -0
- {tcod-19.6.3 → tcod-20.1.0}/tcod/console.py +1 -1
- {tcod-19.6.3 → tcod-20.1.0}/tcod/context.py +5 -3
- {tcod-19.6.3 → tcod-20.1.0}/tcod/event.py +87 -4
- {tcod-19.6.3 → tcod-20.1.0}/tcod/image.py +1 -1
- {tcod-19.6.3 → tcod-20.1.0}/tcod/libtcodpy.py +140 -136
- {tcod-19.6.3 → tcod-20.1.0}/tcod/map.py +15 -14
- {tcod-19.6.3 → tcod-20.1.0}/tcod/noise.py +4 -3
- {tcod-19.6.3 → tcod-20.1.0}/tcod/path.py +6 -5
- {tcod-19.6.3 → tcod-20.1.0}/tcod/sdl/_internal.py +2 -2
- {tcod-19.6.3 → tcod-20.1.0}/tcod/sdl/joystick.py +5 -5
- {tcod-19.6.3 → tcod-20.1.0}/tcod/sdl/mouse.py +7 -4
- {tcod-19.6.3 → tcod-20.1.0}/tcod/sdl/render.py +38 -10
- {tcod-19.6.3 → tcod-20.1.0}/tcod/sdl/sys.py +1 -1
- {tcod-19.6.3 → tcod-20.1.0}/tcod/sdl/video.py +2 -2
- {tcod-19.6.3 → tcod-20.1.0}/tcod/tileset.py +199 -40
- {tcod-19.6.3 → tcod-20.1.0}/tcod/version.py +3 -3
- {tcod-19.6.3 → tcod-20.1.0}/tcod.egg-info/PKG-INFO +4 -6
- {tcod-19.6.3 → tcod-20.1.0}/CONTRIBUTING.md +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/LICENSE.txt +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/MANIFEST.in +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/README.rst +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/CHANGELOG.md +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/CMakeLists.txt +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/CONTRIBUTING.md +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/LIBTCOD-CREDITS.txt +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/LICENSE.txt +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/README.md +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/bresenham.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/bresenham_c.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/bsp.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/bsp_c.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/color.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/color.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/config.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/console.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/console.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/console_drawing.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/console_drawing.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/console_etc.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/console_etc.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/console_init.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/console_init.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/console_printing.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/console_printing.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/console_rexpaint.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/console_rexpaint.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/console_types.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/context.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/context.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/context_init.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/context_init.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/context_viewport.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/context_viewport.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/error.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/error.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/fov.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/fov_c.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/fov_circular_raycasting.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/fov_diamond_raycasting.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/fov_permissive2.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/fov_recursive_shadowcasting.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/fov_restrictive.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/fov_symmetric_shadowcast.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/fov_types.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/globals.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/globals.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/heapq.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/heapq.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/heightmap.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/heightmap_c.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/image.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/image_c.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/lex.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/lex_c.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/libtcod.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/libtcod_int.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/list.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/list_c.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/logging.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/logging.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/mersenne.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/mersenne_c.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/mersenne_types.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/mouse.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/mouse_types.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/namegen.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/namegen_c.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/noise.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/noise_c.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/noise_defaults.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/parser.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/parser_c.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/path.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/path_c.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/pathfinder.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/pathfinder.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/pathfinder_frontier.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/pathfinder_frontier.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/portability.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/random.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/random.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/renderer_sdl2.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/renderer_sdl2.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/renderer_xterm.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/renderer_xterm.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/sdl2/console_grid.glslf +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/sdl2/console_grid.glslv +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/sdl2/event.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/sys.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/sys_c.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/sys_sdl_c.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/sys_sdl_img_bmp.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/sys_sdl_img_png.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/tileset.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/tileset.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/tileset_bdf.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/tileset_bdf.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/tileset_fallback.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/tileset_fallback.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/tileset_render.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/tileset_render.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/tileset_truetype.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/tileset_truetype.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/timer.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/tree.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/tree_c.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/txtfield.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/txtfield_c.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/utility.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/version.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/wrappers.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/wrappers.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/zip.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod/zip_c.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/libtcod_c.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/vendor/khrplatform.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/vendor/lodepng.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/vendor/lodepng.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/vendor/stb.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/vendor/stb_ds.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/vendor/stb_truetype.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/vendor/utf8proc/utf8proc.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/vendor/utf8proc/utf8proc.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/vendor/utf8proc/utf8proc_data.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/vendor/zlib/adler32.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/vendor/zlib/compress.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/vendor/zlib/crc32.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/vendor/zlib/crc32.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/vendor/zlib/deflate.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/vendor/zlib/deflate.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/vendor/zlib/gzclose.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/vendor/zlib/gzguts.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/vendor/zlib/gzlib.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/vendor/zlib/gzread.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/vendor/zlib/gzwrite.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/vendor/zlib/infback.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/vendor/zlib/inffast.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/vendor/zlib/inffast.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/vendor/zlib/inffixed.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/vendor/zlib/inflate.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/vendor/zlib/inflate.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/vendor/zlib/inftrees.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/vendor/zlib/inftrees.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/vendor/zlib/trees.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/vendor/zlib/trees.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/vendor/zlib/uncompr.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/vendor/zlib/zconf.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/vendor/zlib/zlib.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/vendor/zlib/zutil.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcod/src/vendor/zlib/zutil.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/libtcodpy.py +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/requirements.txt +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/setup.cfg +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/tcod/__init__.py +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/tcod/__pyinstaller/__init__.py +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/tcod/__pyinstaller/hook-tcod.py +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/tcod/_libtcod.pyi +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/tcod/bsp.py +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/tcod/cdef.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/tcod/cffi.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/tcod/constants.py +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/tcod/event_constants.py +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/tcod/los.py +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/tcod/noise.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/tcod/noise.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/tcod/path.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/tcod/path.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/tcod/py.typed +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/tcod/random.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/tcod/random.py +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/tcod/render.py +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/tcod/sdl/__init__.py +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/tcod/sdl/audio.py +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/tcod/sdl/constants.py +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/tcod/tcod.c +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/tcod/tcod.h +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/tcod/tcod.py +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/tcod.egg-info/SOURCES.txt +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/tcod.egg-info/dependency_links.txt +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/tcod.egg-info/entry_points.txt +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/tcod.egg-info/requires.txt +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/tcod.egg-info/top_level.txt +0 -0
- {tcod-19.6.3 → tcod-20.1.0}/tox.ini +0 -0
|
@@ -6,6 +6,33 @@ This project adheres to [Semantic Versioning](https://semver.org/) since version
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [20.1.0] - 2026-02-25
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- `Tileset` now supports `MutableMapping` semantics.
|
|
14
|
+
Can get, set, or iterate over tiles as if it were a dictionary containing tile glyph arrays.
|
|
15
|
+
Also supports `+`, `|`, `+=`, and `|=` with other tilesets or mappings to merge them into a single Tileset.
|
|
16
|
+
- `tcod.tileset.procedural_block_elements` can take a tile shape and return a tileset.
|
|
17
|
+
|
|
18
|
+
### Deprecated
|
|
19
|
+
|
|
20
|
+
- `Tileset.set_tile(codepoint, tile)` was replaced with `tileset[codepoint] = tile` syntax.
|
|
21
|
+
- `Tileset.get_tile(codepoint)` was soft replaced with `tileset[codepoint]` syntax.
|
|
22
|
+
- `tcod.tileset.procedural_block_elements` should be used with dictionary semantics instead of passing in a tileset.
|
|
23
|
+
|
|
24
|
+
## [20.0.0] - 2026-02-06
|
|
25
|
+
|
|
26
|
+
### Added
|
|
27
|
+
|
|
28
|
+
- Now supports free-threaded Python, deploys with `cp314t` wheels.
|
|
29
|
+
- Added methods: `Renderer.coordinates_from_window` and `Renderer.coordinates_to_window`
|
|
30
|
+
- Added `tcod.event.convert_coordinates_from_window`.
|
|
31
|
+
|
|
32
|
+
### Changed
|
|
33
|
+
|
|
34
|
+
- `Renderer.logical_size` now returns `None` instead of `(0, 0)` when logical size is unset.
|
|
35
|
+
|
|
9
36
|
## [19.6.3] - 2026-01-12
|
|
10
37
|
|
|
11
38
|
Fix missing deployment
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tcod
|
|
3
|
-
Version:
|
|
3
|
+
Version: 20.1.0
|
|
4
4
|
Summary: The official Python port of libtcod.
|
|
5
5
|
Author-email: Kyle Benesch <4b796c65+tcod@gmail.com>
|
|
6
6
|
License-Expression: BSD-2-Clause
|
|
@@ -10,7 +10,7 @@ Project-URL: Changelog, https://github.com/libtcod/python-tcod/blob/main/CHANGEL
|
|
|
10
10
|
Project-URL: Source, https://github.com/libtcod/python-tcod
|
|
11
11
|
Project-URL: Tracker, https://github.com/libtcod/python-tcod/issues
|
|
12
12
|
Project-URL: Forum, https://github.com/libtcod/python-tcod/discussions
|
|
13
|
-
Keywords: roguelike,
|
|
13
|
+
Keywords: roguelike,roguelikedev,gamedev,Unicode,libtcod,libtcodpy,field-of-view,pathfinding
|
|
14
14
|
Platform: Windows
|
|
15
15
|
Platform: MacOS
|
|
16
16
|
Platform: Linux
|
|
@@ -23,11 +23,9 @@ Classifier: Natural Language :: English
|
|
|
23
23
|
Classifier: Operating System :: POSIX
|
|
24
24
|
Classifier: Operating System :: MacOS :: MacOS X
|
|
25
25
|
Classifier: Operating System :: Microsoft :: Windows
|
|
26
|
+
Classifier: Programming Language :: C
|
|
26
27
|
Classifier: Programming Language :: Python :: 3
|
|
27
|
-
Classifier: Programming Language :: Python ::
|
|
28
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
29
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
30
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
28
|
+
Classifier: Programming Language :: Python :: Free Threading :: 2 - Beta
|
|
31
29
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
32
30
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
33
31
|
Classifier: Topic :: Games/Entertainment
|
|
@@ -11,9 +11,8 @@ import platform
|
|
|
11
11
|
import re
|
|
12
12
|
import subprocess
|
|
13
13
|
import sys
|
|
14
|
-
from collections.abc import Iterable, Iterator
|
|
15
14
|
from pathlib import Path
|
|
16
|
-
from typing import Any, ClassVar
|
|
15
|
+
from typing import TYPE_CHECKING, Any, ClassVar, Final
|
|
17
16
|
|
|
18
17
|
import attrs
|
|
19
18
|
import pycparser # type: ignore[import-untyped]
|
|
@@ -27,7 +26,10 @@ sys.path.append(str(Path(__file__).parent)) # Allow importing local modules.
|
|
|
27
26
|
|
|
28
27
|
import build_sdl
|
|
29
28
|
|
|
30
|
-
|
|
29
|
+
if TYPE_CHECKING:
|
|
30
|
+
from collections.abc import Iterable, Iterator
|
|
31
|
+
|
|
32
|
+
Py_LIMITED_API: None | int = 0x03100000
|
|
31
33
|
|
|
32
34
|
HEADER_PARSE_PATHS = ("tcod/", "libtcod/src/libtcod/")
|
|
33
35
|
HEADER_PARSE_EXCLUDES = ("gl2_ext_.h", "renderer_gl_internal.h", "event.h")
|
|
@@ -165,9 +167,14 @@ libraries: list[str] = [*build_sdl.libraries]
|
|
|
165
167
|
library_dirs: list[str] = [*build_sdl.library_dirs]
|
|
166
168
|
define_macros: list[tuple[str, Any]] = []
|
|
167
169
|
|
|
168
|
-
if "
|
|
170
|
+
if "free-threading build" in sys.version:
|
|
171
|
+
Py_LIMITED_API = None
|
|
172
|
+
if "PYODIDE" in os.environ:
|
|
169
173
|
# Unable to apply Py_LIMITED_API to Pyodide in cffi<=1.17.1
|
|
170
174
|
# https://github.com/python-cffi/cffi/issues/179
|
|
175
|
+
Py_LIMITED_API = None
|
|
176
|
+
|
|
177
|
+
if Py_LIMITED_API:
|
|
171
178
|
define_macros.append(("Py_LIMITED_API", Py_LIMITED_API))
|
|
172
179
|
|
|
173
180
|
sources += walk_sources("tcod/")
|
|
@@ -269,7 +276,7 @@ def find_sdl_attrs(prefix: str) -> Iterator[tuple[str, int | str | Any]]:
|
|
|
269
276
|
|
|
270
277
|
`prefix` is used to filter out which names to copy.
|
|
271
278
|
"""
|
|
272
|
-
from tcod._libtcod import lib
|
|
279
|
+
from tcod._libtcod import lib # noqa: PLC0415
|
|
273
280
|
|
|
274
281
|
if prefix.startswith("SDL_"):
|
|
275
282
|
name_starts_at = 4
|
|
@@ -320,12 +327,14 @@ EXCLUDE_CONSTANT_PREFIXES = [
|
|
|
320
327
|
]
|
|
321
328
|
|
|
322
329
|
|
|
330
|
+
RE_CONSTANTS_ALL: Final = re.compile(
|
|
331
|
+
r"(.*# --- From constants.py ---).*(# --- End constants.py ---.*)",
|
|
332
|
+
re.DOTALL,
|
|
333
|
+
)
|
|
334
|
+
|
|
335
|
+
|
|
323
336
|
def update_module_all(filename: Path, new_all: str) -> None:
|
|
324
337
|
"""Update the __all__ of a file with the constants from new_all."""
|
|
325
|
-
RE_CONSTANTS_ALL = re.compile(
|
|
326
|
-
r"(.*# --- From constants.py ---).*(# --- End constants.py ---.*)",
|
|
327
|
-
re.DOTALL,
|
|
328
|
-
)
|
|
329
338
|
match = RE_CONSTANTS_ALL.match(filename.read_text(encoding="utf-8"))
|
|
330
339
|
assert match, f"Can't determine __all__ subsection in {filename}!"
|
|
331
340
|
header, footer = match.groups()
|
|
@@ -346,8 +355,8 @@ def generate_enums(prefix: str) -> Iterator[str]:
|
|
|
346
355
|
|
|
347
356
|
def write_library_constants() -> None:
|
|
348
357
|
"""Write libtcod constants into the tcod.constants module."""
|
|
349
|
-
import tcod.color
|
|
350
|
-
from tcod._libtcod import ffi, lib
|
|
358
|
+
import tcod.color # noqa: PLC0415
|
|
359
|
+
from tcod._libtcod import ffi, lib # noqa: PLC0415
|
|
351
360
|
|
|
352
361
|
with Path("tcod/constants.py").open("w", encoding="utf-8") as f:
|
|
353
362
|
all_names = []
|
|
@@ -441,6 +450,8 @@ def _fix_reserved_name(name: str) -> str:
|
|
|
441
450
|
|
|
442
451
|
@attrs.define(frozen=True)
|
|
443
452
|
class ConvertedParam:
|
|
453
|
+
"""Converted type parameter from C types into Python type-hints."""
|
|
454
|
+
|
|
444
455
|
name: str = attrs.field(converter=_fix_reserved_name)
|
|
445
456
|
hint: str
|
|
446
457
|
original: str
|
|
@@ -460,7 +471,8 @@ def _type_from_names(names: list[str]) -> str:
|
|
|
460
471
|
return "Any"
|
|
461
472
|
|
|
462
473
|
|
|
463
|
-
def _param_as_hint(node: pycparser.c_ast.Node, default_name: str) -> ConvertedParam:
|
|
474
|
+
def _param_as_hint(node: pycparser.c_ast.Node, default_name: str) -> ConvertedParam: # noqa: PLR0911
|
|
475
|
+
"""Return a Python type-hint from a C AST node."""
|
|
464
476
|
original = pycparser.c_generator.CGenerator().visit(node)
|
|
465
477
|
name: str
|
|
466
478
|
names: list[str]
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
|
|
4
4
|
from __future__ import annotations
|
|
5
5
|
|
|
6
|
+
import functools
|
|
6
7
|
import io
|
|
7
8
|
import logging
|
|
8
9
|
import os
|
|
9
|
-
import platform
|
|
10
10
|
import re
|
|
11
11
|
import shutil
|
|
12
12
|
import subprocess
|
|
@@ -28,7 +28,20 @@ import requests
|
|
|
28
28
|
logger = logging.getLogger(__name__)
|
|
29
29
|
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
RE_MACHINE = re.compile(r".*\((.+)\)\]", re.DOTALL)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
@functools.cache
|
|
35
|
+
def python_machine() -> str:
|
|
36
|
+
"""Return the Python machine architecture (e.g. 'i386', 'AMD64', 'ARM64')."""
|
|
37
|
+
# Only needs to function correctly for Windows platforms.
|
|
38
|
+
match = RE_MACHINE.match(sys.version)
|
|
39
|
+
assert match, repr(sys.version)
|
|
40
|
+
(machine,) = match.groups()
|
|
41
|
+
machine = {"Intel": "i386"}.get(machine, machine)
|
|
42
|
+
logger.info(f"python_machine: {machine}")
|
|
43
|
+
return machine
|
|
44
|
+
|
|
32
45
|
|
|
33
46
|
# Reject versions of SDL older than this, update the requirements in the readme if you change this.
|
|
34
47
|
SDL_MIN_VERSION = (3, 2, 0)
|
|
@@ -139,8 +152,8 @@ def check_sdl_version() -> None:
|
|
|
139
152
|
sdl_version_str = subprocess.check_output(["sdl3-config", "--version"], universal_newlines=True).strip()
|
|
140
153
|
except FileNotFoundError as exc:
|
|
141
154
|
msg = (
|
|
142
|
-
f"libsdl3-dev or equivalent must be installed on your system and must be at least version {needed_version}
|
|
143
|
-
"
|
|
155
|
+
f"libsdl3-dev or equivalent must be installed on your system and must be at least version {needed_version}.\n"
|
|
156
|
+
"sdl3-config must be on PATH."
|
|
144
157
|
)
|
|
145
158
|
raise RuntimeError(msg) from exc
|
|
146
159
|
except subprocess.CalledProcessError as exc:
|
|
@@ -223,8 +236,8 @@ class SDLParser(pcpp.Preprocessor): # type: ignore[misc]
|
|
|
223
236
|
assert "SDL3/SDL" not in includepath, (includepath, curdir)
|
|
224
237
|
raise pcpp.OutputDirective(pcpp.Action.IgnoreAndRemove)
|
|
225
238
|
|
|
226
|
-
def _should_track_define(self, tokens: list[Any]) -> bool:
|
|
227
|
-
if len(tokens) < 3:
|
|
239
|
+
def _should_track_define(self, tokens: list[Any]) -> bool: # noqa: PLR0911
|
|
240
|
+
if len(tokens) < 3: # noqa: PLR2004
|
|
228
241
|
return False
|
|
229
242
|
if tokens[0].value in IGNORE_DEFINES:
|
|
230
243
|
return False
|
|
@@ -236,7 +249,7 @@ class SDLParser(pcpp.Preprocessor): # type: ignore[misc]
|
|
|
236
249
|
return False # Likely calls a private function.
|
|
237
250
|
if tokens[1].type == "CPP_LPAREN":
|
|
238
251
|
return False # Function-like macro.
|
|
239
|
-
if len(tokens) >= 4 and tokens[2].type == "CPP_INTEGER" and tokens[3].type == "CPP_DOT":
|
|
252
|
+
if len(tokens) >= 4 and tokens[2].type == "CPP_INTEGER" and tokens[3].type == "CPP_DOT": # noqa: PLR2004
|
|
240
253
|
return False # Value is a floating point number.
|
|
241
254
|
if tokens[0].value.startswith("SDL_PR") and (tokens[0].value.endswith("32") or tokens[0].value.endswith("64")):
|
|
242
255
|
return False # Data type for printing, which is not needed.
|
|
@@ -386,10 +399,10 @@ else:
|
|
|
386
399
|
# Bundle the Windows SDL DLL.
|
|
387
400
|
if sys.platform == "win32" and SDL_BUNDLE_PATH is not None:
|
|
388
401
|
include_dirs.append(str(SDL_INCLUDE))
|
|
389
|
-
ARCH_MAPPING = {"
|
|
390
|
-
SDL_LIB_DIR = Path(SDL_BUNDLE_PATH, "lib/", ARCH_MAPPING[
|
|
402
|
+
ARCH_MAPPING = {"i386": "x86", "AMD64": "x64", "ARM64": "arm64"}
|
|
403
|
+
SDL_LIB_DIR = Path(SDL_BUNDLE_PATH, "lib/", ARCH_MAPPING[python_machine()])
|
|
391
404
|
library_dirs.append(str(SDL_LIB_DIR))
|
|
392
|
-
SDL_LIB_DEST = Path("tcod", ARCH_MAPPING[
|
|
405
|
+
SDL_LIB_DEST = Path("tcod", ARCH_MAPPING[python_machine()])
|
|
393
406
|
SDL_LIB_DEST.mkdir(exist_ok=True)
|
|
394
407
|
SDL_LIB_DEST_FILE = SDL_LIB_DEST / "SDL3.dll"
|
|
395
408
|
SDL_LIB_FILE = SDL_LIB_DIR / "SDL3.dll"
|
|
@@ -34,13 +34,15 @@ dependencies = [
|
|
|
34
34
|
]
|
|
35
35
|
keywords = [
|
|
36
36
|
"roguelike",
|
|
37
|
-
"
|
|
37
|
+
"roguelikedev",
|
|
38
|
+
"gamedev",
|
|
38
39
|
"Unicode",
|
|
39
40
|
"libtcod",
|
|
41
|
+
"libtcodpy",
|
|
40
42
|
"field-of-view",
|
|
41
43
|
"pathfinding",
|
|
42
44
|
]
|
|
43
|
-
classifiers = [
|
|
45
|
+
classifiers = [ # https://pypi.org/classifiers/
|
|
44
46
|
"Development Status :: 5 - Production/Stable",
|
|
45
47
|
"Environment :: Win32 (MS Windows)",
|
|
46
48
|
"Environment :: MacOS X",
|
|
@@ -50,11 +52,9 @@ classifiers = [
|
|
|
50
52
|
"Operating System :: POSIX",
|
|
51
53
|
"Operating System :: MacOS :: MacOS X",
|
|
52
54
|
"Operating System :: Microsoft :: Windows",
|
|
55
|
+
"Programming Language :: C",
|
|
53
56
|
"Programming Language :: Python :: 3",
|
|
54
|
-
"Programming Language :: Python ::
|
|
55
|
-
"Programming Language :: Python :: 3.11",
|
|
56
|
-
"Programming Language :: Python :: 3.12",
|
|
57
|
-
"Programming Language :: Python :: 3.13",
|
|
57
|
+
"Programming Language :: Python :: Free Threading :: 2 - Beta",
|
|
58
58
|
"Programming Language :: Python :: Implementation :: CPython",
|
|
59
59
|
"Programming Language :: Python :: Implementation :: PyPy",
|
|
60
60
|
"Topic :: Games/Entertainment",
|
|
@@ -74,9 +74,6 @@ Source = "https://github.com/libtcod/python-tcod"
|
|
|
74
74
|
Tracker = "https://github.com/libtcod/python-tcod/issues"
|
|
75
75
|
Forum = "https://github.com/libtcod/python-tcod/discussions"
|
|
76
76
|
|
|
77
|
-
[tool.distutils.bdist_wheel]
|
|
78
|
-
py-limited-api = "cp310"
|
|
79
|
-
|
|
80
77
|
[tool.setuptools_scm]
|
|
81
78
|
write_to = "tcod/version.py"
|
|
82
79
|
|
|
@@ -99,6 +96,10 @@ filterwarnings = [
|
|
|
99
96
|
"ignore:'import tcod as libtcodpy' is preferred.",
|
|
100
97
|
]
|
|
101
98
|
|
|
99
|
+
[tool.coverage.report] # https://coverage.readthedocs.io/en/latest/config.html
|
|
100
|
+
exclude_lines = ['^\s*\.\.\.', "if TYPE_CHECKING:", "# pragma: no cover"]
|
|
101
|
+
omit = ["tcod/__pyinstaller/*"]
|
|
102
|
+
|
|
102
103
|
[tool.cibuildwheel] # https://cibuildwheel.pypa.io/en/stable/options/
|
|
103
104
|
enable = ["pypy", "pyodide-prerelease"]
|
|
104
105
|
|
|
@@ -152,20 +153,12 @@ line-length = 120
|
|
|
152
153
|
select = ["ALL"]
|
|
153
154
|
ignore = [
|
|
154
155
|
"COM", # flake8-commas
|
|
155
|
-
"D203", # one-blank-line-before-class
|
|
156
|
-
"D204", # one-blank-line-after-class
|
|
157
|
-
"D213", # multi-line-summary-second-line
|
|
158
|
-
"D407", # dashed-underline-after-section
|
|
159
|
-
"D408", # section-underline-after-name
|
|
160
|
-
"D409", # section-underline-matches-section-length
|
|
161
|
-
"D206", # indent-with-spaces
|
|
162
156
|
"E501", # line-too-long
|
|
163
157
|
"PYI064", # redundant-final-literal
|
|
164
158
|
"S101", # assert
|
|
165
159
|
"S301", # suspicious-pickle-usage
|
|
166
160
|
"S311", # suspicious-non-cryptographic-random-usage
|
|
167
161
|
"SLF001", # private-member-access
|
|
168
|
-
"W191", # tab-indentation
|
|
169
162
|
]
|
|
170
163
|
[tool.ruff.lint.per-file-ignores]
|
|
171
164
|
"**/{tests}/*" = [
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
|
|
4
4
|
from __future__ import annotations
|
|
5
5
|
|
|
6
|
-
import platform
|
|
7
6
|
import sys
|
|
8
7
|
from pathlib import Path
|
|
9
8
|
|
|
@@ -18,18 +17,19 @@ SETUP_DIR = Path(__file__).parent # setup.py current directory
|
|
|
18
17
|
|
|
19
18
|
def get_package_data() -> list[str]:
|
|
20
19
|
"""Get data files which will be included in the main tcod/ directory."""
|
|
21
|
-
bit_size, _ = platform.architecture()
|
|
22
20
|
files = [
|
|
23
21
|
"py.typed",
|
|
24
22
|
"lib/LIBTCOD-CREDITS.txt",
|
|
25
23
|
"lib/LIBTCOD-LICENSE.txt",
|
|
26
24
|
"lib/README-SDL.txt",
|
|
27
25
|
]
|
|
28
|
-
if "win32"
|
|
29
|
-
if
|
|
30
|
-
files += ["
|
|
31
|
-
|
|
26
|
+
if sys.platform == "win32":
|
|
27
|
+
if "ARM64" in sys.version:
|
|
28
|
+
files += ["arm64/SDL3.dll"]
|
|
29
|
+
elif "AMD64" in sys.version:
|
|
32
30
|
files += ["x64/SDL3.dll"]
|
|
31
|
+
else:
|
|
32
|
+
files += ["x86/SDL3.dll"]
|
|
33
33
|
if sys.platform == "darwin":
|
|
34
34
|
files += ["SDL3.framework/Versions/A/SDL3"]
|
|
35
35
|
return files
|
|
@@ -40,6 +40,13 @@ if not (SETUP_DIR / "libtcod/src").exists():
|
|
|
40
40
|
print("Did you forget to run 'git submodule update --init'?")
|
|
41
41
|
sys.exit(1)
|
|
42
42
|
|
|
43
|
+
options = {
|
|
44
|
+
"bdist_wheel": {
|
|
45
|
+
"py_limited_api": "cp310",
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if "free-threading build" in sys.version:
|
|
49
|
+
del options["bdist_wheel"]["py_limited_api"]
|
|
43
50
|
|
|
44
51
|
setup(
|
|
45
52
|
py_modules=["libtcodpy"],
|
|
@@ -47,4 +54,5 @@ setup(
|
|
|
47
54
|
package_data={"tcod": get_package_data()},
|
|
48
55
|
cffi_modules=["build_libtcod.py:ffi"],
|
|
49
56
|
platforms=["Windows", "MacOS", "Linux"],
|
|
57
|
+
options=options,
|
|
50
58
|
)
|
|
@@ -8,7 +8,7 @@ import warnings
|
|
|
8
8
|
from collections.abc import Callable
|
|
9
9
|
from typing import TYPE_CHECKING, Any, AnyStr, Literal, NoReturn, SupportsInt, TypeVar
|
|
10
10
|
|
|
11
|
-
from typing_extensions import
|
|
11
|
+
from typing_extensions import deprecated
|
|
12
12
|
|
|
13
13
|
from tcod.cffi import ffi, lib
|
|
14
14
|
|
|
@@ -40,16 +40,6 @@ def _deprecate_passthrough(
|
|
|
40
40
|
deprecate = deprecated if __debug__ or TYPE_CHECKING else _deprecate_passthrough
|
|
41
41
|
|
|
42
42
|
|
|
43
|
-
def pending_deprecate(
|
|
44
|
-
message: LiteralString = "This function may be deprecated in the future."
|
|
45
|
-
" Consider raising an issue on GitHub if you need this feature.",
|
|
46
|
-
category: type[Warning] = PendingDeprecationWarning,
|
|
47
|
-
stacklevel: int = 0,
|
|
48
|
-
) -> Callable[[F], F]:
|
|
49
|
-
"""Like deprecate, but the default parameters are filled out for a generic pending deprecation warning."""
|
|
50
|
-
return deprecate(message, category=category, stacklevel=stacklevel)
|
|
51
|
-
|
|
52
|
-
|
|
53
43
|
def verify_order(order: Literal["C", "F"]) -> Literal["C", "F"]:
|
|
54
44
|
"""Verify and return a Numpy order string."""
|
|
55
45
|
order = order.upper() # type: ignore[assignment]
|
|
@@ -7,7 +7,7 @@ import os
|
|
|
7
7
|
import platform
|
|
8
8
|
import sys
|
|
9
9
|
from pathlib import Path
|
|
10
|
-
from typing import Any
|
|
10
|
+
from typing import Any, Literal
|
|
11
11
|
|
|
12
12
|
import cffi
|
|
13
13
|
|
|
@@ -39,8 +39,10 @@ def verify_dependencies() -> None:
|
|
|
39
39
|
raise RuntimeError(msg)
|
|
40
40
|
|
|
41
41
|
|
|
42
|
-
def get_architecture() ->
|
|
43
|
-
"""Return the Windows architecture
|
|
42
|
+
def get_architecture() -> Literal["x86", "x64", "arm64"]:
|
|
43
|
+
"""Return the Windows architecture."""
|
|
44
|
+
if "(ARM64)" in sys.version:
|
|
45
|
+
return "arm64"
|
|
44
46
|
return "x86" if platform.architecture()[0] == "32bit" else "x64"
|
|
45
47
|
|
|
46
48
|
|
|
@@ -8,7 +8,6 @@ See :ref:`getting-started` for info on how to set those up.
|
|
|
8
8
|
from __future__ import annotations
|
|
9
9
|
|
|
10
10
|
import warnings
|
|
11
|
-
from collections.abc import Iterable
|
|
12
11
|
from pathlib import Path
|
|
13
12
|
from typing import TYPE_CHECKING, Any, Literal, overload
|
|
14
13
|
|
|
@@ -22,6 +21,7 @@ from tcod._internal import _check, _path_encode
|
|
|
22
21
|
from tcod.cffi import ffi, lib
|
|
23
22
|
|
|
24
23
|
if TYPE_CHECKING:
|
|
24
|
+
from collections.abc import Iterable
|
|
25
25
|
from os import PathLike
|
|
26
26
|
|
|
27
27
|
from numpy.typing import ArrayLike, NDArray
|
|
@@ -29,9 +29,8 @@ import copy
|
|
|
29
29
|
import pickle
|
|
30
30
|
import sys
|
|
31
31
|
import warnings
|
|
32
|
-
from collections.abc import Iterable
|
|
33
32
|
from pathlib import Path
|
|
34
|
-
from typing import Any, Literal, NoReturn, TypeVar
|
|
33
|
+
from typing import TYPE_CHECKING, Any, Literal, NoReturn, TypeVar
|
|
35
34
|
|
|
36
35
|
from typing_extensions import Self, deprecated
|
|
37
36
|
|
|
@@ -44,6 +43,9 @@ import tcod.tileset
|
|
|
44
43
|
from tcod._internal import _check, _check_warn
|
|
45
44
|
from tcod.cffi import ffi, lib
|
|
46
45
|
|
|
46
|
+
if TYPE_CHECKING:
|
|
47
|
+
from collections.abc import Iterable
|
|
48
|
+
|
|
47
49
|
__all__ = (
|
|
48
50
|
"RENDERER_OPENGL",
|
|
49
51
|
"RENDERER_OPENGL2",
|
|
@@ -123,7 +125,7 @@ It is not recommended to use this renderer on Windows.
|
|
|
123
125
|
|
|
124
126
|
def _handle_tileset(tileset: tcod.tileset.Tileset | None) -> Any: # noqa: ANN401
|
|
125
127
|
"""Get the TCOD_Tileset pointer from a Tileset or return a NULL pointer."""
|
|
126
|
-
return tileset._tileset_p if tileset else ffi.NULL
|
|
128
|
+
return tileset._tileset_p if tileset is not None else ffi.NULL
|
|
127
129
|
|
|
128
130
|
|
|
129
131
|
def _handle_title(title: str | None) -> Any: # noqa: ANN401
|
|
@@ -87,13 +87,15 @@ import functools
|
|
|
87
87
|
import sys
|
|
88
88
|
import warnings
|
|
89
89
|
from collections.abc import Callable, Iterator, Mapping
|
|
90
|
-
from typing import TYPE_CHECKING, Any, Final, Generic, Literal, NamedTuple, TypeVar
|
|
90
|
+
from typing import TYPE_CHECKING, Any, Final, Generic, Literal, NamedTuple, TypeVar, overload
|
|
91
91
|
|
|
92
92
|
import numpy as np
|
|
93
93
|
from typing_extensions import deprecated
|
|
94
94
|
|
|
95
|
+
import tcod.context
|
|
95
96
|
import tcod.event_constants
|
|
96
97
|
import tcod.sdl.joystick
|
|
98
|
+
import tcod.sdl.render
|
|
97
99
|
import tcod.sdl.sys
|
|
98
100
|
from tcod.cffi import ffi, lib
|
|
99
101
|
from tcod.event_constants import * # noqa: F403
|
|
@@ -103,6 +105,7 @@ if TYPE_CHECKING:
|
|
|
103
105
|
from numpy.typing import NDArray
|
|
104
106
|
|
|
105
107
|
T = TypeVar("T")
|
|
108
|
+
_EventType = TypeVar("_EventType", bound="Event")
|
|
106
109
|
|
|
107
110
|
|
|
108
111
|
class _ConstantsWithPrefix(Mapping[int, str]):
|
|
@@ -153,6 +156,9 @@ class Point(NamedTuple):
|
|
|
153
156
|
|
|
154
157
|
.. seealso::
|
|
155
158
|
:any:`MouseMotion` :any:`MouseButtonDown` :any:`MouseButtonUp`
|
|
159
|
+
|
|
160
|
+
.. versionchanged:: 19.0
|
|
161
|
+
Now uses floating point coordinates due to the port to SDL3.
|
|
156
162
|
"""
|
|
157
163
|
|
|
158
164
|
x: float
|
|
@@ -478,6 +484,9 @@ class MouseMotion(MouseState):
|
|
|
478
484
|
.. versionchanged:: 15.0
|
|
479
485
|
Renamed `pixel` attribute to `position`.
|
|
480
486
|
Renamed `pixel_motion` attribute to `motion`.
|
|
487
|
+
|
|
488
|
+
.. versionchanged:: 19.0
|
|
489
|
+
`position` and `motion` now use floating point coordinates.
|
|
481
490
|
"""
|
|
482
491
|
|
|
483
492
|
def __init__(
|
|
@@ -555,7 +564,7 @@ class MouseButtonEvent(MouseState):
|
|
|
555
564
|
type (str): Will be "MOUSEBUTTONDOWN" or "MOUSEBUTTONUP",
|
|
556
565
|
depending on the event.
|
|
557
566
|
position (Point): The pixel coordinates of the mouse.
|
|
558
|
-
tile (Point): The
|
|
567
|
+
tile (Point): The tile coordinates of the mouse on the screen.
|
|
559
568
|
button (int): Which mouse button.
|
|
560
569
|
|
|
561
570
|
This will be one of the following names:
|
|
@@ -566,6 +575,8 @@ class MouseButtonEvent(MouseState):
|
|
|
566
575
|
* tcod.event.BUTTON_X1
|
|
567
576
|
* tcod.event.BUTTON_X2
|
|
568
577
|
|
|
578
|
+
.. versionchanged:: 19.0
|
|
579
|
+
`position` and `tile` now use floating point coordinates.
|
|
569
580
|
"""
|
|
570
581
|
|
|
571
582
|
def __init__(
|
|
@@ -1198,7 +1209,7 @@ def _parse_event(sdl_event: Any) -> Event:
|
|
|
1198
1209
|
return Undefined.from_sdl_event(sdl_event)
|
|
1199
1210
|
|
|
1200
1211
|
|
|
1201
|
-
def get() -> Iterator[
|
|
1212
|
+
def get() -> Iterator[Event]:
|
|
1202
1213
|
"""Return an iterator for all pending events.
|
|
1203
1214
|
|
|
1204
1215
|
Events are processed as the iterator is consumed.
|
|
@@ -1218,7 +1229,7 @@ def get() -> Iterator[Any]:
|
|
|
1218
1229
|
yield _parse_event(sdl_event)
|
|
1219
1230
|
|
|
1220
1231
|
|
|
1221
|
-
def wait(timeout: float | None = None) -> Iterator[
|
|
1232
|
+
def wait(timeout: float | None = None) -> Iterator[Event]:
|
|
1222
1233
|
"""Block until events exist, then return an event iterator.
|
|
1223
1234
|
|
|
1224
1235
|
`timeout` is the maximum number of seconds to wait as a floating point
|
|
@@ -1564,6 +1575,78 @@ def get_mouse_state() -> MouseState:
|
|
|
1564
1575
|
return MouseState((xy[0], xy[1]), (int(tile[0]), int(tile[1])), buttons)
|
|
1565
1576
|
|
|
1566
1577
|
|
|
1578
|
+
@overload
|
|
1579
|
+
def convert_coordinates_from_window(
|
|
1580
|
+
event: _EventType,
|
|
1581
|
+
/,
|
|
1582
|
+
context: tcod.context.Context | tcod.sdl.render.Renderer,
|
|
1583
|
+
console: tcod.console.Console | tuple[int, int],
|
|
1584
|
+
dest_rect: tuple[int, int, int, int] | None = None,
|
|
1585
|
+
) -> _EventType: ...
|
|
1586
|
+
@overload
|
|
1587
|
+
def convert_coordinates_from_window(
|
|
1588
|
+
xy: tuple[float, float],
|
|
1589
|
+
/,
|
|
1590
|
+
context: tcod.context.Context | tcod.sdl.render.Renderer,
|
|
1591
|
+
console: tcod.console.Console | tuple[int, int],
|
|
1592
|
+
dest_rect: tuple[int, int, int, int] | None = None,
|
|
1593
|
+
) -> tuple[float, float]: ...
|
|
1594
|
+
def convert_coordinates_from_window(
|
|
1595
|
+
event: _EventType | tuple[float, float],
|
|
1596
|
+
/,
|
|
1597
|
+
context: tcod.context.Context | tcod.sdl.render.Renderer,
|
|
1598
|
+
console: tcod.console.Console | tuple[int, int],
|
|
1599
|
+
dest_rect: tuple[int, int, int, int] | None = None,
|
|
1600
|
+
) -> _EventType | tuple[float, float]:
|
|
1601
|
+
"""Return an event or position with window mouse coordinates converted into console tile coordinates.
|
|
1602
|
+
|
|
1603
|
+
Args:
|
|
1604
|
+
event: :any:`Event` to convert, or the `(x, y)` coordinates to convert.
|
|
1605
|
+
context: Context or Renderer to fetch the SDL renderer from for reference with conversions.
|
|
1606
|
+
console: A console used as a size reference.
|
|
1607
|
+
Otherwise the `(columns, rows)` can be given directly as a tuple.
|
|
1608
|
+
dest_rect: The consoles rendering destination as `(x, y, width, height)`.
|
|
1609
|
+
If None is given then the whole rendering target is assumed.
|
|
1610
|
+
|
|
1611
|
+
.. versionadded:: 20.0
|
|
1612
|
+
"""
|
|
1613
|
+
if isinstance(context, tcod.context.Context):
|
|
1614
|
+
maybe_renderer: Final = context.sdl_renderer
|
|
1615
|
+
if maybe_renderer is None:
|
|
1616
|
+
return event
|
|
1617
|
+
context = maybe_renderer
|
|
1618
|
+
|
|
1619
|
+
if isinstance(console, tcod.console.Console):
|
|
1620
|
+
console = console.width, console.height
|
|
1621
|
+
|
|
1622
|
+
if dest_rect is None:
|
|
1623
|
+
dest_rect = (0, 0, *(context.logical_size or context.output_size))
|
|
1624
|
+
|
|
1625
|
+
x_scale: Final = console[0] / dest_rect[2]
|
|
1626
|
+
y_scale: Final = console[1] / dest_rect[3]
|
|
1627
|
+
x_offset: Final = dest_rect[0]
|
|
1628
|
+
y_offset: Final = dest_rect[1]
|
|
1629
|
+
|
|
1630
|
+
if not isinstance(event, Event):
|
|
1631
|
+
x, y = context.coordinates_from_window(event)
|
|
1632
|
+
return (x - x_offset) * x_scale, (y - y_offset) * y_scale
|
|
1633
|
+
|
|
1634
|
+
if isinstance(event, MouseMotion):
|
|
1635
|
+
previous_position = convert_coordinates_from_window(
|
|
1636
|
+
((event.position[0] - event.motion[0]), (event.position[1] - event.motion[1])), context, console, dest_rect
|
|
1637
|
+
)
|
|
1638
|
+
position = convert_coordinates_from_window(event.position, context, console, dest_rect)
|
|
1639
|
+
event.motion = tcod.event.Point(position[0] - previous_position[0], position[1] - previous_position[1])
|
|
1640
|
+
event._tile_motion = tcod.event.Point(
|
|
1641
|
+
int(position[0]) - int(previous_position[0]), int(position[1]) - int(previous_position[1])
|
|
1642
|
+
)
|
|
1643
|
+
if isinstance(event, (MouseState, MouseMotion)):
|
|
1644
|
+
event.position = event._tile = tcod.event.Point(
|
|
1645
|
+
*convert_coordinates_from_window(event.position, context, console, dest_rect)
|
|
1646
|
+
)
|
|
1647
|
+
return event
|
|
1648
|
+
|
|
1649
|
+
|
|
1567
1650
|
@ffi.def_extern() # type: ignore[untyped-decorator]
|
|
1568
1651
|
def _sdl_event_watcher(userdata: Any, sdl_event: Any) -> int:
|
|
1569
1652
|
callback: Callable[[Event], None] = ffi.from_handle(userdata)
|
|
@@ -71,7 +71,7 @@ class Image:
|
|
|
71
71
|
.. versionadded:: 11.4
|
|
72
72
|
"""
|
|
73
73
|
array = np.asarray(array, dtype=np.uint8)
|
|
74
|
-
height, width,
|
|
74
|
+
height, width, _depth = array.shape
|
|
75
75
|
image = cls(width, height)
|
|
76
76
|
image_array: NDArray[np.uint8] = np.asarray(image)
|
|
77
77
|
image_array[...] = array
|