Pythonic 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.
Usage
This module was designed to be backward compatible with the original libtcodpy module distributed with libtcod. If you had code that runs on libtcodpy then you can use this library as a drop-in replacement:
import tcod as libtcod
Guides and Tutorials for libtcodpy should work with the tcod module.
The latest documentation can be found here.
Installation
The recommended way to install is by using pip. Older versions of pip will have issues installing tdl, so make sure it’s up-to-date.
Windows / MacOS
To install using pip, use the following command:
> python -m pip install tdl
Linux
On Linux, tdl will need to be built from source. Assuming you have Python and pip, you run these commands to install tdl:
$ sudo apt install gcc libsdl2-dev libffi-dev python-dev libomp-dev $ pip install tdl
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.
License
python-tdl is distributed under the Simplified 2-clause FreeBSD license.
Changelog
4.1.1 - 2017-11-02
- Fixed
Fixed ConsoleBuffer.blit regression.
Console defaults corrected, the root console’s blend mode and alignment is the default value for newly made Console’s.
You can give a byte string as a filename to load parsers.
4.1.0 - 2017-07-19
- Added
tdl Map class can now be pickled.
- Changed
Added protection to the transparent, walkable, and fov attributes in tcod and tdl Map classes, to prevent them from being accidentally overridden.
tcod and tdl Map classes now use numpy arrays as their attributes.
4.0.1 - 2017-07-12
- Fixed
tdl: Fixed NameError in set_fps.
4.0.0 - 2017-07-08
- Changed
tcod.bsp: BSP.split_recursive parameter random is now seed.
tcod.console: Console.blit parameters have been rearranged. Most of the parameters are now optional.
tcod.noise: Noise.__init__ parameter rand is now named seed.
tdl: Changed set_fps paramter name to fps.
- Fixed
tcod.bsp: Corrected spelling of max_vertical_ratio.
3.2.0 - 2017-07-04
- Changed
Merged libtcod-cffi dependency with TDL.
- Fixed
Fixed boolean related crashes with Key ‘text’ events.
tdl.noise: Fixed crash when given a negative seed. As well as cases where an instance could lose its seed being pickled.
3.1.0 - 2017-05-28
- Added
You can now pass tdl Console instances as parameters to libtcod-cffi functions expecting a tcod Console.
- Changed
Dependencies updated: libtcod-cffi>=2.5.0,<3
The Console.tcod_console attribute is being renamed to Console.console_c.
- Deprecated
The tdl.noise and tdl.map modules will be deprecated in the future.
- Fixed
Resolved crash-on-exit issues for Windows platforms.
3.0.2 - 2017-04-13
- Changed
Dependencies updated: libtcod-cffi>=2.4.3,<3
You can now create Console instances before a call to tdl.init.
- Removed
Dropped support for Python 3.3
- Fixed
Resolved issues with MacOS builds.
‘OpenGL’ and ‘GLSL’ renderers work again.
3.0.1 - 2017-03-22
- Changed
KeyEvent’s with text now have all their modifier keys set to False.
- Fixed
Undefined behaviour in text events caused crashes on 32-bit builds.
3.0.0 - 2017-03-21
- Added
KeyEvent supports libtcod text and meta keys.
- Changed
KeyEvent parameters have been moved.
This version requires libtcod-cffi>=2.3.0.
- Deprecated
KeyEvent camel capped attribute names are deprecated.
- Fixed
Crashes with key-codes undefined by libtcod.
tdl.map typedef issues with libtcod-cffi.
2.0.1 - 2017-02-22
- Fixed
tdl.init renderer was defaulted to OpenGL which is not supported in the current version of libtcod.
2.0.0 - 2017-02-15
- Changed
Dependencies updated, tdl now requires libtcod-cffi 2.x.x
Some event behaviours have changed with SDL2, event keys might be different than what you expect.
- Removed
Key repeat functions were removed from SDL2. set_key_repeat is now stubbed, and does nothing.
1.6.0 - 2016-11-18
Console.blit methods can now take fg_alpha and bg_alpha parameters.
1.5.3 - 2016-06-04
set_font no longer crashes when loading a file without the implied font size in its name
1.5.2 - 2016-03-11
Fixed non-square Map instances
1.5.1 - 2015-12-20
Fixed errors with Unicode and non-Unicode literals on Python 2
Fixed attribute error in compute_fov
1.5.0 - 2015-07-13
python-tdl distributions are now universal builds
New Map class
map.bresenham now returns a list
This release will require libtcod-cffi v0.2.3 or later
1.4.0 - 2015-06-22
The DLL’s have been moved into another library which you can find at https://github.com/HexDecimal/libtcod-cffi You can use this library to have some raw access to libtcod if you want. Plus it can be used alongside TDL.
The libtocd console objects in Console instances have been made public.
Added tdl.event.wait function. This function can called with a timeout and can automatically call tdl.flush.
1.3.1 - 2015-06-19
Fixed pathfinding regressions.
1.3.0 - 2015-06-19
Updated backend to use python-cffi instead of ctypes. This gives decent boost to speed in CPython and a drastic to boost in speed in PyPy.
1.2.0 - 2015-06-06
The set_colors method now changes the default colors used by the draw_* methods. You can use Python’s Ellipsis to explicitly select default colors this way.
Functions and Methods renamed to match Python’s style-guide PEP 8, the old function names still exist and are depreciated.
The fgcolor and bgcolor parameters have been shortened to fg and bg.
1.1.7 - 2015-03-19
Noise generator now seeds properly.
The OS event queue will now be handled during a call to tdl.flush. This prevents a common newbie programmer hang where events are handled infrequently during long animations, simulations, or early development.
Fixed a major bug that would cause a crash in later versions of Python 3
1.1.6 - 2014-06-27
Fixed a race condition when importing on some platforms.
Fixed a type issue with quickFOV on Linux.
Added a bresenham function to the tdl.map module.
1.1.5 - 2013-11-10
A for loop can iterate over all coordinates of a Console.
drawStr can be configured to scroll or raise an error.
You can now configure or disable key repeating with tdl.event.setKeyRepeat
Typewriter class removed, use a Window instance for the same functionality.
setColors method fixed.
1.1.4 - 2013-03-06
Merged the Typewriter and MetaConsole classes, You now have a virtual cursor with Console and Window objects.
Fixed the clear method on the Window class.
Fixed screenshot function.
Fixed some drawing operations with unchanging backgrounds.
Instances of Console and Noise can be pickled and copied.
Added KeyEvent.keychar
Fixed event.keyWait, and now converts window closed events into Alt+F4.
1.1.3 - 2012-12-17
Some of the setFont parameters were incorrectly labeled and documented.
setFont can auto-detect tilesets if the font sizes are in the filenames.
Added some X11 unicode tilesets, including unifont.
1.1.2 - 2012-12-13
Window title now defaults to the running scripts filename.
Fixed incorrect deltaTime for App.update
App will no longer call tdl.flush on its own, you’ll need to call this yourself.
tdl.noise module added.
clear method now defaults to black on black.
1.1.1 - 2012-12-05
Map submodule added with AStar class and quickFOV function.
New Typewriter class.
Most console functions can use Python-style negative indexes now.
New App.runOnce method.
Rectangle geometry is less strict.
1.1.0 - 2012-10-04
KeyEvent.keyname is now KeyEvent.key
MouseButtonEvent.button now behaves like KeyEvent.keyname does.
event.App class added.
Drawing methods no longer have a default for the character parameter.
KeyEvent.ctrl is now KeyEvent.control
1.0.8 - 2010-04-07
No longer works in Python 2.5 but now works in 3.x and has been partly tested.
Many bug fixes.
1.0.5 - 2010-04-06
Got rid of setuptools dependency, this will make it much more compatible with Python 3.x
Fixed a typo with the MacOS library import.
1.0.4 - 2010-04-06
All constant colors (C_*) have been removed, they may be put back in later.
Made some type assertion failures show the value they received to help in general debugging. Still working on it.
Added MacOS and 64-bit Linux support.
1.0.0 - 2009-01-31
First public release.
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 tdl-4.1.1-pp258-pypy_41-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b3e4fafdfb8509cfcab09fad6f30d76c344a7d08e49a6fd3632fe8b4cbf74227 |
|
MD5 | 19e30b3f3e25bbabfc711937a380ab6e |
|
BLAKE2b-256 | 26c0373b093348a2e18cb6405cd84f4500f6d408ce983ff5e0cd2a33efaf8b37 |
Hashes for tdl-4.1.1-pp258-pypy_41-macosx_10_11_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7095d29b588a1ada9013793cf44926be311ae1dd6bbc27615e2faab73c58c8e1 |
|
MD5 | e2f30c4d48431c711d8448632c55456e |
|
BLAKE2b-256 | 1f4cd0af483a8ec4eb3607b044180bdad3e355c6858ceb0400ea7a887b03cad2 |
Hashes for tdl-4.1.1-pp257-pypy_41-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6168102da420d607871f041224b5620352d0dacce5b6d87b6160ff6f2ed25249 |
|
MD5 | 810985981f6d34ba815fe17cf22d1843 |
|
BLAKE2b-256 | 07ca049cb5781d8cba21047e261e6f9e2ef8e072e85bf21232d1e33bc9043463 |
Hashes for tdl-4.1.1-pp257-pypy_41-macosx_10_11_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d321b312044aac198e44d4bd7a5029413044177dc0844975882a324901029d61 |
|
MD5 | c7add2322bde5694dc4d51b00d3877b9 |
|
BLAKE2b-256 | 5d876aceda2c9a0ac5e19e796c533d32b20e6dcecc219d616081eff9d19bfb6c |
Hashes for tdl-4.1.1-pp256-pypy_41-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4a49dc7dac568c2abe4278bba02693257a184329ddd814e3cc7d7065e689b99e |
|
MD5 | cfef197b6efbdcbb9c07111b6ce15ac3 |
|
BLAKE2b-256 | f6c6e173da973d72f0345355b1b4dcc4d57c4350c921811231c105a6ad449959 |
Hashes for tdl-4.1.1-pp256-pypy_41-macosx_10_11_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 333dbfd1455e25910d098ef5a5d0a7aecc10b33c33dc44c34fb8c40f916d8588 |
|
MD5 | 22afce60dfff3198801a07103fb953bd |
|
BLAKE2b-256 | 5ec2b8b2601b257b60701725451a8020fae25cf35c7bbfcd705e3685436aa941 |
Hashes for tdl-4.1.1-pp254-pypy_41-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a77e1a957e41a1506c73d513be781b18e458b390ed61cffcc8d1ee4622399b97 |
|
MD5 | 8c43142181fd05fc1dccd99af8ded6e8 |
|
BLAKE2b-256 | a9ed8b8fa5c00d02501c16385465332bd802ac56680f330a634b78a867c54915 |
Hashes for tdl-4.1.1-pp254-pypy_41-macosx_10_11_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6b17f7a68797ac733437d2b1f7aa53bdd68e72ad5cdf4cbe827e4d98eeb62e58 |
|
MD5 | 418f8fc8c3b10c56a4ac94ed3803dcfd |
|
BLAKE2b-256 | 342ad6ffba4c0299d5a0f55dfffaa4a7f23d66e56cfc5e02a767789ed9459790 |
Hashes for tdl-4.1.1-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f3f9dab183ae21d5f1e66b3e683ce18f176d9364899a9613fcee74e5029b8cc |
|
MD5 | 3cd9b815dc5cbf6ec4671971020ed921 |
|
BLAKE2b-256 | 78a61b86c347fe6db3bb7b1cc6abd4da0b22d3bc8a498e78284e69aab54c8b38 |
Hashes for tdl-4.1.1-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5216b6f04f87237aa76b7bb3e07e366965f7f8a713074b8f873f22190754f07a |
|
MD5 | 1750dd3187547e754f2da90bd807ba0f |
|
BLAKE2b-256 | e4997bc56cdf8890ced20fe5a30c21b8482faf75e3e06f43885ec03b57e73ea0 |
Hashes for tdl-4.1.1-cp34-cp34m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 82d4a53d8dd49a81cf091550c93bf2b7927ec1392da50b74ec87305c947eb9c3 |
|
MD5 | 6342b15b03cbbb789f6c45d27edde200 |
|
BLAKE2b-256 | b70338239072a5910bfda42765f7f592bb3fdc1156914e19ac6eabad9181c323 |
Hashes for tdl-4.1.1-cp34-abi3-macosx_10_11_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | becf375a16d69c71b32cac2f2e19f350ed1b7a371dff721f490b22268fbba26e |
|
MD5 | d8ebf87774282c439d7cf67140a2425d |
|
BLAKE2b-256 | 864d8790d7a3491b0f77010f9511ba233110cd3f9686b493d73afa5881565d20 |
Hashes for tdl-4.1.1-cp34-abi3-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | abf0e2e7cd13f28509d6ddf520b01f431b103295f44cca062700c0c6bf25a796 |
|
MD5 | 3e03afe7064824cd16945ed734f8fc59 |
|
BLAKE2b-256 | f5d30d004db9dfd5a551bef62be1825860346396fa41c671c759245ffd7d1fc7 |
Hashes for tdl-4.1.1-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b5e7b629db3b341397db59b9ac161593dbdbb13bfd12d0f1611aa9a9104615b1 |
|
MD5 | 41cc123bc200c33b983ce2bf88a0ae6a |
|
BLAKE2b-256 | ac0f83fc3e7f1fd049c3717e1f4f506b99154f3d0e7a9545a619487218371220 |
Hashes for tdl-4.1.1-cp27-cp27m-macosx_10_11_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 89b0eaa667a4084d14d796627974c7375ad1bcb001a33b68ab632750255ffdf2 |
|
MD5 | 809a9aa1f526a02ad8056dcbd5b8a385 |
|
BLAKE2b-256 | 2eced4639808def9e8ed3cf333c29073d4e545dbe9a7d8748f1b53009b08789c |
Hashes for tdl-4.1.1-cp27-cp27m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d43bca7397ae2729ccf309ab81da1f34b4eae0f7768cb8fddad57d1105fd014 |
|
MD5 | cd9e42a3a0f70fdefd479f4096cfc0ab |
|
BLAKE2b-256 | 3794fb26861776c9bdf8494426c8983620bfd8e317485479c990064094204d8c |