A Python cffi port of libtcod.
Project description
Status
About
This is a Python cffi port of libtcod.
This library is hosted on GitHub.
Any issues you have with this module can be reported at the GitHub issue tracker.
The latest documentation can be found here.
This project was spun off from the python-tdl project, and is now it’s own module.
Installation
The recommended way to install is by using pip.
With Python installed, run the following command to install libtcod-cffi:
python -m pip install libtcod-cffi
This is good enough for most Python installations. See the requirements section if you’re building from source.
Usage
This module was designed to be backward compatible with the original libtcod module that is distributed with libtcod. If you had code that runs on the original module you can use this library as a drop-in replacement like this:
import tcod as libtcod
Guides and Tutorials for the original library should also work with this one.
Requirements
Python 2.7+, Python 3.4+, or PyPy 5.4+
Windows, Linux, or MacOS.
Linux requires the libsdl2 package and must be installed from source.
Extra requirements when installing directly from source
MinGW must be on the Windows path for use with pycparser. An equivalent C parser (such as gcc) must be installed on other OS’s.
Linux requires the packages: gcc libsdl2-dev libffi-dev python-dev
SDL2 is installed automatically on Windows and MacOS
License
libtcod-cffi is distributed under the Simplified 2-clause FreeBSD license. Read LICENSE.txt for more details.
Changelog
2.5.0 - 2017-05-28
- Changed
Pickle-able objects will have any subclasses pickled correctly now. The new objects can not be unpickled on older versions of libtcod-cffi.
Updated cdata attribute names in Map, Console, and Random.
2.4.4 - 2017-05-20
- Fixed
Fixed crashes when exiting on some systems.
2.4.3 - 2017-04-10
- Fixed
Fixed signatures for MacOS builds.
2.4.2 - 2017-04-10
- Removed
Dropped support for Python3.3
2.4.1 - 2017-04-07
- Fixed
Made sure MacOS dependencies are bundled correctly.
2.4.0 - 2017-04-03
- Added
Renderer regressions fixed, OpenGL and GLSL renderer’s are available again.
- Changed
The default renderer is now GLSL.
- Removed
tcod clipboard functions which were never fully implemented removed.
2.3.0 - 2017-03-15
- Added
Added support for loading/saving REXPaint files.
- Fixed
Console methods should be safe to use before a root console is initialized.
Fixed simplex noise artifacts when using negative coordinates.
Fixed backward compatible API inconsistencies with color indexes, console truth values, and line_iter missing the starting point.
The SDL callback should always receive an SDL_Surface.
2.2.1 - 2017-03-12
- Fixed
Fixed Console.print_frame not printing anything.
Fixed Noise.sample_ogrid alignment issue.
MacOS builds should work even if the system installed SDL2 library is old.
2.2.0 - 2017-02-18
- Added
You can now sample very large noise arrays using the Noise.sample_mgrid and Noise.sample_ogrid methods.
Noise class now supports pickle and copy modules.
2.1.0 - 2017-02-16
- Added
The root Console instance can now be used as a context manager. Closing the graphical window when the context exits.
Ported libtcod functions: sys_clipboard_get and sys_clipboard_set.
2.0.0 - 2017-02-11
- Added
Random instances can be copied and pickled.
Map instances can be copied and pickled.
The Map class now has the transparent, walkable, and fov attribues, you can assign to these as if they were numpy arrays.
Pathfinders in tcod.path can be given a numpy array as a cost map.
- Changed
Color instances can now be compared with any standard sequence.
- Deprecated
You might see a public cdata attribute on some classes, this attribute will be renamed at anytime.
- Removed
Console.print_str is now Console.print_
Some Console methods have been merged together.
All litcod-cffi classes have been moved to their own submodules.
Random methods renamed to be more like Python’s standard random module.
Noise class had multiple methods replaced by an implementation attribute.
libtcod-cffi classes and subpackages are not included in the tcod namespace by default.
Many redundant methods were removed from the Random class.
Map methods set_properies, clear, is_in_fov, is_walkable, and is_transparent were remvoed.
Pathfinding classmethod constructors are gone already. Not it’s just one constructor which accepts multiple kinds of maps.
- Fixed
Python 2 now uses the latin-1 codec when automatically coverting to Unicode.
2.0a4 - 2017-01-09
- Added
Console instances now have the fg,bg,ch attributes. These attributes are numpy arrays with direct access to libtcod console memory.
- Changed
Console default variables are now accessed using properties instead of method calls. Same with width and height.
Path-finding classes new use special classmethod constructors instead of tradional class instancing.
- Removed
Color to string conversion reverted to its original repr behaviour.
Console.get_char* methods removed in favor of the fg,bg,ch attributes.
Console.fill removed. This code was redundant with the new additions.
Console.get_default_*/set_default_* methods removed.
Console.get_width/height removed.
- Fixed
Dijkstra.get_path fixed.
2.0a3 - 2017-01-02
The numpy module is now required as a dependency.
The SDL.h and libtcod_int.h headers are now included in the cffi back-end.
Added the AStar and Dijkstra classes with simplified behaviour.
Added the BSP class which better represents bsp data attributes.
Added the Image class with methods mimicking libtcodpy behaviour.
Added the Map class with methods mimicking libtcodpy behaviour.
Added the Noise class. This class behaves similar to the tdl Noise class.
Added the Random class. This class provides a large variety of methods instead of being state based like in libtcodpy.
Color objects can new be converted into a 3 byte string used in libtcod color control operations.
heightmap functions can now accept carefully formatted numpy arrays.
Removed the keyboard repeat functions: console_set_keyboard_repeat and console_disable_keyboard_repeat.
2.0a2 - 2016-10-30
FrozenColor class removed.
Color class now uses a properly set up __repr__ method.
Functions which take the fmt parameter will now escape the ‘%’ symbol before sending the string to a C printf call.
Now using Google-Style docstrings.
Console class has most of its relevant methods.
Added the Console.fill function which needs only 3 numpy arrays instead of the usual 7 to cover all Console data.
2.0a1 - 2016-10-16
The userData parameter was added back. Functions which use it are marked depreciated.
Python exceptions will now propagate out of libtcod callbacks.
Some libtcod object oriented functions now have Python class methods associated with them (only BSP for now, more will be added later.)
Regression tests were added. Focusing on backwards compatibilty with libtcodpy. Several neglected functions were fixed during this.
All libtcod allocations are handled by the Python garbage collector. You’ll no longer have to call the delete functions on each object.
Now generates documentation for Read the Docs. You can find the latest documentation for libtcod-cffi here.
2.0a0 - 2016-10-05
updated to compile with libtcod-1.6.2 and SDL-2.0.4
1.0 - 2016-09-25
sub packages have been removed to follow the libtcodpy API more closely
bsp and pathfinding functions which take a callback no longer have the userdata parameter, if you need to pass data then you should use functools, methods, or enclosing scope rules
numpy buffer alignment issues on some 64-bit OS’s fixed
0.3 - 2016-09-24
switched to using pycparser to compile libtcod headers, this may have included many more functions in tcod’s namespace than before
parser custom listener fixed again, likely for good
0.2.12 - 2016-09-16
version increment due to how extremely broken the non-Windows builds were (false alarm, this module is just really hard to run integrated tests on)
0.2.11 - 2016-09-16
SDL is now bundled correctly in all Python wheels
0.2.10 - 2016-09-13
now using GitHub integrations, gaps in platform support have been filled, there should now be wheels for Mac OSX and 64-bit Python on Windows
the building process was simplified from a linking standpoint, most libraries are now statically linked
parser module is broken again
0.2.9 - 2016-09-01
Fixed crashes in list and parser modules
0.2.8 - 2016-03-11
Fixed off by one error in fov buffer
0.2.7 - 2016-01-21
Re-factored some code to reduce compiler warnings
Instructions on how to solve pip/cffi issues added to the readme
Official support for Python 3.5
0.2.6 - 2015-10-28
Added requirements.txt to fix a common pip/cffi issue.
Provided SDL headers are now for Windows only.
0.2.5 - 2015-10-28
Added /usr/include/SDL to include path
0.2.4 - 2015-10-28
Compiler will now use distribution specific SDL header files before falling back on the included header files.
0.2.3 - 2015-07-13
better Color performance
parser now works when using a custom listener class
SDL renderer callback now receives a accessible SDL_Surface cdata object.
0.2.2 - 2015-07-01
This module can now compile and link properly on Linux
0.2.1 - 2015-06-29
console_check_for_keypress and console_wait_for_keypress will work now
console_fill_foreground was fixed
console_init_root can now accept a regular string on Python 3
0.2.0 - 2015-06-27
The library is now backwards compatible with the original libtcod.py module. Everything except libtcod’s cfg parser is supported.
0.1.0 - 2015-06-22
First version released
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for libtcod_cffi-2.5.0-pp256-pypy_41-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d38b5ec82a266af80982ab3ba68c653395c39da3f3fd2ea0c2921e236ce21903 |
|
MD5 | e4290bb71f1296d8a597e22e90abe851 |
|
BLAKE2b-256 | 27b731601027adf5beacc616850b42f222de4c37fe643dda5c0cadf9387686c7 |
Hashes for libtcod_cffi-2.5.0-pp254-pypy_41-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1642a847689419f35fa37d6dba6632f63a83653fe9adb8070eeb8e7a8a8ec833 |
|
MD5 | d051b3120a0b63a85940ab7b8b0cba74 |
|
BLAKE2b-256 | a64d060819b449eda7eda60ea7c731909a8ab8c703d661c7a77f291f6bff1db6 |
Hashes for libtcod_cffi-2.5.0-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e61d49dc2ba20491e6f4bffa6a236b21d92e5210f837772a24a72a79e99c4a9d |
|
MD5 | 3dcd2701da2db695b62895da833e9705 |
|
BLAKE2b-256 | 60073b683e99250a06241cd262763cb99c0a53fc5a77a688c225ee392d945856 |
Hashes for libtcod_cffi-2.5.0-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7db853fb3c9719330b2a5003cabe1eb37514959be1902832544063030e4a1572 |
|
MD5 | da84b29696e4fc6a91bf3cc245df64aa |
|
BLAKE2b-256 | 6c506b1134e85926d1f313a0ffa3fe2632d5111ab1a2bf28f57e9674a5671a18 |
Hashes for libtcod_cffi-2.5.0-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ef3259fc85ade3fc09338547f1aaca9420fe5f7fd2aae9ddc6582eb731ecd55f |
|
MD5 | 23be3ef5d0b49c532223322a3b1ed249 |
|
BLAKE2b-256 | 41fa8d229fd332651e81f2e910d1c8c80aff8c6e1e93e29f25a6319c5b086da8 |
Hashes for libtcod_cffi-2.5.0-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d38fa6340f8be8f8d121bdfbc4d0b3f1f9cf33b7f51ca3a2a2f18094424ab63 |
|
MD5 | bd505969e4a76cc16d8029ac2ee43f9e |
|
BLAKE2b-256 | 594e9e079e976474da4bc741eb98cd832842c8ff901b9f2ca499b85b7f600082 |
Hashes for libtcod_cffi-2.5.0-cp34-cp34m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dc453d465376c247c1becd0468bb22e577cefa9ce037a9b2437e067a3305b998 |
|
MD5 | 714a11b7c3c95fdc40a92d1c9901760f |
|
BLAKE2b-256 | ec20e4785ddc0541b87eb43b3b8fd9bcb552d944a8c85352c755d37b68ca1d5e |
Hashes for libtcod_cffi-2.5.0-cp34-cp34m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a353a020ef585d0a798bf6dabd4d9941d09b3751f2c7226359a28d8d90dc968f |
|
MD5 | f236da8e319543ed7a766904e7e8a435 |
|
BLAKE2b-256 | 208174fb9a18ddbe71b53c2c36661491caa388f05fdffefc70ecb6ee8e750487 |
Hashes for libtcod_cffi-2.5.0-cp34-abi3-macosx_10_11_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 81bf3caec3d6fb3fb262245cdfa4b7719e5dc4fe70f5e227e02eb5bcfe90883a |
|
MD5 | 7fe94e7f052f1a7d804255771c28a385 |
|
BLAKE2b-256 | eb9e97c0547410beb03337e73ac595077a4171b0c79babf634a0da057fcce9c5 |
Hashes for libtcod_cffi-2.5.0-cp34-abi3-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2dd04172df943fed473cbe3e3ccdbc31f9f099e106d4ec3e6bccbdc9d8c563e1 |
|
MD5 | 87eb1a5f0db43fad6ff31ec5cf980e06 |
|
BLAKE2b-256 | 1846dd8ec9173d80ef560bb7ab37f8de78495b4cc947808059399cdde9b16a20 |
Hashes for libtcod_cffi-2.5.0-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2c99902634b093a123f39888040d7a8fecfb3127ac5e7c33ae1744b28d3ba88e |
|
MD5 | b9b16d5be1a8d8718108cc0c5bb73f02 |
|
BLAKE2b-256 | 0a1c4ed183e527572f925a00057a69abcd74f5f714ad91d125cb56b2771bbacd |
Hashes for libtcod_cffi-2.5.0-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 88090eb9a97fb32fb8b02cd45fa057201dfd25f972ce1ba0379c25cb1b6c2c1e |
|
MD5 | 47d4bd4475ec5760008df7df52eb20e9 |
|
BLAKE2b-256 | 5ee73bb50353095b9fe097e2cf59a43947e02f4ec8bcba667efae8fb18149a96 |
Hashes for libtcod_cffi-2.5.0-cp27-cp27m-macosx_10_11_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c37d2e15b0ebdbe651fd303d22aeaff55356ad649d21123a17ec71be0f72c6a7 |
|
MD5 | 87ca8e537b0ebb508a9e48582179c2a1 |
|
BLAKE2b-256 | 8c28a1619e010eafe2a9c5fd47f28c78f1825f77c7d6ac7570180a50d4bceab7 |
Hashes for libtcod_cffi-2.5.0-cp27-cp27m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 08058f8d79b970d4b3d6dfd94e871bf734d79c1e2f049a80980aacf7d430b544 |
|
MD5 | 9c65fde6d515f2407fb09479ae5e75de |
|
BLAKE2b-256 | ed94961dffe398bbdbc77938df0ab8c3b0a5d14f4efc7b4c8c7df1d834740b4e |