0.8.0
Huge thanks to Gustorm and tomob! We're almost on parity with libtcod. Unfortunately, we've introduced some breaking changes.
Breaking changes
- Made the
tree
field ofTCOD_bsp_t
in tcod_sys private and added an unsafe method to access it - Changed
mut *
toconst *
in signatures of various BSP methods in tcod_sys - Changed the
tcod::input::Key
struct to allow handling special keys such as$
and#
. - Replaced
time::Duration
from the third-party time tostd::time::Duration
available in Rust 1.3 and newer
See the bottom of the notes for guides on how to port your code over.
Other changes
- Dijkstra pathfinding now passes Valgrind
- Implemented rustc-serialize for Color
- Implemented serde for Color
- Added the pseudorandom number generator bindings
- Added the name generator bindings
- Added the image toolkit bindings
- Added the line toolkit bindings
- Added the noise bindings
- Addeb the BSP toolkit bindings
- Ported the C++ libtcod samples code to Rust (see the
samples
example) - Implemented the Default and Debug traits to various structs
- implemented operator overloading traits for
std::colors::Color
- Added non-consuming iterators for pathfinding
Migrating from tcod 0.7.x
to 0.8.0
Rust 1.3
First and foremost, you will need to update to Rust 1.3 or newer because we use the newly-stabilised std::time::Duration. In general, tcod-rs tracks the stable track of Rust rather than any specific version. We aren't going to require the newest versions frivolously, but when there is a language feature or a stdlib utility we want to adopt, we will do so once it becomes stable.
Duration
Currently, std::time::Duration
has fewer utility methods. If you want to operate with the values returned by get_elapsed_time etc. you will have to either do it yourself or convert it to time::Duration
if you want that dependency.
Keyboard handling
The previous keyboard handling didn't allow handling of certain special characters and we had to change the layout of the tcod::input::Key struct to fix it.
In general, you'll need to modify your keyboard handling from:
match keypress.key {
Special(Enter) if keypress.left_alt => { // fullscreen }
Special(Escape) => { // exit game }
Key::Printable('>') => { // descend }
}
to:
match keypress {
Key { code: Enter, alt: true, .. } => { // fullscreen }
Key { code: Escape, .. } => { // exit game }
Key { printable: '>', .. } => { // descend }
}