From 8548690ed59f3f9fd6844c9811ed5c6ecb73ad52 Mon Sep 17 00:00:00 2001 From: Tomas Sedovic Date: Sun, 22 Mar 2015 21:49:44 +0100 Subject: [PATCH 1/4] Update the rand crate to 0.2.1 This fixes `cargo test`. --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 6a0554238..50e61c356 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,4 +28,4 @@ path = "tcod-sys" version = "2.0.5" [dev-dependencies] -rand = "0.1.2" +rand = "0.2.1" From 4bb24332877fa6a689bec2c4c5fb4ae261aede8c Mon Sep 17 00:00:00 2001 From: Tomas Sedovic Date: Sun, 22 Mar 2015 22:03:08 +0100 Subject: [PATCH 2/4] Switch to the crates.io libc This lets us to remove `libc` feature. --- Cargo.toml | 1 + src/lib.rs | 2 +- tcod-sys/Cargo.toml | 3 +++ tcod-sys/lib.rs | 1 - 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 50e61c356..80da23666 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,6 +22,7 @@ path = "src/lib.rs" [dependencies] bitflags = "0.1" +libc = "0.1.2" [dependencies.tcod-sys] path = "tcod-sys" diff --git a/src/lib.rs b/src/lib.rs index 1118d284d..5d6489323 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,4 @@ -#![feature(libc, std_misc, core, path_ext)] +#![feature(std_misc, core, path_ext)] extern crate libc; extern crate "tcod-sys" as ffi; diff --git a/tcod-sys/Cargo.toml b/tcod-sys/Cargo.toml index 09379c27e..86349efbd 100644 --- a/tcod-sys/Cargo.toml +++ b/tcod-sys/Cargo.toml @@ -12,3 +12,6 @@ build = "build.rs" [lib] name = "tcod-sys" path = "lib.rs" + +[dependencies] +libc = "0.1.2" diff --git a/tcod-sys/lib.rs b/tcod-sys/lib.rs index a41941b11..560c27a8a 100644 --- a/tcod-sys/lib.rs +++ b/tcod-sys/lib.rs @@ -1,6 +1,5 @@ #![allow(non_camel_case_types, non_snake_case, non_upper_case_globals, missing_copy_implementations, raw_pointer_derive)] -#![feature(libc)] // This is not added by rust-bindgen even though it's used heavily in the // generated code: extern crate libc; From f3804352d958c6df23245856a76ce5cc140bd1ab Mon Sep 17 00:00:00 2001 From: Tomas Sedovic Date: Sun, 22 Mar 2015 22:28:56 +0100 Subject: [PATCH 3/4] Update the README This mostly removes bits that are no longer relevant, adds features we've implemented since and gradually changes the tone towards using stable Rust (if at all possible, I'd like tcod to work on 1.0.0). --- Cargo.toml | 1 + README.md | 65 ++++++++++++++++++++++++++++-------------------------- 2 files changed, 35 insertions(+), 31 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 80da23666..e4fd93bab 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,6 +4,7 @@ description = "The Rust bindings for the Doryen library (a.k.a. libtcod)." version = "0.5.0" homepage = "https://github.com/tomassedovic/tcod-rs" repository = "https://github.com/tomassedovic/tcod-rs" +documentation = "http://tomassedovic.github.io/tcod-rs/tcod/index.html" readme = "README.md" keywords = ["gamedev", "roguelike", "libtcod"] license = "WTFPL" diff --git a/README.md b/README.md index ae77cd002..655283c26 100644 --- a/README.md +++ b/README.md @@ -10,27 +10,12 @@ useful functionality such as: * Keyboard and mouse input * Path finding * Field of view -* Portable (works on linux and windows; mac too but requires some effort) +* Portable (works on linux, windows and mac) * [Lots of other stuff](http://roguecentral.org/doryen/libtcod/features/) This project provides [Rust](http://www.rust-lang.org/) bindings for libtcod -v1.5.1 (current stable). - -**The only version tested and known to work is `libtcod 1.5.1`.** Link to other -versions (e.g. the `1.5.2` or `1.6.0` nightlies) at your own peril! - -Rust is a new-ish systems programming language that aims to be fast (on the C++ -level), memory and data-race safe, modern (first-class modules instead of a -preprocessor text-include hack, type inference, pattern matching, closures). - -We track the nightly releases of Rust, usually lagging a few days behind. The -latest version of rustc tested: - -```sh -$ rustc --version -rustc 0.11.0-pre-nightly (7ec7805 2014-06-16 08:16:49 +0000) -``` +v1.5.2. This project follows [Semantic Versioning](http://semver.org/). Since we're under `1.0.0` anything goes. The API can change at any time. @@ -39,24 +24,39 @@ Indeed, it probably should change! If you have better ideas on how it make it safer or more familiar to Rust developers, please let us know. +Documentation +--------------- + +We run `rustdoc` on every new commit: + +http://tomassedovic.github.io/tcod-rs/tcod/index.html + +But that's mostly useful for types, function signatures, etc. We don't have much +in term of actual docs, but you can always check the official ones: + +http://roguecentral.org/doryen/data/libtcod/doc/1.5.1/index2.html?c=true + + Current status -------------- -All raw tcod bindings are available via the `ffi` module. In addition we want to -provide safe (and more in line with the Rust style) wrappers. These are far from -complete however. +All raw tcod bindings are available via the `tcod-sys` crate. In addition we +want to provide safe (and more in line with the Rust style) wrappers -- if you +can segfault outside of `unsafe` blocks, that's a bug. The safe bindings are not +yet complete, however. -### Implemented +### Already Implemented -* Most of the _Console_ features (new, init_root, blit, putting text on the - screen, reading key presses, etc.) -* Most of _Map_ (new, size, set, is_walkable) -* A\* and Dijkstra _Path_ finding -* Some of the _System_ layer (get/set FPS, last frame length) +* _Colors_ +* _Console_ +* Most of the _System_ layer (FPS, time, fullscreen, screenshots) +* _Field of view_ +* _Map_ +* _Path finding_ (both A\* and Dijkstra) ### Probably Won't Ever Be Implemented Because Rust Provides This Already * Filesystem utilities -* All purposes container +* Containers * Pseudorandom generator (Rust has good RNGs, but maybe we want to provide this anyway for people porting existing code depending on tcod's RNG to Rust?) * Compression toolkit (there will probably be a better Rust library for this) @@ -65,6 +65,7 @@ complete however. * Everything else! + How to use this --------------- @@ -78,8 +79,8 @@ building process. [See below](#using-existing-binary-distribution). To use `tcod-rs`, add this to your game's `Cargo.toml`: ```toml -[dependencies.tcod] -git = "https://github.com/tomassedovic/tcod-rs.git" +[dependencies] +tcod = "*" ``` ### Building on Linux @@ -152,6 +153,10 @@ If you don't want to build libtcod yourself, you can [instruct Cargo to override the build script](http://doc.crates.io/build-script.html#overriding-build-scripts). See `.cargo/config` from the repository for an example. +NOTE: The official MinGW pre-built libraries (for Windows) +[don't seem to work with tcod-rs](https://github.com/tomassedovic/tcod-rs/issues/54). +We're not sure exactly why this is so we'd appreciate anyone's help! + Contributing ------------ @@ -168,8 +173,6 @@ typos) gets accepted, you'll get a commit access if you want it. We accept GitHub as well as regular pull requests (i.e. emailing or tweeting the URL of your feature branch works). -Please make sure it builds against the latest `rustc`. - You can regenerate the raw bindings by running: ```sh From b7e9c33dba0aec60bdf53e16441a27957b064835 Mon Sep 17 00:00:00 2001 From: Tomas Sedovic Date: Sun, 22 Mar 2015 22:33:16 +0100 Subject: [PATCH 4/4] Bump tcod-sys to 2.0.6 and tcod to 0.5.1 --- Cargo.toml | 4 ++-- tcod-sys/Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index e4fd93bab..531b6a02f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "tcod" description = "The Rust bindings for the Doryen library (a.k.a. libtcod)." -version = "0.5.0" +version = "0.5.1" homepage = "https://github.com/tomassedovic/tcod-rs" repository = "https://github.com/tomassedovic/tcod-rs" documentation = "http://tomassedovic.github.io/tcod-rs/tcod/index.html" @@ -27,7 +27,7 @@ libc = "0.1.2" [dependencies.tcod-sys] path = "tcod-sys" -version = "2.0.5" +version = "2.0.6" [dev-dependencies] rand = "0.2.1" diff --git a/tcod-sys/Cargo.toml b/tcod-sys/Cargo.toml index 86349efbd..03c3bbff4 100644 --- a/tcod-sys/Cargo.toml +++ b/tcod-sys/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "tcod-sys" description = "Raw FFI bindings & build script to link against libtcod." -version = "2.0.5" +version = "2.0.6" license = "WTFPL" homepage = "https://github.com/tomassedovic/tcod-rs" repository = "https://github.com/tomassedovic/tcod-rs/tree/master/tcod-sys"