tcod 19.6.3__tar.gz → 20.0.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.0.0}/CHANGELOG.md +12 -0
- {tcod-19.6.3 → tcod-20.0.0}/PKG-INFO +3 -6
- {tcod-19.6.3 → tcod-20.0.0}/build_libtcod.py +24 -12
- {tcod-19.6.3 → tcod-20.0.0}/build_sdl.py +23 -10
- {tcod-19.6.3 → tcod-20.0.0}/pyproject.toml +9 -9
- {tcod-19.6.3 → tcod-20.0.0}/setup.py +14 -6
- {tcod-19.6.3 → tcod-20.0.0}/tcod/_internal.py +1 -11
- {tcod-19.6.3 → tcod-20.0.0}/tcod/cffi.py +5 -3
- {tcod-19.6.3 → tcod-20.0.0}/tcod/color.py +2 -0
- {tcod-19.6.3 → tcod-20.0.0}/tcod/console.py +1 -1
- {tcod-19.6.3 → tcod-20.0.0}/tcod/context.py +4 -2
- {tcod-19.6.3 → tcod-20.0.0}/tcod/event.py +78 -3
- {tcod-19.6.3 → tcod-20.0.0}/tcod/image.py +1 -1
- {tcod-19.6.3 → tcod-20.0.0}/tcod/libtcodpy.py +140 -136
- {tcod-19.6.3 → tcod-20.0.0}/tcod/map.py +15 -14
- {tcod-19.6.3 → tcod-20.0.0}/tcod/noise.py +4 -3
- {tcod-19.6.3 → tcod-20.0.0}/tcod/path.py +6 -5
- {tcod-19.6.3 → tcod-20.0.0}/tcod/sdl/_internal.py +2 -2
- {tcod-19.6.3 → tcod-20.0.0}/tcod/sdl/joystick.py +5 -5
- {tcod-19.6.3 → tcod-20.0.0}/tcod/sdl/mouse.py +7 -4
- {tcod-19.6.3 → tcod-20.0.0}/tcod/sdl/render.py +38 -10
- {tcod-19.6.3 → tcod-20.0.0}/tcod/sdl/sys.py +1 -1
- {tcod-19.6.3 → tcod-20.0.0}/tcod/sdl/video.py +2 -2
- {tcod-19.6.3 → tcod-20.0.0}/tcod/tileset.py +1 -1
- {tcod-19.6.3 → tcod-20.0.0}/tcod/version.py +3 -3
- {tcod-19.6.3 → tcod-20.0.0}/tcod.egg-info/PKG-INFO +3 -6
- {tcod-19.6.3 → tcod-20.0.0}/CONTRIBUTING.md +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/LICENSE.txt +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/MANIFEST.in +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/README.rst +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/CHANGELOG.md +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/CMakeLists.txt +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/CONTRIBUTING.md +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/LIBTCOD-CREDITS.txt +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/LICENSE.txt +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/README.md +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/bresenham.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/bresenham_c.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/bsp.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/bsp_c.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/color.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/color.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/config.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/console.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/console.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/console_drawing.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/console_drawing.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/console_etc.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/console_etc.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/console_init.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/console_init.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/console_printing.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/console_printing.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/console_rexpaint.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/console_rexpaint.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/console_types.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/context.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/context.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/context_init.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/context_init.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/context_viewport.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/context_viewport.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/error.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/error.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/fov.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/fov_c.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/fov_circular_raycasting.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/fov_diamond_raycasting.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/fov_permissive2.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/fov_recursive_shadowcasting.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/fov_restrictive.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/fov_symmetric_shadowcast.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/fov_types.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/globals.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/globals.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/heapq.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/heapq.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/heightmap.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/heightmap_c.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/image.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/image_c.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/lex.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/lex_c.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/libtcod.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/libtcod_int.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/list.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/list_c.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/logging.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/logging.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/mersenne.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/mersenne_c.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/mersenne_types.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/mouse.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/mouse_types.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/namegen.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/namegen_c.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/noise.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/noise_c.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/noise_defaults.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/parser.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/parser_c.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/path.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/path_c.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/pathfinder.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/pathfinder.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/pathfinder_frontier.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/pathfinder_frontier.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/portability.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/random.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/random.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/renderer_sdl2.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/renderer_sdl2.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/renderer_xterm.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/renderer_xterm.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/sdl2/console_grid.glslf +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/sdl2/console_grid.glslv +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/sdl2/event.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/sys.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/sys_c.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/sys_sdl_c.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/sys_sdl_img_bmp.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/sys_sdl_img_png.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/tileset.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/tileset.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/tileset_bdf.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/tileset_bdf.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/tileset_fallback.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/tileset_fallback.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/tileset_render.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/tileset_render.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/tileset_truetype.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/tileset_truetype.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/timer.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/tree.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/tree_c.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/txtfield.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/txtfield_c.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/utility.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/version.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/wrappers.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/wrappers.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/zip.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod/zip_c.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/libtcod_c.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/vendor/khrplatform.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/vendor/lodepng.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/vendor/lodepng.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/vendor/stb.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/vendor/stb_ds.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/vendor/stb_truetype.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/vendor/utf8proc/utf8proc.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/vendor/utf8proc/utf8proc.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/vendor/utf8proc/utf8proc_data.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/vendor/zlib/adler32.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/vendor/zlib/compress.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/vendor/zlib/crc32.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/vendor/zlib/crc32.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/vendor/zlib/deflate.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/vendor/zlib/deflate.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/vendor/zlib/gzclose.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/vendor/zlib/gzguts.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/vendor/zlib/gzlib.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/vendor/zlib/gzread.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/vendor/zlib/gzwrite.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/vendor/zlib/infback.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/vendor/zlib/inffast.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/vendor/zlib/inffast.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/vendor/zlib/inffixed.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/vendor/zlib/inflate.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/vendor/zlib/inflate.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/vendor/zlib/inftrees.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/vendor/zlib/inftrees.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/vendor/zlib/trees.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/vendor/zlib/trees.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/vendor/zlib/uncompr.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/vendor/zlib/zconf.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/vendor/zlib/zlib.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/vendor/zlib/zutil.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcod/src/vendor/zlib/zutil.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/libtcodpy.py +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/requirements.txt +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/setup.cfg +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/tcod/__init__.py +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/tcod/__pyinstaller/__init__.py +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/tcod/__pyinstaller/hook-tcod.py +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/tcod/_libtcod.pyi +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/tcod/bsp.py +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/tcod/cdef.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/tcod/cffi.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/tcod/constants.py +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/tcod/event_constants.py +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/tcod/los.py +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/tcod/noise.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/tcod/noise.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/tcod/path.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/tcod/path.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/tcod/py.typed +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/tcod/random.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/tcod/random.py +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/tcod/render.py +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/tcod/sdl/__init__.py +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/tcod/sdl/audio.py +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/tcod/sdl/constants.py +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/tcod/tcod.c +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/tcod/tcod.h +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/tcod/tcod.py +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/tcod.egg-info/SOURCES.txt +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/tcod.egg-info/dependency_links.txt +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/tcod.egg-info/entry_points.txt +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/tcod.egg-info/requires.txt +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/tcod.egg-info/top_level.txt +0 -0
- {tcod-19.6.3 → tcod-20.0.0}/tox.ini +0 -0
|
@@ -6,6 +6,18 @@ This project adheres to [Semantic Versioning](https://semver.org/) since version
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [20.0.0] - 2026-02-06
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- Now supports free-threaded Python, deploys with `cp314t` wheels.
|
|
14
|
+
- Added methods: `Renderer.coordinates_from_window` and `Renderer.coordinates_to_window`
|
|
15
|
+
- Added `tcod.event.convert_coordinates_from_window`.
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- `Renderer.logical_size` now returns `None` instead of `(0, 0)` when logical size is unset.
|
|
20
|
+
|
|
9
21
|
## [19.6.3] - 2026-01-12
|
|
10
22
|
|
|
11
23
|
Fix missing deployment
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tcod
|
|
3
|
-
Version:
|
|
3
|
+
Version: 20.0.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
|
|
@@ -24,10 +24,7 @@ Classifier: Operating System :: POSIX
|
|
|
24
24
|
Classifier: Operating System :: MacOS :: MacOS X
|
|
25
25
|
Classifier: Operating System :: Microsoft :: Windows
|
|
26
26
|
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
|
|
27
|
+
Classifier: Programming Language :: Python :: Free Threading :: 2 - Beta
|
|
31
28
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
32
29
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
33
30
|
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",
|
|
@@ -51,10 +53,7 @@ classifiers = [
|
|
|
51
53
|
"Operating System :: MacOS :: MacOS X",
|
|
52
54
|
"Operating System :: Microsoft :: Windows",
|
|
53
55
|
"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",
|
|
56
|
+
"Programming Language :: Python :: Free Threading :: 2 - Beta",
|
|
58
57
|
"Programming Language :: Python :: Implementation :: CPython",
|
|
59
58
|
"Programming Language :: Python :: Implementation :: PyPy",
|
|
60
59
|
"Topic :: Games/Entertainment",
|
|
@@ -74,9 +73,6 @@ Source = "https://github.com/libtcod/python-tcod"
|
|
|
74
73
|
Tracker = "https://github.com/libtcod/python-tcod/issues"
|
|
75
74
|
Forum = "https://github.com/libtcod/python-tcod/discussions"
|
|
76
75
|
|
|
77
|
-
[tool.distutils.bdist_wheel]
|
|
78
|
-
py-limited-api = "cp310"
|
|
79
|
-
|
|
80
76
|
[tool.setuptools_scm]
|
|
81
77
|
write_to = "tcod/version.py"
|
|
82
78
|
|
|
@@ -99,6 +95,10 @@ filterwarnings = [
|
|
|
99
95
|
"ignore:'import tcod as libtcodpy' is preferred.",
|
|
100
96
|
]
|
|
101
97
|
|
|
98
|
+
[tool.coverage.report] # https://coverage.readthedocs.io/en/latest/config.html
|
|
99
|
+
exclude_lines = ['^\s*\.\.\.', "if TYPE_CHECKING:", "# pragma: no cover"]
|
|
100
|
+
omit = ["tcod/__pyinstaller/*"]
|
|
101
|
+
|
|
102
102
|
[tool.cibuildwheel] # https://cibuildwheel.pypa.io/en/stable/options/
|
|
103
103
|
enable = ["pypy", "pyodide-prerelease"]
|
|
104
104
|
|
|
@@ -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",
|
|
@@ -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]):
|
|
@@ -1198,7 +1201,7 @@ def _parse_event(sdl_event: Any) -> Event:
|
|
|
1198
1201
|
return Undefined.from_sdl_event(sdl_event)
|
|
1199
1202
|
|
|
1200
1203
|
|
|
1201
|
-
def get() -> Iterator[
|
|
1204
|
+
def get() -> Iterator[Event]:
|
|
1202
1205
|
"""Return an iterator for all pending events.
|
|
1203
1206
|
|
|
1204
1207
|
Events are processed as the iterator is consumed.
|
|
@@ -1218,7 +1221,7 @@ def get() -> Iterator[Any]:
|
|
|
1218
1221
|
yield _parse_event(sdl_event)
|
|
1219
1222
|
|
|
1220
1223
|
|
|
1221
|
-
def wait(timeout: float | None = None) -> Iterator[
|
|
1224
|
+
def wait(timeout: float | None = None) -> Iterator[Event]:
|
|
1222
1225
|
"""Block until events exist, then return an event iterator.
|
|
1223
1226
|
|
|
1224
1227
|
`timeout` is the maximum number of seconds to wait as a floating point
|
|
@@ -1564,6 +1567,78 @@ def get_mouse_state() -> MouseState:
|
|
|
1564
1567
|
return MouseState((xy[0], xy[1]), (int(tile[0]), int(tile[1])), buttons)
|
|
1565
1568
|
|
|
1566
1569
|
|
|
1570
|
+
@overload
|
|
1571
|
+
def convert_coordinates_from_window(
|
|
1572
|
+
event: _EventType,
|
|
1573
|
+
/,
|
|
1574
|
+
context: tcod.context.Context | tcod.sdl.render.Renderer,
|
|
1575
|
+
console: tcod.console.Console | tuple[int, int],
|
|
1576
|
+
dest_rect: tuple[int, int, int, int] | None = None,
|
|
1577
|
+
) -> _EventType: ...
|
|
1578
|
+
@overload
|
|
1579
|
+
def convert_coordinates_from_window(
|
|
1580
|
+
xy: tuple[float, float],
|
|
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
|
+
) -> tuple[float, float]: ...
|
|
1586
|
+
def convert_coordinates_from_window(
|
|
1587
|
+
event: _EventType | tuple[float, float],
|
|
1588
|
+
/,
|
|
1589
|
+
context: tcod.context.Context | tcod.sdl.render.Renderer,
|
|
1590
|
+
console: tcod.console.Console | tuple[int, int],
|
|
1591
|
+
dest_rect: tuple[int, int, int, int] | None = None,
|
|
1592
|
+
) -> _EventType | tuple[float, float]:
|
|
1593
|
+
"""Return an event or position with window mouse coordinates converted into console tile coordinates.
|
|
1594
|
+
|
|
1595
|
+
Args:
|
|
1596
|
+
event: :any:`Event` to convert, or the `(x, y)` coordinates to convert.
|
|
1597
|
+
context: Context or Renderer to fetch the SDL renderer from for reference with conversions.
|
|
1598
|
+
console: A console used as a size reference.
|
|
1599
|
+
Otherwise the `(columns, rows)` can be given directly as a tuple.
|
|
1600
|
+
dest_rect: The consoles rendering destination as `(x, y, width, height)`.
|
|
1601
|
+
If None is given then the whole rendering target is assumed.
|
|
1602
|
+
|
|
1603
|
+
.. versionadded:: 20.0
|
|
1604
|
+
"""
|
|
1605
|
+
if isinstance(context, tcod.context.Context):
|
|
1606
|
+
maybe_renderer: Final = context.sdl_renderer
|
|
1607
|
+
if maybe_renderer is None:
|
|
1608
|
+
return event
|
|
1609
|
+
context = maybe_renderer
|
|
1610
|
+
|
|
1611
|
+
if isinstance(console, tcod.console.Console):
|
|
1612
|
+
console = console.width, console.height
|
|
1613
|
+
|
|
1614
|
+
if dest_rect is None:
|
|
1615
|
+
dest_rect = (0, 0, *(context.logical_size or context.output_size))
|
|
1616
|
+
|
|
1617
|
+
x_scale: Final = console[0] / dest_rect[2]
|
|
1618
|
+
y_scale: Final = console[1] / dest_rect[3]
|
|
1619
|
+
x_offset: Final = dest_rect[0]
|
|
1620
|
+
y_offset: Final = dest_rect[1]
|
|
1621
|
+
|
|
1622
|
+
if not isinstance(event, Event):
|
|
1623
|
+
x, y = context.coordinates_from_window(event)
|
|
1624
|
+
return (x - x_offset) * x_scale, (y - y_offset) * y_scale
|
|
1625
|
+
|
|
1626
|
+
if isinstance(event, MouseMotion):
|
|
1627
|
+
previous_position = convert_coordinates_from_window(
|
|
1628
|
+
((event.position[0] - event.motion[0]), (event.position[1] - event.motion[1])), context, console, dest_rect
|
|
1629
|
+
)
|
|
1630
|
+
position = convert_coordinates_from_window(event.position, context, console, dest_rect)
|
|
1631
|
+
event.motion = tcod.event.Point(position[0] - previous_position[0], position[1] - previous_position[1])
|
|
1632
|
+
event._tile_motion = tcod.event.Point(
|
|
1633
|
+
int(position[0]) - int(previous_position[0]), int(position[1]) - int(previous_position[1])
|
|
1634
|
+
)
|
|
1635
|
+
if isinstance(event, (MouseState, MouseMotion)):
|
|
1636
|
+
event.position = event._tile = tcod.event.Point(
|
|
1637
|
+
*convert_coordinates_from_window(event.position, context, console, dest_rect)
|
|
1638
|
+
)
|
|
1639
|
+
return event
|
|
1640
|
+
|
|
1641
|
+
|
|
1567
1642
|
@ffi.def_extern() # type: ignore[untyped-decorator]
|
|
1568
1643
|
def _sdl_event_watcher(userdata: Any, sdl_event: Any) -> int:
|
|
1569
1644
|
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
|