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.3+, 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.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.4.1-pp256-pypy_41-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7cb6603444541657c844299636224b9ab1a9269fee97d119ac08412ae5247093 |
|
MD5 | 5a1730cf6a0baae841ee7a745381d46e |
|
BLAKE2b-256 | 003b937598724ded18dd9e4a5998f4e9de313ea0d0180a8efab687ec47753328 |
Hashes for libtcod_cffi-2.4.1-pp254-pypy_41-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a550adecc77bdd010d672ca156f3a8ed74603717d953efde339e8dbe459e7b4c |
|
MD5 | 294d5ba7aedbc2fd7fbede3048b6cf15 |
|
BLAKE2b-256 | 0fc381c5343ccb2d92fc3d2133ff9d67e6810f5ec2ac578fd4a29769d668c00e |
Hashes for libtcod_cffi-2.4.1-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e5e105ef20df30ea0f8b21781255a8dadbf091fb77a44463b50b1b9b856ecc93 |
|
MD5 | 7aec146552c0a88f12fa32bef40f5c06 |
|
BLAKE2b-256 | 72b855e65a175d1d8369a51da547884fd7cf532b23af5489581b275ea33d6c5d |
Hashes for libtcod_cffi-2.4.1-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bfd33bbca093549dddcc7bc50f07fe1264526249ae240a8b832a83c15d915938 |
|
MD5 | 86f4164685674f9de038a9db9fff9325 |
|
BLAKE2b-256 | 02c24e6954973fe47945f2ed65cd68456214e89dc99c143d17d55388b50341fd |
Hashes for libtcod_cffi-2.4.1-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 51be377bf666c9d6fb885624d74360a0f1222ee4458f5e545bdec218e4b00092 |
|
MD5 | 24a7e23dc12f217937099f93a85235ad |
|
BLAKE2b-256 | bf861d5a1f2586572da151ce59b85d8f96c721aad8b37910fdacd46d5724bf87 |
Hashes for libtcod_cffi-2.4.1-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8d28d7e609a4cd6be762531dc00bb0d19a76b2631f7f7304adc94b72dd7c4728 |
|
MD5 | 804572550f091246516ade6cf3eac139 |
|
BLAKE2b-256 | 9d48a8d683e6f9575c0068acd611cc3f40e2811fe875e1d1857fdc80df9d7cc1 |
Hashes for libtcod_cffi-2.4.1-cp34-cp34m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 79d76fba323c83e080aa67b28e5684f8f8c108f4a9dd8e3c7217e0a92d11a13e |
|
MD5 | 807dada760552c10bbacc11f9ed33edf |
|
BLAKE2b-256 | a9bf0f049ea32f5041dadbd3a86f2d4f390ec6e06425c4f304865896e355c6f0 |
Hashes for libtcod_cffi-2.4.1-cp34-cp34m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f236fb2ab302fea745c55b471f2782b163d71a9518877fdfddd22a92bfd637f3 |
|
MD5 | 747405edc0865c86769e1f180ef12217 |
|
BLAKE2b-256 | e418c90bdd457cda09bdbd02627feea2c118ed93c58c1b6192abba72c9d0efe0 |
Hashes for libtcod_cffi-2.4.1-cp33-cp33m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 030ff388ae1c135ed633d8f571d231ed3042b4b57f92445639f752e6499fe410 |
|
MD5 | 63aad364ee276144feb97d32422f577a |
|
BLAKE2b-256 | 2197047ec7c222246e60a9f50b2da22acf83002ec9d3535bf94afce1fb509f8d |
Hashes for libtcod_cffi-2.4.1-cp33-cp33m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a734c8d24b4e5c959825ac69a5f78d104625621573a1a75309cf5dad63c3eb42 |
|
MD5 | d4d1f10b3009a388b57fb6ac3ecedb05 |
|
BLAKE2b-256 | 1897877478e9555bdb902c36b0f166ecf104fbb65017b29aa5d123277933a2fe |
Hashes for libtcod_cffi-2.4.1-cp33-abi3-macosx_10_11_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5d243d9aef5247f24ee7feb9074673684ae0b8ebe37ea819e8d28fbb43442aa5 |
|
MD5 | eb075158532af6a29c45e24e9a0c76ef |
|
BLAKE2b-256 | 3b89b81d646fd5af4df4f7ed7ee32d9c9c1a8224ce81d59bc3d2b9291469d6b8 |
Hashes for libtcod_cffi-2.4.1-cp33-abi3-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5becbd4d3d4e56f05c0cd02cae172fab19be5b3d1826888de1abcf4e4959698e |
|
MD5 | 56f1a0f4cc9f1c1ba3746fa1afb9d7c7 |
|
BLAKE2b-256 | 17f954455ecf45be85c66153a572f8d40aa66466d757b9f29f4383cc4c455650 |
Hashes for libtcod_cffi-2.4.1-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f695eccf1eb67ecab5c8ea9fba25ce279d115095be7c06f945d5a217af38df2f |
|
MD5 | ef33d7a4a568ae53a1c35a2da567b5b5 |
|
BLAKE2b-256 | 90607f531111bee76877fd7499115025ffa286b0c0b502fd4a626679f650132a |
Hashes for libtcod_cffi-2.4.1-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4a8a910cf28bd9a55b354bd65fb2a5e1043f12ab72b0aa7cf49a228beca8a13f |
|
MD5 | 8edc071ffc05a8b75499562785756c40 |
|
BLAKE2b-256 | 5d01eef47535353b509b1f532519b311d641a106cc7b1a182cfd6f80883f8759 |
Hashes for libtcod_cffi-2.4.1-cp27-cp27m-macosx_10_11_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 127d1d43ffd49f64f0f8a21f171186e1f8f561967100eb9e6bb03cc1719e4ab2 |
|
MD5 | d27e32e1175b23e5853818a675ee36f2 |
|
BLAKE2b-256 | b109dda8aa664c247998ba8b3cca8e7c118f0d77d8d1010a300bd7459c2bd164 |
Hashes for libtcod_cffi-2.4.1-cp27-cp27m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0b411c6f2124ee2789ddf9c5c09e9d9225759df6d1fcc000a323af89921c4ee7 |
|
MD5 | 5bb9151df7f207bcc8252607c8cda749 |
|
BLAKE2b-256 | 9a89ecac64b8dc325ce8a27d696458d6ed844da4015b582f761ee75455252416 |